Skip to content

feat(audit): name exec, forward, and SSH session resources - #5613

Open
krishicks wants to merge 1 commit into
mainfrom
feat/2911-name-exec-ssh-resources/krishicks
Open

krishicks wants to merge 1 commit into
mainfrom
feat/2911-name-exec-ssh-resources/krishicks

Conversation

@krishicks

@krishicks krishicks commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Exec, ForwardTcp, and SSH session records name no resources, so a reader cannot tie a record to the sandbox, relay channel, or session it acted on, or tell their own execs from someone else's. These records now name the sandbox, the relay channel each exec or forward opens, and the SSH session by its generated name. A new opt-in setting records exec command arguments. Environment variables, standard input, and session tokens never appear.

Stacked on #5612; review only the last commit until the PRs below it merge.

Related Issue

Part of #2911

Changes

  • ExecSandbox, ExecSandboxInteractive, and ForwardTcp record the workspace and sandbox, then, once the relay opens, an exec or forward resource whose uid is the relay channel ID. An exec's channel ID matches the channel_id on its command started line in the gateway's sandbox logs.
  • A TCP forward records its target host and port in data. An SSH forward names the session it used.
  • CreateSshSession and RevokeSshSession name the session by its generated name, never by its token. Revoking an already revoked session records no_op:already_absent.
  • [openshell.gateway.audit] capture_exec_command (default false) records the first 32 command arguments and how many were left out. The docs warn that arguments can contain secrets the caller passes.
  • Canary tests cover exec environment variables and standard input, later stdin and data frames, and SSH tokens on create, forward, and revoke.

Before / after

Real OCSF output from the gateway handlers, called by the test user on a ready sandbox agent-01 with a registered supervisor session. The exec's environment variable and stdin were canary strings, and the SSH token appears in no record.

Call → result Before After
ExecSandbox agent-01 python train.py with HF_TOKEN and stdin → stream ends OK Other, Success, no resources Other, Success; workspace:default, sandbox:agent-01 with its ID, exec with the relay channel ID
CreateSshSession agent-01 → OK Create, Success, no resources Create, Success; workspace:default, sandbox:agent-01 with its ID, ssh_session:btirwn
ForwardTcp SSH target with the session token → stream ends OK Other, Success, no resources Other, Success; workspace:default, sandbox:agent-01 with its ID, ssh_session:btirwn, forward with the relay channel ID
RevokeSshSession with the session token → OK Delete, Success, no resources Delete, Success; workspace:default, sandbox by ID, ssh_session:btirwn

Release Notes

Gateway audit records for exec, port forwarding, and SSH sessions now name the sandbox, the relay channel, and the session. An exec's channel ID matches its sandbox log lines. Set capture_exec_command = true under [openshell.gateway.audit] to also record exec command arguments.

Testing

  • Checks appropriate to the affected code and behavior pass
  • Unit tests added: execs and forwards name the sandbox and relay; command capture only when enabled, with the omitted count; rejected execs name the requested sandbox; SSH session and forward records never include the token; repeated and unknown revokes; TCP forward targets; config file parsing
  • E2E tests added/updated (not applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

@copy-pr-bot

copy-pr-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@krishicks
krishicks added this pull request to stack #5610 November 16, 2026 17:31
@github-actions

Copy link
Copy Markdown

@krishicks
krishicks force-pushed the feat/2911-name-exec-ssh-resources/krishicks branch from 4e259ba to 225cad7 Compare November 16, 2026 18:51
Base automatically changed from feat/2911-name-provider-config-resources/krishicks to main November 19, 2026 00:45
Exec, ForwardTcp, and SSH session records named no resources, so a reader
could not tie a record to the sandbox, relay channel, or session it acted
on, or tell which revoke ended a session.

Name the sandbox and the relay channel each exec or forward opens; an
exec's channel matches the channel_id in the gateway's sandbox logs.
Record a TCP forward's target host and port, and name SSH sessions, and
the SSH forwards that use them, by their generated name. A repeated
revoke records no_op:already_absent. Add [openshell.gateway.audit]
capture_exec_command to record exec command arguments. Environment
variables, standard input, and session tokens are never recorded.

Signed-off-by: Kris Hicks <khicks@nvidia.com>
@krishicks
krishicks force-pushed the feat/2911-name-exec-ssh-resources/krishicks branch from 225cad7 to 3a7c3be Compare November 19, 2026 01:00
@krishicks
krishicks marked this pull request as ready for review November 19, 2026 01:00

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant