-
Notifications
You must be signed in to change notification settings - Fork 52
feat(secrets): encrypt sensitive .env.local values at rest #1621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2a8babe
52a95e6
f6cb1d2
dd410f0
0df7129
49f7938
9a0426e
edb0307
e9b66f3
5d42e0e
2f53e08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ import { findConfigRoot, removeEnvVars, setEnvVar, toError } from '../../lib'; | |
| import type { AgentCoreProjectSpec, PaymentProvider } from '../../schema'; | ||
| import { PaymentConnectorNameSchema, PaymentConnectorSchema, PaymentProviderSchema } from '../../schema'; | ||
| import type { RemoveResult } from '../commands/remove/types'; | ||
| import { ANSI } from '../constants'; | ||
| import { getErrorMessage } from '../errors'; | ||
| import type { RemovalPreview, SchemaChange } from '../operations/remove/types'; | ||
| import { requireTTY } from '../tui/guards/tty'; | ||
|
|
@@ -447,6 +448,20 @@ export class PaymentConnectorPrimitive extends BasePrimitive<AddPaymentConnector | |
| if (walletSecretResult !== true) failValidation(walletSecretResult); | ||
| } | ||
|
|
||
| const usedLiteralSecretFlag = [ | ||
| cliOptions.apiKeySecret, | ||
| cliOptions.walletSecret, | ||
| cliOptions.appSecret, | ||
| cliOptions.authorizationPrivateKey, | ||
| ].some(v => v !== undefined); | ||
| if (usedLiteralSecretFlag && !cliOptions.json) { | ||
| process.stderr.write( | ||
| `${ANSI.yellow}Warning: passing secrets as CLI flags exposes them to shell history and the ` + | ||
| `process table. Prefer interactive mode (run \`agentcore add payment-connector\` with no ` + | ||
| `secret flags) for masked entry.${ANSI.reset}\n` | ||
| ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The CLI-flag leak warning only fires for
Given the PR scope says "Covers the whole CLI uniformly … not just payments," option 1 fits the stated goal. |
||
| } | ||
|
|
||
| let result: Awaited<ReturnType<typeof this.add>>; | ||
| if (provider === 'StripePrivy') { | ||
| result = await this.add({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Integ tests pollute the developer's real keychain /
~/.agentcore.runCLIinheritsprocess.env, and these tests don't setAGENTCORE_DISABLE_KEYCHAIN=1orAGENTCORE_CONFIG_DIR. On a dev/CI machine with a keychain (macOS, Linux with libsecret), the test creates/uses theaws-agentcore/env-local-secret-keyentry in the user's keychain; without a keychain, it writes to~/.agentcore/secrets.key. That's a real side effect fromnpm run test:integand (more concerning) means once the developer's keychain has a key from a previous run, these tests will validate using that key rather than a fresh one — cross-run state leakage.Same issue in
integ-tests/add-agent-auth.test.ts(the test added on line 5/120-129 of that file).Fix: set
AGENTCORE_DISABLE_KEYCHAIN=1andAGENTCORE_CONFIG_DIR=<tmpdir>in the spawned env (viarunCLI(..., { env: { ... } })andcreateTestProject/beforeAll).