Skip to content

feat: a config-manager pull replaces a key set with private key material by a placeholder - #1362

Merged
vscheuber merged 3 commits into
mainfrom
feat/redact-private-keys-in-pulls
Nov 17, 2026
Merged

vscheuber merged 3 commits into
mainfrom
feat/redact-private-keys-in-pulls

Conversation

@vscheuber

Copy link
Copy Markdown
Contributor

Summary

A key set (jwkSet) of an issuer, a software publisher, a remote consent agent or an OAuth2 client is meant to hold public keys, but nothing stops a person from storing a private or symmetric key in it. The config-manager pulls wrote such a key set as it was, with a warning that never printed it, so the key reached files that are meant to be committed. This applies core 0013, secrets are never exported in the clear to them. The maintainer chose "redact and warn" over a refusal flag and over keeping the key.

  • Pull: a jwkSet with a private or symmetric JWK member (d, p, q, dp, dq, qi, oth, k) is not written. The file has ${<ID>_JWKSET} in its place (id in upper case, - as _, the way record 0054 names a password variable) and one warning names the object, the realm, the property and the variable. A key set with public keys only is written as before. A set with one private key among public ones is replaced as a whole. The rule runs after the overrides are merged, so a key in an overrides file is replaced as well, and an override that is a placeholder of the user's own is kept.
  • Push: the placeholder is filled from the variable (-E, --env-file, process environment). The library puts a value into the text of the file before it parses it, so a key set (JSON text with quotes) in a variable broke the file. A push now puts the key set into the string correctly, only for a jwkSet that is a single placeholder; a value that somebody already escaped by hand still works. A variable without a value fails that file, names the variable, sends nothing for it and never stores the placeholder.
  • Where: one module without library imports (src/ops/AgentKeySets.ts), used by the shared kind module (issuers, software publishers, CIMD profiles) and by the generic oauth2-agents kind (remote consent agents, OAuth2 clients).
  • Record: proposed record 0055, index row, MIGRATION.md entry, help text of the six commands and four -h snapshots (diffs read: only the new sentences).

Part of #1355.

Not covered

The OAuth2 client file of an application folder (oauth2-client.json) has its own variable convention for the client secret (APP_<NAME>_CLIENT_SECRET) and its own reader. It still writes a key set as it is. A decision on its variable name is needed before it follows this rule.

Decisions taken (maintainer: change on review)

  • Variable name <ID>_JWKSET; a second key set in one object would get _2. Two objects with the same id in different realms share a variable.
  • The record is proposed: the choice was made in conversation, not in an issue.
  • The redaction is not counted as a left-out property in the verbose output of record 0054, because the property is written.

Verification

  • npx tsc --noEmit exit 0; npm run check exit 0 (0 errors; 8 warnings, none in a changed file); Prettier clean on the new and changed tests.
  • Whole suite after the last commit, with a fresh temporary HOME: 1099 suites passed, 10 skipped; 10849 tests passed, 149 skipped; 10279 snapshots passed; exit 0. npm run test:guidance: 699 passed. The first whole run failed 6 tests of one file (a test that replaces the imports of the modules under test by spies and did not know the new pure module); the third commit fixes that file and nothing else.
  • New tests: 30 for the pure module, 8 for the generic kind (pull and push), the key set tests of the issuer and publisher pulls rewritten for the placeholder, 4 against the real library and the fake tenant (a key set with quotes in a variable from the process environment and from -E, the second pull writes the same file, a push without the variable names it and sends nothing).
  • Negative proofs (each change made in the production code alone, the new tests run, then reverted): no redaction anywhere 16 failed; shared push reads with the plain library read 2 failed; generic push plain read 1 failed; generic pull without redaction 3 failed; shared pull without redaction 9 failed; oth not a secret member 2 failed; value not JSON-escaped 6 failed; state not put back 2 failed; mixed set keeps its public keys 1 failed; warning names something else than the text pins 1 failed; variable without the _JWKSET suffix 12 failed.
  • -h snapshots: four updated (pull and push of issuers and software publishers), every diff is the added sentence. The text of pull|push oauth2-agents shows only with -hhh, which no snapshot covers; checked by hand.
  • No tenant was contacted. No committed fixture or recording of the config-manager agent files holds a private JWK member (pattern scan); none was rewritten.

🤖 Generated with Claude Code

trial and others added 3 commits November 16, 2026 15:54
…t file

Proposed record 0055: a key set (jwkSet) that holds a private or symmetric key
is replaced by ${<ID>_JWKSET} on pull and filled from that variable on push.
It applies core record 0013 to the agent files of config-manager.

Refs #1355

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ial by a placeholder

A jwkSet that holds a private or symmetric key (d, p, q, dp, dq, qi, oth, k) is
not written to the agent file of an issuer, a software publisher, a remote
consent agent or an OAuth2 client: the file has ${<ID>_JWKSET} and one warning
names the object, the property and the variable. A push fills the variable from
the key set as JSON text and fails the file, naming the variable, when it has no
value. Applies record 0055 and core record 0013.

Refs #1355

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e agent files real

The test replaces every relative import of the modules under test by spies except
the pure ones; AgentKeySets is pure like AgentFileShape.

Refs #1355

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vscheuber vscheuber added the no-auto-processing Concierge never touches this item; remove the label to hand it over label Nov 16, 2026
@vscheuber
vscheuber merged commit cca391e into main Nov 17, 2026
23 checks passed
@vscheuber
vscheuber deleted the feat/redact-private-keys-in-pulls branch November 17, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-auto-processing Concierge never touches this item; remove the label to hand it over

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant