feat(cli): warn when --env values look like credentials - #7
Conversation
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe CLI detects credential-like ChangesCredential environment warnings
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SandboxCreate
participant warn_credential_env_vars
participant ProviderProfiles
SandboxCreate->>warn_credential_env_vars: parsed --env pairs
warn_credential_env_vars->>ProviderProfiles: match credential-like keys
ProviderProfiles-->>warn_credential_env_vars: provider suggestions
warn_credential_env_vars-->>SandboxCreate: warnings or suppressed output
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
3d4db33 to
51926bc
Compare
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
51926bc to
e594d04
Compare
Summary
openshell sandbox createnow emits a non-blocking warning when an--envkey looks like a credential, steering users toward providers so secrets aren't exposed to the sandboxed agent. The warning suggests a specificprovider createcommand when the key matches a built-in provider profile, and otherwise links to the providers docs.Related Issue
NVIDIA#2548
Changes
credential_env_matchesincrates/openshell-cli/src/commands/common.rs: flags--envkeys by name only — known provider env vars frombuiltin_profiles(), plus*_TOKEN,*_SECRET,*_PASSWORD,*_CREDENTIAL,*_ACCESS_KEY,*_SECRET_KEY,*_API_KEYsuffixes (case-insensitive). Never inspects or prints values.warn_credential_env_vars: prints a non-blocking stderr warning per flagged key. When built-in profiles claim thekey it lists a specific
openshell provider createcommand per match (a key can map to several, e.g.GITHUB_TOKEN→copilot and github); otherwise it links to the providers docs.
--no-credential-warningsflag tosandbox createand wire the warning in before theCreateSandboxRPC(create only, not
exec).warn_credential_env_varsthroughrunto match the existingparse_env_pairscall pattern.common.rscovering profile match, suffix-only match, case-insensitivity, non-credential skip,no-value-leak, and deterministic ordering.
docs/sandboxes/manage-sandboxes.mdx.Testing
mise run pre-commitpassesChecklist
Summary by CodeRabbit
New Features
--no-credential-warningsto suppress these notifications.Documentation