fix: hold secrets in real JS private fields - #32
Merged
Conversation
cybele-ripple
approved these changes
Aug 13, 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.
TypeScript's
privateis erased at compile time, so secrets were ordinary enumerable properties at runtime —console.log(custodian)andJSON.stringify(authService)both printed them in the clear, contradicting the code's own "never logged" comments. Reproduced before fixing.Converted to
#private fields, which are unreachable at runtime and skipped by both:CustodyAuthService#privateKey,#accessTokenPalisadeAuthService#clientSecret,#accessTokenIntentSigner#privateKeyLocalSigner#wallets(seeds + private keys)Scoped to the leaves that actually hold secrets — every exposure path terminates at one of them, so this also closes the
console.log(custodian)case. Neither custodian retains its raw config object.One correction to the ticket:
JSON.stringifydid not leakLocalSigner's wallets (aMaphas no enumerable own properties) — butconsole.logdid, walking into the Map and printing every seed. Console-only for that field.Residual, documented not fixed: the options/config objects callers construct (
CustodyAuthServiceOptions.privateKey,PalisadeCustodyConfig.credentials.*.clientSecret) are plain objects.#-fields can't protect those;console.log(myConfig)still prints the secret. Both doc comments now say this instead of overclaiming.Also verified the auth ports don't re-expose: they pass the secret to
http.send, retain nothing, and their errors carry only the status.Also
test/unit/security/secret-exposure.test.ts(6 cases) — asserts the secret is absent from both renderings rather than testing the mechanism, so it survives an implementation change and fails if a field reverts toprivate.