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>
📝 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 | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
3d4db33 to
51926bcCompareletv1nnn
commented
Aug 7, 2026
@coderabbitai full review |
✅ Action performedFull review finished. |
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
51926bc to
e594d04CompareSigned-off-by: Artem Lytvyn <alytvyn@redhat.com>
e876779 to
9977c6dCompareletv1nnn
commented
Aug 10, 2026
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/openshell-cli/src/main.rs`:
- Around line 1442-1444: Update the help text for the no_credential_warnings CLI
option to say it suppresses warnings when --env keys look like credentials,
replacing “values” with “keys” while leaving the flag behavior unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 795c59d2-dd89-4dbe-a469-a55454f43c85
📒 Files selected for processing (4)
crates/openshell-cli/src/commands/common.rscrates/openshell-cli/src/main.rscrates/openshell-cli/src/run.rsdocs/sandboxes/manage-sandboxes.mdx
| /// Suppress warnings when --env values look like credentials. | ||
| #[arg(long = "no-credential-warnings")] | ||
| no_credential_warnings: bool, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Correct the flag description.
The detector checks --env keys. It does not inspect values. Change “values” to “keys” so --help matches the behavior.
Proposed fix
- /// Suppress warnings when --env values look like credentials.+ /// Suppress warnings when --env keys look like credentials.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /// Suppress warnings when --env values look like credentials. | |
| #[arg(long = "no-credential-warnings")] | |
| no_credential_warnings:bool, | |
| /// Suppress warnings when --env keys look like credentials. | |
| #[arg(long = "no-credential-warnings")] | |
| no_credential_warnings:bool, |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@crates/openshell-cli/src/main.rs` around lines 1442 - 1444, Update the help
text for the no_credential_warnings CLI option to say it suppresses warnings
when --env keys look like credentials, replacing “values” with “keys” while
leaving the flag behavior unchanged.
This pull request has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity. |
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