You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gpt-pilot/src/secrets
Dale Babiy 8a4d8c889c
fix(secrets): normalize inline SecretRef token/key to tokenRef/keyRef in runtime snapshot (#31047)
* fix(secrets): normalize inline SecretRef token/key to tokenRef/keyRef in runtime snapshot

When auth-profiles.json uses an inline SecretRef as the token or key
value directly (e.g. `"token": {"source":"file",...}`), the resolved
plaintext was written back to disk on every updateAuthProfileStoreWithLock
call, overwriting the SecretRef.

Root cause: collectTokenProfileAssignment and collectApiKeyProfileAssignment
detected inline SecretRefs but did not promote them to the canonical
tokenRef/keyRef fields. saveAuthProfileStore only strips plaintext when
tokenRef/keyRef is set, so the inline case fell through and persisted
plaintext on every save.

Fix: when an inline SecretRef is detected and no explicit tokenRef/keyRef
exists, promote it to the canonical field and delete the inline form.
saveAuthProfileStore then correctly strips the resolved plaintext on write.

Fixes #29108

* fix test: cast inline SecretRef loadAuthStore mocks to AuthProfileStore

* fix(secrets): fix TypeScript type error in runtime test loadAuthStore lambda

* test(secrets): keep explicit keyRef precedence over inline key ref

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
9 months ago
..
apply.test.ts fix: restore dm command and self-chat auth behavior 9 months ago
apply.ts fix: stabilize secrets land + docs note (#26155) (thanks @joshavant) 9 months ago
audit.test.ts test: harden flaky timeout and resolver specs 9 months ago
audit.ts fix: stabilize secrets land + docs note (#26155) (thanks @joshavant) 9 months ago
config-io.ts feat(secrets): replace migrate flow with audit/configure/apply 9 months ago
configure.ts fix(secrets): harden apply and audit plan handling 9 months ago
json-pointer.ts Secrets: preserve runtime snapshot source refs on write 9 months ago
plan.ts fix(secrets): harden plan target paths and ref-only auth profiles 9 months ago
provider-env-vars.ts Onboard: require explicit mode for env secret refs 9 months ago
ref-contract.ts feat(secrets): finalize mode rename and validated exec docs 9 months ago
resolve.test.ts test(secrets): cover skill migration and symlinked exec command flow 9 months ago
resolve.ts feat(secrets): allow opt-in symlink exec command paths 9 months ago
runtime.test.ts fix(secrets): normalize inline SecretRef token/key to tokenRef/keyRef in runtime snapshot (#31047) 9 months ago
runtime.ts fix(secrets): normalize inline SecretRef token/key to tokenRef/keyRef in runtime snapshot (#31047) 9 months ago
shared.ts feat(secrets): replace migrate flow with audit/configure/apply 9 months ago