fix: reject inline secrets across runtime and identity credential commands - #2080
Merged
Conversation
…eSecret The runtime add handler resolved its --api-key with the generic resolveText, so an inline secret value was accepted and a trailing newline was not stripped. Switch to resolveSecret (stdin/file only, single-line enforced), matching the api-key and oauth credential handlers and the flag's documented contract.
The standalone identity api-key/oauth2 credential-provider create and update handlers resolved their --api-key / --client-secret with the generic resolveText, so an inline secret value was accepted and a trailing newline was not stripped. Inline secrets on argv leak into shell history, ps output, and CI logs. Switch all four to resolveSecret (stdin '-' or file:// only, single-line enforced) and drop "inline" from the flag help, matching the project add credentials and runtime handlers. Tests feeding a secret now pipe it via stdin; added inline-rejection coverage for api-key and oauth2 create.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2080 +/- ##
=========================================
Coverage 97.24% 97.24%
=========================================
Files 396 396
Lines 24019 24021 +2
=========================================
+ Hits 23357 23359 +2
Misses 662 662 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jariy17
approved these changes
Aug 24, 2026
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.
What
Route every secret-value flag through
SourceResolver.resolveSecret(stdin-orfile://only, single-line enforced, trailing newline stripped) instead of the genericresolveText. Inline secrets onargvleak into shell history,psoutput, and CI logs.Handlers changed:
project add runtime--api-key(addresses jariy17's comment on feat(project): scaffold add runtime handler #2035, r3833097791: shift secret handling intoSourceResolverand reuse it in runtime on rebase;resolveSecretwas added in feat(project): add 'project add credentials' (AgentCore Identity api-key + oauth) #2046).identity api-key-credential-provider create|update--api-key.identity oauth2-credential-provider create|update--client-secret.Also dropped "inline" from those flags' help text so it matches the enforced contract, aligning with the
project add credentialshandlers.Not changed: bearer-token invoke paths (ephemeral, never persisted) and structured-config flags (JSON/tags/free text) that legitimately use
resolveText.Testing
tsc --noEmitclean.--api-key, and identity api-key + oauth2 create.