Skip to content

Adding osquery mode to console to run queries directly#912

Merged
javuto merged 1 commit into
developfrom
osquery-mode-sql
Jul 23, 2026
Merged

Adding osquery mode to console to run queries directly#912
javuto merged 1 commit into
developfrom
osquery-mode-sql

Conversation

@javuto

@javuto javuto commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds the SQL mode, command history, file carve support, node-scoped acceleration safeguards, and UI/handler fixes for more reliable quasi real-time behavior.

Changes

  • Added console session metadata and command lifecycle handling:

    • Per-session working directory.
    • Per-node/per-user command history.
    • Active session heartbeat via GET /console/{env}/sessions/{session_id}.
    • Session freshness guard so stale active sessions stop accelerating nodes.
  • Added osquery SQL mode:

    • sql or osquery enters an osquery> prompt.
    • Queries issued in SQL mode are sent as raw read-only osquery SQL.
    • .exit, exit, or quit leaves SQL mode.
    • .tables lists loaded osquery tables supported by the node platform.
    • Linux distro platform values, such as Debian, are normalized to Linux table support.
  • Added console file carve support:

    • get <path> creates a targeted file carve.
    • Requires carve permission.
    • Carves are attributed as issued from console by the user and target the console node.
  • Tightened accelerated query behavior:

    • Default accelerated read interval is now 5 seconds.
    • Console distributed queries use type = console.
    • Console queries are hidden from normal query lists.
    • Query reads only return accelerate for the node with a pending console query or a fresh active console session.
    • Stale sessions no longer keep nodes accelerated.
    • Expired console commands expire their backing distributed query and node query rows.
  • Fixed console result handling:

    • Status-only osquery errors are processed even when no result payload is returned.
    • Query result decoding supports wrapped osquery query-write payloads.
    • Expired/deleted/completed distributed queries are filtered out of node query reads.
  • Improved console UI:

    • Shows a spinner while waiting for the node.
    • Keeps focus on the command input after commands run.
    • Pins the command input outside the scrollback pane.
    • Focuses the input when the console opens.
    • Shows node context in the header, including IP, osquery user, osquery version, and platform.
    • Adds session heartbeat while the console is open.

Validation

  • GOCACHE=/tmp/osctrl-gocache go test ./pkg/console ./pkg/queries ./cmd/api/handlers ./cmd/tls/handlers
  • npm test -- NodeConsolePage.test.tsx
  • npm run check
  • git diff --check

@javuto javuto added osctrl-tls osctrl-tls related changes osctrl-api osctrl-api related changes queries On-demand queries related issues 🖥️ console Console related issues labels Jul 23, 2026
@javuto
javuto merged commit 9220a32 into develop Jul 23, 2026
8 checks passed
@javuto
javuto deleted the osquery-mode-sql branch July 23, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🖥️ console Console related issues osctrl-api osctrl-api related changes osctrl-tls osctrl-tls related changes queries On-demand queries related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant