feat(cli): warn when --env values look like credentials - #2655
Conversation
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
3d4db33 to
51926bc
Compare
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
51926bc to
e594d04
Compare
johntmyers
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
Validation: This PR is project-valid because it implements the validated, focused CLI security-guidance feature in #2548.
Head SHA: e594d04e077b7b2f32e4b2544f93c3472fcbe802
Base SHA: 4cb77a900ebd6b789d2b68daaba4830866833b1c
Merge base SHA: d85339d621e0e96697499a9d4c8780ee9b9c1324
Patch ID: 9688fd66ee5f7411bea2ff2bf05d783b7faf450f
Gator payload: 3
Review mode: initial
Previous reviewed SHA: none
Thanks @mrunalp — I checked the suggestion to match credential words anywhere in the key against the linked issue, the PR description, the docs, and concrete environment-variable names. That broader match introduces the blocking false-positive case below.
Blocking findings:
GATOR-e594d04e-01: substring matching warns on unrelated keys that merely contain a credential word.
Carried findings:
- None
Non-blocking suggestions:
- Exercise the externally observable stderr and suppression paths so a future value leak or broken
--no-credential-warningsbehavior is covered; the currentno_value_leaktest only inspects the detector's intermediate data.
Docs: Fern user docs are updated in docs/sandboxes/manage-sandboxes.mdx, but their documented suffix behavior currently conflicts with the implementation.
Next state: gator:in-review
Re-check After Maintainer Update@johntmyers, I checked your August 10 reply that the goal is to scan arbitrary environment-variable names for potential credentials. Head SHA: What I checked: #2548 defines the heuristic as exact built-in credential names plus Disposition: the finding remains unresolved because the implementation is broader than the accepted issue and published behavior, with reachable false positives that can drive warning suppression. If broad substring matching is now intentional, an explicit maintainer waiver plus aligned PR/docs wording would resolve that contract concern; otherwise the code should restore suffix matching and add a false-positive test. Remaining items:
Next state: |
|
/ok to test e594d04 |
|
hey @johntmyers @mrunalp, I have the following idea: a few keywords are two words joined by So I'll split on |
That sounds good to me. |
Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
e876779 to
9977c6d
Compare
johntmyers
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
Validation: This PR is project-valid because it implements the focused credential-warning feature tracked in #2548.
Head SHA: 9977c6d8e1714c87f4ba81077ff6c45238baa41f
Base SHA: c825b1f8efac457f3ca3c6f9e06fb068e8ce3ecc
Merge base SHA: d85339d621e0e96697499a9d4c8780ee9b9c1324
Patch ID: 5cb325a17a09099026968dabd0e0a94f4a8ce09b
Gator payload: 3
Review mode: follow_up
Previous reviewed SHA: e594d04e077b7b2f32e4b2544f93c3472fcbe802
Thanks @letv1nnn. I checked the underscore-segment approach you proposed and @johntmyers approved. The latest head limits matching to whole credential-word segments, adds positive and false-positive regression coverage, and aligns the Fern docs with that behavior.
Blocking findings:
- No blocking findings remain.
Carried findings:
GATOR-e594d04e-01: resolved by the whole-segment matcher, regression tests forTOKENIZERS_PARALLELISM,PASSWORDLESS_LOGIN, andSECRETARY_EMAIL, and updated published documentation.
Docs: Fern user docs are updated in docs/sandboxes/manage-sandboxes.mdx; navigation is unchanged because no page was added or moved.
Next state: gator:watch-pipeline
|
/ok to test 9977c6d |
|
Label |
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
#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 the key it lists a specificopenshell 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, notexec).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.Example output
Testing
mise run pre-commitpassesChecklist