Repository navigation
k8s secret example loads secrets from files; an empty TLS key passphrase counts as none (BACKLOG #6182) - #3570
wshallwshall wants to merge 7 commits into
Conversation
load_checked_cert_chain treated password="" as a given passphrase, so an encrypted key with an empty passphrase (a Secret or env var set to "") went past the key-wrap refusal into OpenSSL and failed with a raw SSL error. It now normalises "" and b"" to None before the check, so that key gets the clean "no passphrase is configured" refusal, and an unencrypted key with "" still loads. BACKLOG #6182 (code limb). Verified-by: tests
The example kubectl command put the store encryption key and the database password on its command line with --from-literal, where they sit in the process list while kubectl runs and in shell history, and it passed an empty api-tls-key-password literal. It now reads each secret with --from-file from a file the operator writes in a private directory (read -rs plus the printf builtin, gen-key piped through tr), drops the empty passphrase, and says to delete the files afterwards. Only the non-secret tls-revocation-attested stays a literal. CLOUD-DEPLOYMENT.md step 3 points at the same rule, and the example-key test now pins --from-file for every secret key. BACKLOG #6182 (doc limb). Verified-by: tests
Review round 1 on the previous commit: a key wrapped under an empty passphrase used to load with "" and is now refused, and the refusal only said "Set <setting>", which the operator had done. When the passphrase given was "", the no-passphrase refusal now adds that the setting is empty and counts as none, and to give the real passphrase or re-wrap the key under a non-empty one. A test pins that key's flip from load to refusal, with a control that OpenSSL does open it with "". The check uses bool(password) rather than reassigning the argument, and the docstring no longer claims "" always failed in OpenSSL. This is a fail-closed tightening: a key wrapped under an empty passphrase, which loaded before, is refused. BACKLOG #6182 (code limb, review repair). Verified-by: tests
…rase Review round 1 on the doc limb. The recipe now runs in a subshell, so the umask and shell options end with it, with set -euo pipefail and a test -s so a failed gen-key stops it rather than leaving an empty key file; chmod 700 tightens a secrets directory left from an earlier run; tr strips the carriage return Python writes to a pipe on Windows; IFS= keeps leading and trailing spaces in a password; and the files are removed only if kubectl succeeds. The api-tls-key-password note says an empty value counts as no passphrase, matching docker/secrets.env.example and the code. CONNECTIONS.md's wrap-floor list says the TLS loaders treat an empty passphrase setting as none. BACKLOG #6182 (doc limb, review repair). Proposed PR title: k8s secret example loads secrets from files; an empty TLS key passphrase counts as none (BACKLOG #6182) Proposed vault banner: BUILT on branch b20056-6182, awaiting PR. The example kubectl command reads the store key and passwords with --from-file from operator-written files; keywrap.load_checked_cert_chain treats an empty passphrase as none given, so an encrypted key with "" gets the clean key-wrap refusal (a key wrapped under an empty passphrase, which loaded before, is now refused: a fail-closed tightening). Verified-by: tests
Review round 2. The previous commit caught its own refusal, matched its text and re-raised it from None, which the from-None gate refuses and which was fragile. key_wrap_refusal and the three refuse_weak_* helpers now take empty_passphrase, and the refusal names "<setting> is set but empty" itself: on the no-passphrase branch instead of "Set <setting>", and after the re-wrap advice on a weak wrap, so following that advice does not lead to a second refusal. The docstring now says the empty-passphrase callback is passed for "" too. Tests pin the note at every site loader and on the weak-wrap path. BACKLOG #6182 (code limb, review repair round 2). Verified-by: tests
Review round 2 on the doc limb. CONNECTIONS.md gives the remedy for a key refused over an empty passphrase setting (the real passphrase, a re-wrap under a non-empty one, or an unencrypted key) and says why it differs from the PKCS#12 rule. A changelog.d fragment records the tightening and the example Secret change. The example says the recipe is for bash on Linux or macOS, or WSL (Git Bash does not set Windows file permissions, and zsh reads read -p differently), to escrow the store key before the files go, and what to do if kubectl fails. CLOUD-DEPLOYMENT.md links to the example's reason rather than restating it. BACKLOG #6182 (doc limb, review repair round 2). Proposed PR title: k8s secret example loads secrets from files; an empty TLS key passphrase counts as none (BACKLOG #6182) Proposed vault banner: BUILT on branch b20056-6182, awaiting PR. The example kubectl command reads the store key and passwords with --from-file from operator-written files; the TLS key loaders treat an empty passphrase as none given, so an encrypted key with "" gets the key-wrap refusal naming the empty setting. A key wrapped under an empty passphrase, which loaded before, is now refused: a fail-closed tightening, with its remedy in CONNECTIONS.md and the changelog. Verified-by: tests
|
Lander (session heuristic-kepler, account 7): held at b4ebf0e for one comment line; your QA line is the review proof. A fresh-context reviewer I started ran the real loaders (API, MLLP, DICOM, FTPS, SOAP opener, the direct call) on four throwaway keys with four passphrases each, at this head and at main 40d00ed: the head never accepts what main refused; the only newly refused load is a key encrypted under an empty passphrase with "" set, refused loudly with cause and remedy; no error text carries the passphrase or key bytes; the What is wrong. Fix. This one sentence and nothing else. Replace "or in WSL on Windows: Git Bash's chmod and umask do not set Windows file permissions, so the directory there would not be private." with "or in WSL on Windows from a directory in the Linux file system (for example under ~), not under /mnt: Git Bash's chmod and umask do not set Windows file permissions, and a Windows drive under /mnt may ignore them too, so the directory there would not be private." Re-wrap only that comment. A Lander repair Builder is applying it now (repair 1 of 2). Queued for filing under R2, none holding the merge: the changelog's closed site list names SOAP, where the connector already turned "" into None on main, so nothing changed there (prefer "at least the API listener, MLLP, the HTTP listener, DICOM and FTPS"); the empty-setting note drops the docs' third remedy and its "a key that has none" wording; the |
The WSL advice now says to work from the Linux file system, since a Windows drive under /mnt may ignore chmod and umask. Verified-by: tests
|
Lander (session heuristic-kepler, account 7): the hold's one sentence is applied (b5a51be, Lander repair 1 of 2; fast-forward, no force). I checked the delta b4ebf0e..b5a51be by diff: one file, comment lines only, the hold's text word for word. No further review round ran on that comment; the measured review covers the code, which did not change. Decision d20261202T141114107-fef938 (decided by lander under the Owner's instruction of 2026-11-28, empower added class 3): merge with the findings above filed. Undo: revert the squash commit. Pinned head for the merge: b5a51be. I enqueue once every required context is green on it. |
|
Lander (session heuristic-kepler, account 7): |
|
Lander (session heuristic-kepler, account 7): |
|
Lander (session heuristic-kepler, account 7): |
Row: BACKLOG #6182. Changes a security control: fail-closed tightening (a key wrapped under an empty passphrase, which loaded on main, is now refused with a note naming the empty setting). docker/k8s/secret.example.yaml now uses --from-file with a guarded recipe; tests/test_b532w3_k8s_attestation_check.py now pins --from-file.
QA: Level xhigh. Tag: xhigh effort -> 10 inline angles -> dedup (no verify) -> sweep -> <=15 findings (forks a5c4e13ce8d1eebb7 round-b3e9ca8b, a134de4ee114e0fef round-7c41e09a, a6dc707422e32eca1 round-e58d2f13). Rounds: 2 + 1 unrepaired.
Checks: ruff, three mypy legs (scripts/asvs unchanged, skipped), pytest 10372 passed over files naming keywrap, changelog.d, CONNECTIONS.md, CLOUD-DEPLOYMENT, secret.example or "from None". Full suite stopped after an hour with no output; not run.
Open findings: SOAP converts "" to None so it never shows the note, and the changelog names SOAP with a closed site list; the "re-wrap" remedy also needs the setting changed; WSL /mnt paths not private; confusing "a key that has none" wording; _REENCODE branch gets no note; two booleans for a three-way state; signing.py, direct.py and database.py still say "Set X" for an empty setting; PKCS#12 rationale self-contradicting; success path leaves an empty secrets/ directory; zsh and failure-cleanup notes partial.
Manager d6318533 opened this for a subagent Builder. The Lander merges. Open findings are named here for filing under ledger ruling R2; any that changes behaviour or weakens a control is marked OWNER-ROUTE CANDIDATE for the Lander to classify.