Repository navigation
feat(secret): grant Secrets from Env Files and save typed Secrets into them - #484
Merged
Merged
Conversation
…o them Adds the Env File Secret Provider (dotenv://<path>#<KEY>). Closes #478.
- An invalid global settings file with dotenv.enabled: false keeps the provider off - Show a project link to an outside file as outside the project, and list it once - Record grants under the provider's canonical locator (~ expanded, project-relative) - Append with O_NOFOLLOW, and check a save once - Keep secret_list's description unchanged without Secret Providers
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.
Closes #478.
Summary
A second Secret Provider, Env files (
dotenv), reads Secret Grants from Env Files and saves typed Secrets into them as new keys.packages/pi-secret/src/ +├── env-file-provider.ts # EnvFileProvider: path rules, search walk, parse, append-only save ├── secret-settings.ts # + dotenv schema, per-provider merge, warnings[], globalEnvFileSwitch ├── pi-secret-extension.ts # + ProviderContext, defaultSecretProviders, descriptions naming the providers loaded ├── approval-dialog.ts # + per-row warning line └── secret-provider.ts # + locatorExample, saveExample, LocatorDescription.warningDocs: the glossary term Env File, ADR-0003 (save typed Secrets into Env Files; warn, don't block), README, the
pi-secretskill, and a minor changeset.Evidence
oponPATH, Pi registerssecret_ask,secret_list,secret_forgetonly; a.envvalue can only be read by the agent itself.After:
test/env-file-grants.test.ts.envwith noopregisterssecret_ask_grantandsecret_savetoo; no Env File, noop, and no settings leave today's tool set and descriptions unchangedenabled: falsewins, even in an otherwise invalid settings filedotenv://.env#KEYresolves through both Secret Reference forms, follows an edit to the file, and blocks the call once the key is gone;${VAR}stays literalfilesentry outside the project is searchable and grantable; the same entry in project settings is dropped with a warning; invalid settings keep project Env Files readablesecret_saveappends, grants with the original expiry, and the dialog showsnot ignored by gitin a repository, but not for an ignored file or outside onetest/env-file-provider.test.tscovers nested search (skipping.gitandnode_modules), values never returned, symlinks in and out of the project,~, and save round-trips for spaces,#, quotes, newlines, backslashes and${…}.pnpm --filter @ian-pascoe/pi-secret test: 8 files, 112 tests pass.pnpm verify:pushpasses. The combinedtest/secret-guardian-combined.test.tspasses.Merge Danger
Door: two-way
Nothing is migrated. The new settings and session entries are additive. Saving only ever appends a key to a file; it never edits or removes one.
Blast Radius: pi-secret
secret_ask_grantandsecret_savewithoutop. Turn it off with globalsecret.providers.dotenv.enabled: false.secret.providersreplaced the global one wholesale, so a projectdotenvblock would have wiped the global 1Password vault list.secret_ask_grant,secret_saveandsecret_list, and the provider prompt line, now name the providers loaded. That changes the text for 1Password-only users once, at upgrade.SECRET_PROVIDER_GUIDELINEis replaced bysecretProviderGuideline(providers).PiSecretOptions.providersnow takes aProviderContext.process.cwd(), which a root test can't set..env*link to some other file inside the project is accepted.