Skip to content

feat(sandbox): add --no-login-shell to skip shell startup files on exec - #2852

Open
letv1nnn wants to merge 4 commits into
NVIDIA:mainfrom
letv1nnn:feat-sandbox-exec-no-login-shell
Open

feat(sandbox): add --no-login-shell to skip shell startup files on exec#2852
letv1nnn wants to merge 4 commits into
NVIDIA:mainfrom
letv1nnn:feat-sandbox-exec-no-login-shell

Conversation

@letv1nnn

@letv1nnn letv1nnn commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

sandbox exec always ran commands through a login shell (bash -lc), so sandbox-user startup files (.profile, .bash_profile, .bashrc) were sourced before the requested command — letting them alter its output, create files, or block it, which made exec unsuitable as a trusted execution boundary for automation and managed checks. This adds an opt-out (--no-login-shell / no_login_shell) that runs the command without sourcing those files, while the login-shell default is preserved for existing callers.

Related Issue

Closes #2668

Changes

  • Add no_login_shell field to ExecSandboxRequest in proto/openshell.proto (default false preserves current login-shell behavior).
  • Gateway (openshell-server): read the field and signal it to the supervisor over an SSH OPENSHELL_NO_LOGIN_SHELL env request, sent before exec on both the non-interactive and interactive russh paths.
  • Supervisor (openshell-supervisor-process): store the flag from env_request, thread it through start_shell to the PTY and pipe spawn sites, and select bash -c instead of bash -lc when set.
  • CLI (openshell-cli): add --no-login-shell flag to sandbox exec, wired through to both the streaming and interactive request builders.
  • SDKs: expose the option in the Rust (ExecOptions.no_login_shell), Go (ExecOptions.NoLoginShell), Python (no_login_shell kwarg), and TypeScript (noLoginShell) exec APIs. - Docs: document the flag and tradeoff in docs/sandboxes/manage-sandboxes.mdx; note the login-shell default and SSH env carrier in architecture/sandbox.md.

Reproduction

Podman-backed sandbox with a profile marker seeded in ~/.bash_profile (echo PROFILE-RAN):

image

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 20, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

…o-login-shell

Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
@letv1nnn
letv1nnn marked this pull request as ready for review August 21, 2026 11:05
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
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.

sandbox exec always runs commands through a login shell, so sandbox-user startup files run before the requested command

1 participant