-
Notifications
You must be signed in to change notification settings - Fork 194
fix(sandbox): deny SSH keys and GPG stores with fail-closed discovery #1011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
423f7ee
fix(sandbox): deny SSH private keys and the GPG keyring
cairn-intern 64907f1
fix(sandbox): expand SSH %d and keep lexical credential denies
cairn-intern 470dbc0
fix(sandbox): keep lexical credential denies through bwrap and Seatbelt
cairn-intern 4571410
fix(sandbox): follow SSH config symlinks and keep lexical dir dests
cairn-intern 29d560b
fix(sandbox): dual-add lexical dests only when a symlink is involved
cairn-intern 571dfde
fix(sandbox): bound SSH walks and honor nested GPG allowRead
cairn-intern dc9c168
fix(sandbox): sniff .pub keys, expand ${HOME}, mask symlink dests
cairn-intern b76002e
fix(sandbox): skip overlaid file binds and sniff named keys
cairn-intern 5f7f6b4
fix(sandbox): bind when overlay fails; sniff named IdentityFiles
cairn-intern b875b61
fix(sandbox): deny GNUPGHOME and unify bwrap dest spellings
cairn-intern bd0589c
fix(sandbox): remove unused appendUnreadableLinuxPathArgs helper
cairn-intern 4beb32b
fix(sandbox): normalize dangling symlink assertion and narrow tmpfs p…
cairn-intern a6f8531
fix(sandbox): traverse directory symlinks, support OpenSSH escape/env…
cairn-intern 5677bf8
test(sandbox): skip symlink tests gracefully when symlinks are unperm…
cairn-intern a68d043
Preserve parent denies on nested grants and canonicalize test paths
euxaristia 29fac7c
Normalize policy golden baseline for lexical credential symlinks
euxaristia 99d4bcb
Refuse sandbox execution when credential protection is incomplete.
euxaristia 29addbd
Release degraded command plan leases in metadata test. Refs #815
euxaristia be8d5b3
Page SSH discovery to preserve protection in large directories.
euxaristia 5076e9b
fix(sandbox): resolve SSH config path variables from command environment
euxaristia ac80d1f
fix(sandbox): address review findings on SSH key discovery and config…
euxaristia 2dc8dcb
fix(sandbox): support symlinked SSH dirs and canonicalize test candid…
euxaristia b7bb06b
fix(sandbox): bound directory-symlink traversal in SSH key discovery
euxaristia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package sandbox | ||
|
|
||
| import ( | ||
| "os" | ||
| "path/filepath" | ||
| "testing" | ||
| ) | ||
|
|
||
| // testPolicyWithSSHDirectoryDeny gives command-planning tests a maskable SSH | ||
| // policy so they reach their intended network, runtime, or other credential | ||
| // checks. Supplied homes must belong to the test; otherwise create an isolated | ||
| // home and redirect all credential roots before constructing the profile. | ||
| func testPolicyWithSSHDirectoryDeny(t *testing.T, homes ...string) Policy { | ||
| t.Helper() | ||
| if len(homes) == 0 { | ||
| home := t.TempDir() | ||
| homes = []string{home} | ||
| for _, name := range []string{"HOME", "USERPROFILE", "XDG_CONFIG_HOME", "XDG_CACHE_HOME", "XDG_STATE_HOME", "APPDATA", "LOCALAPPDATA"} { | ||
| t.Setenv(name, home) | ||
| } | ||
| } | ||
| for _, name := range []string{"ZERO_OAUTH_TOKENS_PATH", "ZERO_MCP_OAUTH_TOKENS_PATH", "GNUPGHOME", "ZERO_OAUTH_STORAGE", "CLOUDSDK_CONFIG", "GH_CONFIG_DIR", "DOCKER_CONFIG", "KUBECONFIG", "NETRC", "GOOGLE_APPLICATION_CREDENTIALS", "NPM_CONFIG_USERCONFIG", "npm_config_userconfig"} { | ||
| t.Setenv(name, "") | ||
| } | ||
| policy := DefaultPolicy() | ||
| for _, home := range homes { | ||
| sshDir := filepath.Join(home, ".ssh") | ||
| if err := os.MkdirAll(sshDir, 0700); err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| policy.DenyRead = append(policy.DenyRead, sshDir) | ||
| } | ||
| return policy | ||
| } | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.