feat(sandbox): add --no-login-shell to skip shell startup files on exec - #2852
Open
letv1nnn wants to merge 4 commits into
Open
feat(sandbox): add --no-login-shell to skip shell startup files on exec#2852letv1nnn wants to merge 4 commits into
letv1nnn wants to merge 4 commits into
Conversation
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
…o-login-shell Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
letv1nnn
marked this pull request as ready for review
August 21, 2026 11:05
letv1nnn
requested review from
a team,
derekwaynecarr,
mrunalp and
sjenning
as code owners
August 21, 2026 11:05
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sandbox execalways 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 madeexecunsuitable 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
no_login_shellfield toExecSandboxRequestinproto/openshell.proto(defaultfalsepreserves current login-shell behavior).openshell-server): read the field and signal it to the supervisor over an SSHOPENSHELL_NO_LOGIN_SHELLenv request, sent beforeexecon both the non-interactive and interactive russh paths.openshell-supervisor-process): store the flag fromenv_request, thread it throughstart_shellto the PTY and pipe spawn sites, and selectbash -cinstead ofbash -lcwhen set.openshell-cli): add--no-login-shellflag tosandbox exec, wired through to both the streaming and interactive request builders.ExecOptions.no_login_shell), Go (ExecOptions.NoLoginShell), Python (no_login_shellkwarg), and TypeScript (noLoginShell) exec APIs. - Docs: document the flag and tradeoff indocs/sandboxes/manage-sandboxes.mdx; note the login-shell default and SSH env carrier inarchitecture/sandbox.md.Reproduction
Podman-backed sandbox with a profile marker seeded in
~/.bash_profile(echo PROFILE-RAN):Testing
mise run pre-commitpassesChecklist