Repository navigation
fix(secrets): stop committed secrets from setting LD_PRELOAD, PATH and similar in sc run - #362
Merged
Merged
Conversation
The secret registry is repository data and secret_add needs no key, so a writer could register a secret sealed to a victim under LD_PRELOAD, PATH, NODE_OPTIONS and similar, and sc run would inject it into the child. The registry key was also never compared with the name the secret was sealed under, so one value could be served under another name. One rule in secrets.rs: [A-Za-z_][A-Za-z0-9_]*, minus a deny list of loader and program-selection variables and the LD_, DYLD_, GIT_CONFIG and SC_ prefixes. secret_add refuses a failing name. secret_values, which every injecting path goes through (sc run, --secrets-fd, sc ws run --with-secrets, sc work --with-secrets), refuses the whole run before decrypting anything when a key fails the rule or differs from the sealed name. THREAT-MODEL records the residual: a writer can still replace the value of an allowed name. The rewrap tests and demo used db-pass and api-key, which the rule refuses; they are now DB_PASS and API_KEY.
…, guard rotate Uppercase the name before every deny check on every platform, since tools read npm_config_*, http_proxy and similar in any case. Widen the deny list with compiler, proxy, CA-bundle, cloud and container config variables and the XDG_, OPENSSL_, DOTNET_, CORECLR_, COR_, GEM_, LUA_, PIP_, UV_ and YARN_ prefixes, and the _OPTS and ASKPASS suffixes. Injection now skips a registry entry whose name fails the rule, with a stderr warning and without opening it, in strict and non-strict mode. A legacy name such as db-pass or a planted one no longer stops every run. A key that differs from the sealed name still refuses the run, and secret rotate without --value refuses it too instead of re-sealing it under the registry key.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
tonibergholm
approved these changes
Nov 20, 2026
tonibergholm
left a comment
Member
There was a problem hiding this comment.
Reviewed: sol-loop (3 rounds, approved) plus a Mythos security review, required checks green, Codex review has no findings.
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.
The committed-secret registry is repository data, and adding a secret needs no key. A writer could therefore register a secret sealed to someone else's public key under
LD_PRELOAD,PATHorNODE_OPTIONS, and that person's nextsc runinjected it into the child. The registry key was also never compared with the secret's own sealed name, so one value could be served under another name.This PR gives secret names one rule,
[A-Za-z_][A-Za-z0-9_]*, plus a deny list. The list covers variables that change how a process loads code, which program runs, or where it fetches from: loader, shell, interpreter, build-tool, proxy, CA and cloud-config variables. They are matched case-insensitively on every platform, with exceptions for a few well-known credential names such asNODE_AUTH_TOKENandGEM_HOST_API_KEY.sc secret addrefuses a name that fails the rule.sc run,--secrets-fd,sc ws run --with-secrets,sc work --with-secrets) refuses the run when a registry key differs from the sealed secret's name.db-passtherefore no longer injects, but it does not block the run either.sc secret rotatewithout a value refuses a relabeled entry instead of re-sealing it under the wrong name.The threat model records what stays open. The registry is still unauthenticated, so a writer can replace the value of an allowed name such as
DATABASE_URLwith one sealed to the victim. Recipient and registry trust come in a separate change.Proof: the new tests in
secrets.rsfail with the checks disabled and pass with them:npm_config_script_shellLD_PRELOADentry that is never opened or injectedcargo test -p scl-repo -p scl-clianddemo/run_rewrap_demo.shpass. That demo now usesDB_PASS, since the olddb-passfails the rule.Reviewed with sol-loop: 3 rounds with gpt-6.2-sol. Sol verdict: approved.
Created with Claude Opus 5.5 and Claude Sonnet 5.5 in Claude Code.