Sync Helm chart tag / appVersion / package.json with VERSION — PR #177 Blocker 2 - #180
Sync Helm chart tag / appVersion / package.json with VERSION — PR #177 Blocker 2#180jgruberf5 wants to merge 9 commits into
Conversation
…th VERSION PR #177 review (bonnyr-f5) — BLOCKER 2. helm/bnk-forge/values.yaml pinned image.tag: "3.0.1" and Chart.yaml appVersion: "3.0.1", and every per-service tag is "" (falls back to the global 3.0.1). The release publishes only :${VERSION} and :latest, so :3.0.1 -- which was never published on this registry -- means ImagePullBackOff across all seven services. frontend-v2/package.json had likewise drifted to 2.12.0. The release job bumped only VERSION/dist/VERSION/ CHANGELOG, so every other version-bearing artifact drifted silently. - New scripts/sync-version-artifacts.sh with --write <v> (sets the global Helm image tag, Chart appVersion, and frontend package.json) and --check (asserts all three equal VERSION, exits 1 otherwise). Anchored seds hit only the global 2-space image tag -- postgres/redis and the "" per-service tags are untouched. - The release job (both the automated and manual paths) now runs --write after bumping VERSION and stages the three files, so a 4.0.0 release updates the chart to 4.0.0 instead of leaving it on 3.0.1. - New CI job "P1 · Version Consistency" runs --check and is wired into the CI gate, so this drift can't reappear silently -- mirroring the existing image-level VERSION assertion, but at source level on every PR. - Fixed the current drift: all three now read 3.1.6 (= VERSION), and 3.1.6 images do exist. Note: this makes frontend-v2/package.json track the product VERSION, as the review requested. If the frontend is meant to version independently, that's the one line to drop from the assertion. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
mwiget
left a comment
There was a problem hiding this comment.
Approving. All 26 checks completed green including the new P1 · Version Consistency and the CI Gate, on the same head (18bd737c) I reviewed.
I extracted the branch and exercised the script rather than reading it:
--checkpasses as shipped (all three read3.1.6, matchingVERSION).--write 4.0.0touches only the one global 2-spacetag:.postgres: 16-alpine,redis: 7-alpineand all six per-servicetag: ""are untouched -- I diffedvalues.yamlbefore/after to confirm, and there is exactly one^ tag:line in the file today, so the unaddressedsedhas one target.frontend-v2/package.jsonstays valid JSON afterwards (json.loadclean).--checkthen fails all three with the actionable::error::and exit 1.
Gate wiring is right -- version-consistency is in both the needs: list and the result loop, and the loop treats success/skipped as pass while failing on failure/cancelled. actions/checkout@v6 matches the 24 other jobs.
On your judgment call about frontend-v2/package.json tracking the product VERSION: I'd keep it. Nothing reads that field -- the package is "private": true, never published, and the build takes its version from the baked /app/VERSION -- so tracking costs nothing and one drifting artifact is what produced the 2.12.0 you just fixed.
Two notes, neither worth holding this up:
Chart.yaml's ownversion: 0.1.0isn't synced, which I think is correct: Helm treats chart version andappVersionas independent, andrelease.ymldoesn't package or push the chart, so a static chart version publishes nothing wrong. Worth a line in the script header saying that's deliberate, so the next person doesn't "fix" it.--checkreads the first match (grep -m1) while--writerewrites every matching line (unaddressedsed). Harmless today with one match each, but the asymmetry means a second^ tag:line would be silently rewritten and never verified.sed -E '0,/^ tag: /s|...|'would make them agree.
This also conflicts with #182 -- both insert into the same needs: list and gate loop in ci.yml. Whichever lands second needs a trivial rebase.
…ic chart PR #177 nit (bonnyr-f5): helm/bnk-forge/values.yaml shipped `mcpPassword: changeme` -- a known default password now that the chart is the public distribution path. The other four secrets (postgres/redis/jwt/encryption) are generated with randAlphaNum when left empty and reused across upgrades via the existing-secret lookup, but mcp-password had no such generation and used the raw value directly. Added the same lookup-then-randAlphaNum(24) logic for mcp-password and blanked the default in values.yaml, with a comment on how to retrieve the generated value (kubectl get secret ... | base64 -d). `helm template` confirms a random mcp-password is rendered, not "changeme". Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
|
Honoring a nit from the #177 umbrella review that belongs here (helm values): The other four secrets (postgres/redis/jwt/encryption) generate with |
mwiget
left a comment
There was a problem hiding this comment.
New commit here since my approval, so re-reviewed at 64a37f98. The changeme fix is correct and I verified it with helm template -- holding the approval only because two unit-test jobs are still running. One small thing about the values file below, which you can fold in while they finish.
Rendered against the branch:
# fresh install, two consecutive renders
mcp-password: "nIzLvrlXzaKQ65lnFe13W0js"
mcp-password: "yMQNMjCtpJZTfNEESsfQXtW8"
# --set secrets.mcpPassword=my-explicit-pass
mcp-password: "my-explicit-pass"
# same chart on staging today
mcp-password: "changeme"
The upgrade path is right too: an existing install has changeme in its secret, .Values.secrets.mcpPassword is now empty, so the $existing branch reads the current value back and nothing rotates under a running deployment. Fresh installs get a random one. mcp.yaml:52 consumes it via secretKeyRef, and nothing anywhere reads .Values.secrets.mcpPassword directly, so there's no second consumer to break. The block is character-for-character the same shape as the four secrets above it.
Worth saying to whoever operates an existing install: this protects new installs only. Anyone already on changeme keeps changeme -- correct behaviour for an upgrade, but it means the known default is still live wherever it was accepted, and that wants an explicit rotation rather than an implicit one.
| mcpPassword: changeme | ||
| # Empty -> generated on first install and reused on upgrade, like the secrets | ||
| # above. Never ship a known default in the public chart (#177 review). Retrieve | ||
| # it with: kubectl get secret <release>-secrets -o jsonpath='{.data.mcp-password}' | base64 -d |
There was a problem hiding this comment.
The key itself is gone, not set empty -- so helm show values no longer lists secrets.mcpPassword at all, while the four generated secrets right above it are all declared as "". For a public chart that's the discovery surface: an operator who wants to pin the password now has to read the comment (or the template) to learn the value exists. --set secrets.mcpPassword=... still works, so this is interface, not behaviour.
The comment also reads as though it describes mcpUsername, since that's the last key before it.
mcpUsername: admin
# Empty -> generated on first install and reused on upgrade, like the secrets
# above. Never ship a known default in the public chart (#177 review). Retrieve
# it with: kubectl get secret <release>-secrets -o jsonpath='{.data.mcp-password}' | base64 -d
mcpPassword: ""Same rendered result -- I checked, "" and an absent key both take the generate branch -- and the chart's public interface stays complete and self-consistent.
mwiget
left a comment
There was a problem hiding this comment.
Approving at 64a37f98. All 26 checks completed green, including P1 · Version Consistency and the CI Gate.
Everything from my earlier approval still holds -- I re-ran nothing there because the version-sync commit is unchanged -- and the new mcpPassword commit I verified separately with helm template: fresh installs get a distinct random value each render, --set secrets.mcpPassword= is honoured, the same chart on staging still renders changeme, and an existing install reads its current value back through the $existing branch so nothing rotates under a running deployment.
The one thing I'd still change is the values.yaml key -- mcpPassword: "" rather than dropping the key -- so helm show values keeps listing it alongside the four secrets above and the comment doesn't read as though it belongs to mcpUsername. Rendered behaviour is identical either way, so it's not worth another round trip; fold it in whenever you next touch the chart, or leave it.
Two things worth carrying forward rather than fixing here:
- Existing installs keep
changeme. Correct for an upgrade, but the known default stays live wherever it was already accepted, so that wants an explicit rotation somewhere in the release notes rather than an implicit one. - This conflicts with #182 in
ci.yml-- sameneeds:list and gate loop. Both are approved now, so whichever merges second needs a trivial rebase.
Review: BLOCKReviewed under the review-discipline pipeline (invariant sweep + context-isolated cold audit at Blocker — generating
|
…#188) bonnyrf5 aggregate review, #180. --write fails open (scripts/sync-version-artifacts.sh): a sed whose pattern matched nothing no-ops silently, so a format change to any artifact left it unchanged while the script still reported success -- and the release job commits that [skip ci]. Now re-reads all three with the same helpers --check trusts and exits 1 if any didn't take ${V}. Verified: happy path passes, a package.json whose "version" line no longer matches makes it exit 1. MCP secret (secrets.yaml / values.yaml): this PR generated mcp-password as a chart-owned secret with mcpUsername: admin, which breaks MCP auth on every fresh install -- it's a client credential the MCP server must also read, not a chart-owned value. That's the half-fix bonnyrf5 flagged. The complete fix (point the chart at the mcp service account, wire MCP_SERVICE_PASSWORD into the backend so ensure_service_user reconciles the hash, rotate the shipped default on upgrade, checksum/secret roll) lives in #188. Reverted the MCP edits here so this PR stays scoped to version-artifact consistency; its MCP diff vs staging is now empty, so it no longer overlaps #188. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
mwiget
left a comment
There was a problem hiding this comment.
Re-approving at 64877058. Both changes verified by execution, not by reading.
--write now fails closed. I ran the old and new scripts against the same artificially-broken tree — package.json's "version" re-indented to 4 spaces, i.e. exactly the "format changed, sed matches nothing" case:
# OLD (64a37f98, the head I approved)
$ scripts/sync-version-artifacts.sh --write 7.7.7
synced helm tag, appVersion, frontend package.json -> 7.7.7
rc=0
$ grep version frontend-v2/package.json
"version": "9.9.9", ← never written, and the caller commits this [skip ci]
# NEW (64877058)
$ scripts/sync-version-artifacts.sh --write 8.8.8
::error::--write did not take on frontend package.json: it is '', expected '8.8.8' …
rc=1
That is the failure mode worth closing: the release job commits the "synced" tree with [skip ci], so nothing downstream ever re-checks it and the chart ships pointing at an unpublished tag. Reusing _helm_tag / _appversion / _pkg_version — the same readers --check trusts — is the detail that makes it airtight: a format change that breaks the writer also breaks the reader, so the guard fires either way rather than depending on the two staying in agreement. Happy path still passes (--write 9.9.9 → --check reports all three).
MCP secret backed out cleanly. git diff origin/staging 64877058 -- helm/ now shows only Chart.yaml (the version/appVersion sync this PR is actually for) — secrets.yaml and values.yaml are byte-identical to staging again. So this no longer half-fixes #187, and whichever order this and #188 merge in, #188's generate-and-rotate block survives untouched. That's the right call: a shipped changeme that #188 rotates is strictly better than two PRs owning the same block.
mwiget
left a comment
There was a problem hiding this comment.
Correcting my approval two comments up — I approved on my own verification without checking that CI had run, and it hasn't: this head has zero checks, because the commit message contains [skip ci].
$ gh api "…/actions/runs?head_sha=64877058…" --jq .total_count
0
$ gh api "…/commits/64877058…/check-runs" --jq .total_count
0
$ gh run list --branch fix/version-artifact-consistency
CI completed success 64a37f98 ← the head I approved earlier
CI completed success 18bd737c
← nothing for 64877058
The cause is line 8 of the commit body:
unchanged while the script still reported success -- and the release job commits
that [skip ci]. Now re-reads all three with the same helpers …
That's prose describing the release job, but GitHub scans the whole commit message, not just the subject, so it suppressed the run. I checked the other six heads in flight (8415ce19, d45dc87b, ff93ab39, b9a6f243, 241c768e, e67dd317) — none contain the marker, and all of them got their runs. This PR is the only one affected.
It matters more than usual here: the change being shipped is a shell script, so the gates that would have covered it — P1 · ShellCheck, P1 · Script Self-Tests, and (via #182) P1 · Secret Scan — are exactly the ones that didn't run. My local verification stands, but it isn't a substitute for the gate.
To clear it: amend the message so the string can't match (backticks don't help — [skip ci] split, "skip-ci", or just "…commits that with CI suppressed" all work) and force-push. An empty follow-up commit would also produce a run, but leaves the marker in history where the next person greps for it.
Two smaller notes while it's open:
- Worth a line in
AGENTS.md/ the commit conventions: never write the literal[skip ci]in a message body, even when quoting. This is the second time a CI-control string in prose has had a real effect in this repo. - The
[skip ci]the release job legitimately emits is unaffected — that one is deliberate and lands on the subject line, where #181's loop guard reads it.
Everything I verified in my previous comment is still accurate; I'm re-requesting only on the missing CI. Happy to approve the moment a run lands green on this content.
|
Heads-up on merge order: #182 has been rebased onto this branch to resolve the ci.yml conflict between them (both add P1 jobs after |
…#188) bonnyrf5 aggregate review, #180. --write fails open (scripts/sync-version-artifacts.sh): a sed whose pattern matched nothing no-ops silently, so a format change to any artifact left it unchanged while the script still reported success -- and the release job commits that with CI suppressed. Now re-reads all three with the same helpers --check trusts and exits 1 if any didn't take ${V}. Verified: happy path passes, a package.json whose "version" line no longer matches makes it exit 1. MCP secret (secrets.yaml / values.yaml): this PR generated mcp-password as a chart-owned secret with mcpUsername: admin, which breaks MCP auth on every fresh install -- it's a client credential the MCP server must also read, not a chart-owned value. That's the half-fix bonnyrf5 flagged. The complete fix (point the chart at the mcp service account, wire MCP_SERVICE_PASSWORD into the backend so ensure_service_user reconciles the hash, rotate the shipped default on upgrade, checksum/secret roll) lives in #188. Reverted the MCP edits here so this PR stays scoped to version-artifact consistency; its MCP diff vs staging is now empty, so it no longer overlaps #188. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
mwiget's note on #180: a commit whose body quoted the CI-skip marker in prose had its whole run suppressed (GitHub scans the entire message), and because the change was a shell script the skipped gates were exactly the relevant ones. Documented the rule and the indirect phrasings so it does not recur. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
6487705 to
99a286f
Compare
|
Good catch, and thank you for un-approving on it — that was my mistake. The commit body quoted the CI-skip marker in prose ("...the release job commits that Fixed: amended the message so the string can no longer match (now reads "...commits that with CI suppressed...") and force-pushed — the marker is gone from the whole message, and a fresh run is triggering on this content now. I did not leave it in history via an empty follow-up. Also added your suggested guardrail: a Commit conventions section in |
mwiget nit on #180: a line in the sync-version-artifacts.sh header saying the chart's own `version:` is intentionally left out of the sync (Helm treats chart version and appVersion independently, and release.yml doesn't package/push the chart) so the next person doesn't 'fix' it to match VERSION. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
|
Swept your remaining nit: added a header line to |
mwiget
left a comment
There was a problem hiding this comment.
Clearing my block — the [skip ci] is gone, CI ran, and the fix went further than I asked.
2b01fb4 reworded the line to "…the release job commits that with CI suppressed". I checked it's a message-only change rather than a rewrite: git diff 64877058 2b01fb4 is empty, so the tree is byte-identical to the content I verified before. The gates that were being skipped have now actually run on this head.
99a286fc is the part I didn't ask for and is worth more than the fix itself — an AGENTS.md "Commit conventions" section stating the trap outright, with the detail that makes it stick: GitHub scans the whole message, not the subject, and the run it suppressed here took out ShellCheck, Script Self-Tests and Secret Scan on a shell-script change. Naming the workarounds (refer to it indirectly, split across backticks) and carving out the release job's deliberate subject-line skip means the next person hits a rule instead of the bug.
My verification of the substance stands from the earlier pass: --write now fails closed, proven old-vs-new against a package.json whose "version" line no longer matches the sed — old reported synced … -> 7.7.7 at exit 0 while the file still said 9.9.9; new exits 1 naming the artifact. And the MCP secret revert is clean, so #188 owns that block alone.
5d25b31e closes the last nit from my first pass on this PR — the header now records that Chart.yaml's own version: is deliberately outside the sync. I confirmed the reasoning is sound rather than just plausible: release.yml contains no helm package or helm push (the only "chart" mentions in it are comments about this very sync), so a static chart version publishes nothing wrong, and the chart currently sits at version: 0.1.0 / appVersion: "3.1.6" — independent, exactly as described. That comment is what stops the next person from "fixing" the one field that must not move.
Approving at 5d25b31e: 26 checks, 0 pending, 0 failed — against zero checks on the head I blocked. That contrast is the whole point of the block, so it's worth stating plainly: the gates now exist and they pass.
Review: REVISEReviewed under the review-discipline pipeline at Verified correctThe core fix is real and confirmed against the live registry: before this PR the chart pinned Gate integrity came back clean, checked by YAML parse rather than hunk-reading: Major — the same ImagePullBackOff bug is still live in the sibling chart
This is the fix-the-class point: the sweep needs to enumerate all charts, plus Major —
|
bonnyr-f5 REVISE review of #180. All findings reproduced and confirmed. MAJOR — the bnk-operator chart pinned f5/bnk-operator:1.2.0, a 404 (the release publishes ghcr.io/f5devcentral/bnk-forge-operator). Fixed the repository + tag to a real published image. Narrowed the script header's "every version-bearing artifact" claim to what it actually syncs (the bnk-forge chart + frontend); the operator chart carries its own version line and isn't swept here. MAJOR — --write's fail-closed guarantee had a hole: sed rewrites EVERY 2-space `^ tag:` line but the verify helper read only grep -m1 (the first), so a second tag line could be clobbered while --check stayed green. Now verifies every 2-space tag line equals ${V}. MAJOR — `sed -i -E` isn't BSD-portable (BSD swallows -E as the -i suffix and litters *-E files); --check's error message tells developers to run exactly that command. Switched to the attached-suffix form both seds accept, removing the backups. Verified: --write leaves no stray files, --check passes. Acknowledged (documented): CRLF self-contradiction, --write input validation, package-lock cosmetic drift, and the missing --self-test/CI job (follow-up). Merge #180 as a MERGE COMMIT (not squash) so #182's shared prefix stays intact. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
|
@bonnyr-f5 — all findings reproduced and valid. Fixed in
Acknowledged: CRLF message, |
Review: REVISERound 2, cold re-audit of Round 1's fixes hold up where I could falsify them: Three things still stand. Major 1 — this PR pins the sibling operator chart to VERSION, and nothing syncs it
Neither Class fix: either add the operator chart to both modes, or revert it to a tag that isn't derived from Major 2 —
|
… non-vacuity bonnyr-f5 round-2 REVISE of #180. All reproduced. MAJOR 1 — round 1 pinned the operator chart to 3.1.6 but left it OUTSIDE the syncer, so at 3.1.7 it would pin 3.1.6 again — the ImagePullBackOff class this PR exists to close, reintroduced. The operator image publishes at :${VERSION}, so the chart belongs on the VERSION train: added its values.yaml image.tag and Chart appVersion to both --write and --check. Header comment now matches the code. MAJOR 2 — --check read only the first `^ tag:` (grep -m1), blind to a drifted second tag that --write would clobber. --check now verifies EVERY 2-space tag across both values.yaml files, not just the first. MAJOR 3 (INV-16) — the gate could pass vacuously (an empty comparison list exits 0 with drift present). --check now counts what it compared and fails if it checked fewer than the expected artifacts. Verified: --write syncs all five artifacts + the operator chart, --check reports all five OK, shellcheck clean. Acknowledged: CRLF, --write input validation, package-lock (minors); --self-test + gated CI job (follow-up). Merge #180 as a MERGE COMMIT so #182's prefix is intact. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
|
@bonnyr-f5 round 2 — all three majors reproduced and fixed in |
…ts skipped bonnyr-f5 round-2 REVISE of #182. Both majors reproduced and fixed. MAJOR 1 — gitleaks --no-git scanned the worktree, missing a secret added then REMOVED within the branch (permanently fetchable from a public clone). Verified: --no-git says "no leaks" on such history; git mode + --log-opts catches it. Now checks out fetch-depth: 0 and scans the PR/push COMMIT RANGE in git mode (pull_request base..head; push before..sha; first push -> all history). MAJOR 2 — cancel-in-progress: false does not stop GitHub cancelling a PENDING run in the same per-ref group, so a docs-only push could still starve a release's CI run. On main/staging the concurrency group now includes the SHA, so every push gets its own group and nothing cancels; feature branches keep the per-ref group. MINOR — the CI Gate accepted `skipped` for the four always()-run gates, so a future path-filter would go green with the check never run. Skipped is now a failure for version-consistency / shellcheck / secret-scan / script-selftests. MINOR — the self-test gate asserted >=1 PASS but not completion; an early exit after case 1 would pass. Now also requires the END-SELF-TEST marker (branch- independent; catches the #179 early-exit shape). MINOR — make shellcheck: `xargs shellcheck` on an empty list exits 0 on BSD. Now fails on an empty list and includes the (extensionless) .githooks; full corpus clean. Acknowledged: the generic-api-key rule's test-dir allowlist (same fixture tension as private-key; content-scoping is a follow-up); the release.yml paths-ignore comment lives in #181 and is handled there. Merge #180 first (merge commit). Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
Review: BLOCKRound 3, cold re-audit of Round 2's items that are genuinely fixed, verified rather than assumed: Two things block, and both are in code this PR added. BLOCKER 1 —
|
…empty data bonnyr-f5 round-3 BLOCK on #180. Both blockers reproduced and fixed, each with a red-green test that proves the guard now fails on the exact input it missed. BLOCKER 1 — writer/stager divergence. --write rewrote five artifacts (incl. the two operator-chart files this round added) but release.yml's "Commit and tag" step hard-coded `git add` for three, so the operator chart was rewritten on the runner and never staged -> next PR's version-consistency job red-lined, blocking every subsequent release. Fixed structurally: the script owns a canonical SYNCED_FILES list exposed via a new --list mode, and both "Commit and tag" steps stage exactly `sync-version-artifacts.sh --list` -> writer and stager cannot diverge. Added an INDEX check (git diff --quiet per file) so a synced-but-unstaged artifact fails the release rather than the next PR (bonnyr: "verify the index, not the files"). Verified: all five stage; unstaging one is caught. BLOCKER 2 — --check green on a tree with no version data. The non-vacuity guard counted loop iterations over a literal 5-item list, so `checked>=5` was always true and its guard unreachable; empty compared equal to empty five times, rc 0. Rewritten to assert each version line is NON-EMPTY and equals VERSION, that VERSION itself is non-empty, and that every artifact contributed >=1 MATCHED line (total counts matched lines, not iterations). Verified against bonnyr's exact repro (empty VERSION + every key deleted) -> now rc 1. Majors (same review): - Every reader now reads EVERY matching line (was grep -m1 first-match against a global write), so a second appVersion/tag can't drift unseen. Verified: a drifted second 2-space tag is caught. - The image-tag writer is bounded to the top-level `image:` block via a sed range instead of a bare `^ tag:`; a future unrelated 2-space tag is left alone. Verified. appVersion/version writes are already key-anchored (single-occurrence top-level keys). Docs: header, the "Synced" list and the success echo now name all five artifacts (they claimed three while five were written, and one line still said the operator chart was not synced while the code synced it). Confirmed: operator image IS on the release train (docker-bake.hcl `default` group builds it), so syncing its chart to VERSION is correct. shellcheck -S style clean; real-tree --check green; full red-green matrix in the PR comment. Merge-order note for the record: merge #180 before #182, or with a merge commit — #182 carries a pre-round-2 copy of this script, and a squash would arrive as an add/add conflict on it. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
|
@bonnyr-f5 round 3 — both blockers reproduced and fixed in BLOCKER 1 — writer/stager divergence (staged 3 of 5)Fixed structurally, not by patching the list: the script owns a canonical file set exposed via a new BLOCKER 2 — --check green on an empty treeThe guard counted loop iterations over a literal 5-item list, so Majors (fixed)
DocsHeader, the Your nit — is the operator image actually on the release train?Yes: Merge orderAcknowledged — I'll merge #180 before #182 (or with a merge commit); #182 carries a pre-round-2 copy of this script and a squash would arrive as an add/add conflict. Verified: |
Addresses every non-blocker bonnyr-f5 raised in round 3. Archives (Major): gitleaks defaulted to --max-archive-depth 0, so a secret shipped inside a tracked tarball was invisible. The scan now runs with --max-archive-depth 2. Proven with a synthetic fixture: a private key inside a .tar.gz -> "no leaks found" at depth 0, "leaks found: 1" (secrets.tar.gz!id_rsa) at depth 2. Baseline (Major): the per-push gate only scanned each change's commit range, so anything already in history was never re-examined. Added secret-baseline.yml -- a weekly schedule plus workflow_dispatch that runs gitleaks over full history with the same assertion backstop. CI Gate (Major): the aggregator never checked needs.changes.result. If change detection failed, ~21 gates resolved to skipped, the loop accepted skipped, and the required check printed PASSED. It now fails when changes did not succeed. Mutation-tested: with change detection failed and test jobs skipped, the old gate went green, the new gate goes red. Local == CI (Major, #166): the four gates ci.yml added were unrunnable locally. Added make targets (version-check, secret-scan, commit-lint, script-selftests) aggregated as ci-gates, and made pre-push depend on it. The secret scan + its whole assertion backstop now live in scripts/secret-scan.sh, called identically by the CI job, the baseline workflow, and make -- one source of truth. Marker enforcement (Minor -> real): the skip-CI-marker rule was documentation only. Added scripts/lint-commit-markers.sh plus a commit-lint CI gate and a pre-push hook step that fail a range carrying a skip-CI marker, or a line-start prose form that would spuriously trigger a major release. A genuine conventional footer still passes. Mutation-tested across eight cases; passes on this PR's 13-commit range. Digest pin (Nit): the movable v8.30.1 tag is replaced by ghcr.io/gitleaks/gitleaks@sha256:c00b6bd0... (v8.30.1 kept in a comment). release.yml stale comments (Major): the ":23-26" note referenced a ci.yml paths-ignore that no longer exists, and the ":150-157" note claimed cancel-in-progress: true for main/staging where it is now false. Comment text corrected to match reality; no release logic touched (that is #181's domain). Cross-PR items are intentionally left to merge order: the sync-version-artifacts second-tag reproduction is fixed in #180's head, and compute_version_bump's exit-0-on-fail in #179's head. Merge #180 first, merge-commit not squash. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
Review: PASSRound 4, cold re-audit of No blocker, no major. The guards this PR adds are non-vacuous and fail-closed, proven by
Nits (non-blocking):
Cross-PR (for the integration owner, not a defect in this PR): #180 and #182 both add Review Assessment
Findings & Action Items
|
|
Thanks very much, @bonnyr-f5 — appreciate the thorough four-round cold audit on this one. The write/stage single-source-of-truth ( Noted and will honor: merge #180 before #182 (or with a merge commit), since #182 carries a pre-round-2 copy of |
Review: REVISERound 5, cold re-audit of First, a correction to round 4. Round 4 audited this same SHA — Merges standalone: yes. F1 · Major — the
|
|
Cross-PR merge-order constraints for this series are now tracked in #192. Relevant here: this PR owns |
…staging vacuity gap Round-5 review (bonnyr-f5 #180). F1 (Major) — writer/checker asymmetry on the image tag. The --write sed scopes its tag substitution to the top-level image: block (/^image:/,/^[^[:space:]]/), but both readers (--check and --write's post-write verify) grepped `^ tag:` file-global. The two site sets could diverge: a column-0 comment closing the block early gave a GREEN --check while the next --write HARD-FAILED the release; a stray 2-space tag: under another key gave a RED --check on a line --write can never fix. Fixed by lifting the range into one shared IMG_RANGE expression used by the writer's sed AND both readers (via a new _version_lines helper), so the tag reader sees exactly the site set the writer touches. Now symmetric: - col0-comment shape: BOTH fail (check vacuous-red, write no-op-red) - stray-tag shape: BOTH ignore the out-of-block tag (check green, write green) - drifted image tag: BOTH catch it (check red -> write fixes -> check green) F2 (Minor) — release.yml "not fully staged" guard is tautological (git diff after git add is always clean) and had no vacuity floor, so an empty --list would silently commit a bare VERSION bump with every image pin unsynced (BLOCKER-1 class). Added a `staged >= 5` floor to both Commit-and-tag steps, mirroring the script's own `total < 5` guard. F3 (Minor) — the CI version-consistency gate was unreachable from `make pre-push`, which ci.yml promises is CI-equivalent. Added a `version-check` target and pulled it into `quick-check` (a pre-push prerequisite). F4 (Minor) — the header's "the one place that writes them" over-claimed. Narrowed it: this owns the five release-train image-pin artifacts, NOT frontend-v2/ package-lock.json's root version (npm-owned, desyncs harmlessly) nor the dist/ doc copies (PR #183). Nits: validate the --write arg against [A-Za-z0-9._+-] (fail fast instead of corrupting sed); gitignore *.syncbak; correct the AGENTS.md claim that the release loop reads the skip marker on the subject line (its grep is line-oriented over the whole message). F1-b (cross-PR, documented not fixed): #182 carries this PR's first four commits (the pre-INV-19 66-line script); with squash enabled, squash-merging #180 first conflicts. Belongs to #182's merge order — land #180 first and rebase #182, or merge both as merge-commits. Left for #182. Reproduced red, fixed, mutation-tested green; shellcheck -S style clean; --check green on the real tree. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
|
@bonnyr-f5 Round-5 addressed in F1 (Major) — writer/checker asymmetry on the image tag — FIXEDRoot cause exactly as you diagnosed: the Reproduced (pre-fix), then re-run post-fix — symmetric on both shapes: Shape A — column-0 comment inside the Before: green check while the release dies. After: BOTH fail — the broken format is flagged consistently. Shape B — stray 2-space Before: red on a line Mutation-test — the image tag itself is still checked by both: drift the in-block tag to
F2 (Minor / INV-16) — tautological staging guard + no vacuity floor — FIXEDConfirmed the F3 (Minor) — gate unreachable from
|
…test parity Round-5 review (bonnyr-f5 #182). Three isolable fixes; cross-PR items left to merge-order per the review. BLOCKER-1 -- commit-lint rejected the current tip of staging (a GitHub-composed squash commit whose machine-authored body carries a line-start bump declaration). On a push to staging/main the range is before..tip, so that already-merged tip was scanned, the ci-gate went red, and release.yml refused to release the SHA -- the pipeline stopped releasing. Adds a second machine-identity exemption (committer "GitHub <noreply@github.com>", single parent) mirroring the existing release-bot exemption, so the gate never judges already-merged, machine-composed history. Human commits never carry that committer identity and are still fully linted in their own PR. Reproduced (before..tip scan rc=1 -> rc=0) and mutation-tested: human marker in a PR commit still fails; the squash tip is exempt. Major-3 -- make script-selftests mirrored only 2 of ci.yml's 4 anti-vacuity assertions. Adds the missing two (no PASS line -> silenced/renamed guard; missing END marker -> early exit / deleted marker). Mutation-tested all three harness-break modes: each is now make-RED, matching CI. Minor -- .githooks/pre-push scanned the script default (upstream..HEAD) and so missed non-tip commits on a first push. Now derives the exact pushed range from git's pre-push stdin protocol (remote..local), falling back to the default for a brand-new branch or a manual run. Tested all stdin cases. Cross-PR (documented, not forced): sibling #181's own commits carry markers -- caught in #181's PR; once squash-merged the new exemption stops the gate re-scanning them (Major-1). The duplicate scripts/sync-version-artifacts.sh and its sed -i -E are #180's file under merge-order, not duplicated here (Major-2). Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
Keep #182's CI-hygiene jobs (shellcheck, gitleaks secret scan, and the commit-lint gate that runs scripts/lint-commit-markers.sh) and #180's round-3+ scripts/sync-version-artifacts.sh (unchanged, newer than #182's copy). Resolve two comment conflicts present-tense for the merged tree: - release.yml: ci.yml no longer carries a push paths-ignore, so it runs CI on every push to main/staging — a strict superset of the pushes that reach Release, guaranteeing the preflight SHA poll finds a matching CI run. - AGENTS.md: the CI-control-marker rule is now enforced (commit-lint gate + pre-push hook), and the release loop guard reads the deliberate skip marker on the subject line; kept #182's BREAKING-CHANGE-footer bullet.
Consolidated landing of seven interdependent PRs whose shared credential and release/CI surfaces prevented merging in any order (see issue #192's conflict matrix). Merged in dependency order 179, 180, 181, 188, 186, 183, 182; the #186/#188 credential surface was reconciled once (single reserved-name guard; provenance + migrations + stale-disable combined with rotation + backend MCP wiring + threadpool). Squashed to one commit; per-PR history retained on the seven archived branches. Validated on the merged tree: ruff + mypy clean; 172 auth/credential/startup/ migration tests pass; single alembic head v2_155; openapi + frontend types fresh; helm lint/template and docker compose config green on all modes; version and detector self-tests green; commit-message lint clean. Closes #192. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4
|
Superseded by the consolidated integration PR #193 (branch Closing unmerged, not abandoning: the branch is retained and all review history stays on this page for reference. See #193 for the integrated, validated result and #192 for the cross-PR conflict analysis. |
) * Integrate the #177 follow-up stack (#179 #180 #181 #182 #183 #186 #188) Consolidated landing of seven interdependent PRs whose shared credential and release/CI surfaces prevented merging in any order (see issue #192's conflict matrix). Merged in dependency order 179, 180, 181, 188, 186, 183, 182; the #186/#188 credential surface was reconciled once (single reserved-name guard; provenance + migrations + stale-disable combined with rotation + backend MCP wiring + threadpool). Squashed to one commit; per-PR history retained on the seven archived branches. Validated on the merged tree: ruff + mypy clean; 172 auth/credential/startup/ migration tests pass; single alembic head v2_155; openapi + frontend types fresh; helm lint/template and docker compose config green on all modes; version and detector self-tests green; commit-message lint clean. Closes #192. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193): reconcile the merged unset-MCP-password model and harden the credential seed Addresses mwiget's three CHANGES_REQUESTED blockers on the #177 integration PR (#193), plus follow-up findings from a max-effort review of the same credential surface. The merge chose #188's "unset MCP_SERVICE_PASSWORD -> disable" over #186's "unset -> generate", so the generate/rotate-on-unset code was left unreachable but still documented, and the release-notes footer was missing. BLOCKING 2 (core/config.py): the MCP_SERVICE_PASSWORD comment claimed ensure_service_user "generates a random secret and surfaces it once" when unset, contradicting the merged behaviour. Rewrote it to state the truth: when unset (or a known default) seed_auth_step calls disable_stale_service_user, leaving the mcp account disabled/unavailable until an operator configures a real password; a published default is refused and rotated out; the backend receives MCP_SERVICE_PASSWORD on every deploy mode and reconciles to it when set. Also removed the duplicate #186 block that sat above the wrong field. BLOCKING 3 (services/auth_service.py): removed the unreachable usable_password is None branches from ensure_service_user (the generate-on-create and rotate-on-unset paths). seed_auth_step only calls it under the _mcp_pw_usable gate, so password is never None/default in production. ensure_service_user now requires a usable password and only creates/reconciles with it (failing closed and loudly if handed an unusable one); the unset case is owned entirely by disable_stale_service_user. Dropped the now-dead _log_generated_service_password helper and the service-account token_urlsafe/_persist_generated_password calls (_persist_generated_password is still used by the admin seed). Kept the reserved-name guard, the provenance check, the adopt-a-published-default remediation, and disable_stale_service_user fully intact. Updated the affected unit tests (published-default/None now refused; added a reachable adopt-and-reconcile test; stale-row setup builds the legacy row directly) and fixed scripts/mcp_live_smoke.py, which pointed operators at /app/keys/initial_mcp_password, a file no reachable path writes. CR-1 (services/auth_service.py, seed_admin_user): fixed a concurrent-first-boot admin lockout. With DEFAULT_ADMIN_PASSWORD unset and 2+ api replicas, both generated different passwords and the loser overwrote the keys file while its INSERT rolled back, so the file and the committed row disagreed. The fresh seed now creates+flushes first (the loser's INSERT raises IntegrityError -> rollback, no file write) and persists the keys file only after winning but before commit, so the file can only ever hold the committed row's password. Added a losing-replica test. CR-5 (services/auth_service.py, _persist_generated_password): os.open's 0600 mode only applies on create, so a pre-existing 0644 file was truncated in place and kept 0644, writing the secret world-readable. Added os.fchmod(fd, 0o600) and a test that a pre-existing 0644 file is tightened to 0600. CR-2 (routes/k8s_websocket.py, dpus_websocket.py, benchmarks.py): the WS auth validators called the blocking sync token_user_state directly on the event loop. Moved it off the loop via run_in_threadpool, matching core/auth_middleware.py. Validation: make lint-backend clean; mypy core/ schemas/ unchanged; auth (57) + ws/benchmark/startup (79) suites pass; alembic heads single v2_155; helm lint/template OK and --set secrets.mcpPassword=changeme fails the render; docker compose config OK on all modes; extract-breaking-changes and compute_version_bump self-tests pass; lint-commit-markers clean. BREAKING CHANGE: MCP_SERVICE_PASSWORD is now required — the backend SystemExits under ENVIRONMENT=staging|production when it is unset or a known default; the shipped admin/changeme default is removed and rotated out on upgrade; the dist bundle renames MCP_USERNAME/MCP_PASSWORD to MCP_SERVICE_USERNAME/MCP_SERVICE_PASSWORD; and the Helm chart ships mcpUsername=mcp with a generated mcpPassword instead of admin/changeme. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193): close bonnyr-f5's credential/backend/helm/dist/docs blockers Follow-up to the #177 integration on pr177-integration, addressing the CREDENTIAL/BACKEND/HELM/DIST/DOCS half of bonnyr-f5's BLOCK on PR #193. B1 (SECURITY): ensure_service_user no longer adopts any human account whose password is a known default. The adoption exception is now scoped to v2_155's exact backfill fingerprint (username=='mcp' AND email=='mcp@bnk-forge.local'), matching the migration's own conservative rule, and must_change_password is no longer cleared on an adopted row. Adds tests proving a human operator/changeme row (and a wrong-email mcp row) is REFUSED, not taken over. B2/B2b: all five compose files (root + dist docker-compose{,.local}.yml and the IBM embedded compose) honor legacy MCP_USERNAME/MCP_PASSWORD as aliases for MCP_SERVICE_USERNAME/MCP_SERVICE_PASSWORD on both backend and mcp env, so an existing customer .env keeps working after upgrade. Docs (dist/README.md, dist/.env.example, user-pack/install-guide.html) document MCP_SERVICE_PASSWORD as canonical with MCP_PASSWORD honored as a legacy alias. B3: ENVIRONMENT is plumbed to the backend in every compose file, so an operator who sets ENVIRONMENT=staging|production actually reaches config.py's MCP fail-fast. Helm already routes ENVIRONMENT=production onto api/worker/beat. M1: the unset-MCP behavior stays "disabled" (#188 over #186); added an explicit deliberate-consolidation comment at the decision point. M2: disable_stale_service_user skips the about-to-be-reconciled row and the "no usable MCP_SERVICE_PASSWORD" warning is conditional on a configured password, so a correctly-configured install no longer logs a false warning or commits an inactive MCP window on every boot. M7: the Helm mcp deployment and the IBM installer's mcp service now run the exec auth-probe healthcheck (python -m bnk_forge_mcp.healthcheck) instead of a bare tcpSocket probe. M8: the chart fails the render for a reserved mcpUsername (admin), mirroring the mcpPassword guard, and NOTES.txt/values.yaml call it out. Minors: deterministic checksum/secret via a shared helper (stable across renders, identical across api/worker/beat/mcp); vestigial _persist_generated_password filename docstring; false "backend generates its own secret" rationale corrected in compose/helpers/ibm; mcp_live_smoke.py #186/#188 attribution; e2e/config.py changeme default note; .env.example :58/:73/:94 fixes; unified BNK_FORGE_VERSION to latest across dist. Validation: ruff clean; typecheck-backend (core/ schemas/) Success 38 files; 199 auth/credential/startup/ws/migration tests pass incl. new B1 tests; helm lint + template stable checksums, --set secrets.mcpUsername=admin and secrets.mcpPassword=changeme both FAIL; docker compose config on all five modes shows the backend receiving MCP_SERVICE_PASSWORD (via either alias) and ENVIRONMENT. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193): close bonnyr-f5 CI/RELEASE/SCRIPTS blockers, majors, and minors Blockers: - B4 registry-tag-probe.sh: replace GNU-only BRE alternation (\|) with portable `sed -nE (access_token|token)` so the token parse works on BSD/ macOS sed; on BSD the empty token classified every image `unknown` and routed the operator into FORCE_LATEST=1, overwriting immutable :VERSION manifests (INV-24). Reproduced under `sed --posix`, fix proven to parse T2. - B5 registry-tag-probe.test.sh had no caller and was red on BSD. Both the Makefile script-selftests target and ci.yml's script-selftests job now enumerate and run every scripts/tests/*.test.sh, failing on an empty enumeration or any non-zero rc. - B6 lint-commit-markers.sh: replace the spoofable committer-identity exemption (GitHub <noreply@github.com> + single parent) with an unspoofable "already reachable from origin/main|origin/staging" check; lint the PR title (PR_TITLE via env) on pull_request events; split the rules so machine/already-merged is exempt for the marker rule but the spurious-major rule always applies. Majors: - M3 release.yml overwrite guard: derive the vacuity floor from an independent source (docker-bake.hcl default group, sourced from the workflow-ref tooling) and assert the probe's exit status before trusting its output, so an unavailable probe fails closed instead of "safe". - M4 (INV-31): generate release notes and run the registry existence-probe BEFORE the irreversible push in release-final/release-manual (new shared scripts/registry-overwrite-guard.sh); release-publish keeps its own in-critical-section re-check. - M5 make script-selftests now runs the INV-15 detector-parity diff (extracted to scripts/tests/detector-parity.test.sh) so local == CI. - M6 extractor self-test runs unconditionally with anti-vacuity assertions (ok lines + END marker), no longer gated on grepping its own --self-test. Minors: stale cross-PR comments in release.yml and extract-breaking-changes.sh; removed the duplicate Makefile version-check target; `git add dist/VERSION` no longer swallows failures; first-ever-release notes range fixed; CHANGELOG insertion asserts a non-no-op before committing; refreshed .trivyignore CVE-2026-7598 review deadline; removed e2e-tests.yml dead `|| true`; documented the new Docker dependency in the pre-push hook. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193 r2): close credential/backend/helm/dist blockers — drop the username alias, make ENVIRONMENT=production satisfiable, and fix the mcp liveness probe bonnyr-f5 round-2 BLOCK, credential/backend/helm/dist/docs half. B-1 (INV-12): the compose files aliased the SERVICE username (MCP_SERVICE_USERNAME:-${MCP_USERNAME:-mcp}); a legacy .env with MCP_USERNAME=admin resolved it to `admin`, and against the guardless image `latest` still points at, the old ensure_service_user rewrites the human admin row to `changeme` every boot. Drop the username alias across all five compose files + the ibm embedded compose (keep the harmless password alias), and default BNK_FORGE_VERSION to 4.0.0 (the release this tree becomes, first image with the guards) instead of `latest`, so a compose file can never hand the new credential contract to a pre-guard image. B-2: ENVIRONMENT=production reaches validate_production, which also gates on JWT_SECRET_KEY / ENCRYPTION_KEY / ALLOWED_ORIGINS — none of which were deliverable from a compose install, so the switch bricked the backend. Plumb all three into every x-backend-env anchor (four compose files + ibm) and document them in the env examples; treat an empty ("" from ${VAR:-}) key as unset in config.py so the plumbed empty default auto-generates rather than passing as a real empty key. _persist_or_load_key now flags only keys WE generated as auto_generated (sidecar .autogen marker), so an operator-provisioned key on the volume validates while a fresh prod boot still fail-fasts permanently. M-4: mcp liveness returned non-zero when the BACKEND was unreachable, so k8s restarted the pod for a dependency outage. Move the auth-probe to readiness only; liveness is tcpSocket. Fix mcp-server/README + mcp_live_smoke hints to name only the vars each process actually reads (container: BNK_FORGE_*, backend: MCP_SERVICE_*). Minors: refuse a known-default DEFAULT_ADMIN_PASSWORD on fresh seed + helm adminPassword fail-guard; guard secrets.yaml mcpUsername nil with kindIs "invalid"; make the Python reserved-name check case-insensitive/trim to match Helm; neutralise the hash when disabling a stale service account; correct the benchmarks.py JWT-gate comment; surface an empty MCP_SERVICE_PASSWORD in install.sh; fix the .env.example "No .env file is needed!" contradiction. Tests: config B-2 satisfiability + provenance-marker tests; seed_auth_step against an admin-still-holds-changeme upgrade DB; case-insensitive reserved-name and disable-hash-neutralisation cases. ruff clean, mypy clean, 4831 unit pass, helm lint/template green, docker compose config verified on all modes. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193): close r2 CI/RELEASE blockers B-3, M-1..M-3 + scripts/release minors B-3 (commit-lint exemptions): key the already-merged exemption on the range BASE (github.event.before), not the post-push tip, so a new skip-CI marker on a push to main/staging is caught while a genuinely-already-merged base commit stays exempt; replace the self-settable `^release: ` subject exemption with release.yml's own version+trailing-skip fingerprint. M-1 (spurious-major rule): redefine rule 2 as the exact complement of the detectors, sourced from the shared predicate, so it flags only a marker the detectors would MISS (never dash-bullet, markdown-bold or indented shapes); give it the same already-merged exemption; and lint inputs.release_notes through the script before it becomes a release commit/tag. M-2 (overwrite guard floor): derive the vacuity floor from `docker buildx bake --print default | jq '.group.default.targets | length'`, scoped to the default group, so a second bake group no longer wedges the release; separate bake-file parse failures from registry-unreachable in the messaging. Single-source the policy: release-publish and make push-images now call the one guard. M-3 (portability): drop bash-4 mapfile from the probe test; rebuild the compute self-test newline expansion with awk to avoid the bash-3.2 parameter-expansion cliff, so make script-selftests runs under stock macOS bash 3.2. Detector single-sourced into scripts/lib/breaking-change-detect.sh (compute, extract, lint all source it); detector-parity test asserts the wiring; added mutation tests for the lint rules and the overwrite guard. Minors: fix version-consistency misdiagnosis of a column-0 YAML comment; correct the compute/extract parity docstrings and the docker-bake four-push-paths note; wire artifact-network-self-test into ci-gates; make the pre-push hook migration message reachable under set -e; omit the false provenance buildStartedOn; filter the release CI-status poll by commit SHA. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193): seed the re-enable-guard test's default-hash row directly The round-2 disable_stale_service_user hash-scrub (bonnyr-f5 #193 minor) collided with the re-enable guard's own regression test: _seed_disabled_default_mcp built its "disabled while holding the published default" state BY CALLING disable_stale, which now scrubs the hash -- so holds_known_default_password was false and the PUT re-enable was allowed (200) instead of refused (400). The guard defends a row taken inactive by a path that LEAVES the credential intact (a manual operator PUT), not one disable_stale scrubbed. Seed that state directly (set is_active=False on the default-hash row) so the guard's real scenario is exercised; assert the default hash survives the seed. Corrected the now-stale guard comment in routes/auth.py that still claimed disable "only flips is_active". Neutralisation and its asserting tests are unchanged. Verified: TestServiceAccountReEnableGuard 2/2 pass; the three affected auth files (test_startup_seed_auth, component/test_auth_service, integration/test_routes_auth) 97/97 pass; ruff clean. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193 r3): fail-close key provenance (B-2) + credential/auth minors Own the round-3 CREDENTIAL/AUTH findings. B-2 (BLOCKER): _persist_or_load_key classified a marker-less key file as operator-provided, so every upgrade keys volume (key present, no marker) let SEC-006's fail-fast pass OPEN on an auto-generated JWT/ENCRYPTION secret in production. Invert the sentinel: a marker-less key now classifies AUTO-GENERATED (fail closed); an operator asserts provenance with an explicit <filename>.operator opt-out marker. No marker is written on generation, which also removes the second trigger (a partial marker write can no longer downgrade provenance). Regression tests seed the PREVIOUS-RELEASE on-disk shape and assert validate_production raises under ENVIRONMENT=production. Minors: - Write the key via os.open(0o600)+fchmod so the secret is never briefly 0644. - Single-source the MCP known-default denylist: delete the local tuple in auth_service and use core.config.MCP_KNOWN_DEFAULT_PASSWORDS (comment notes the helm copy is deploy-owned). - Correct holds_known_default_password docstring (disable_stale now scrubs the hash; this guard covers the other disable paths). - Reconcile ENCRYPTION_KEY docs with reality: the keys-file is the source of truth for at-rest crypto; the env var only drives the production gate (encryption.py comment + .env.example). - Clarify the v2_155 custom-username remedy in disable_stale docstring. Test-gaps: - Normalise the service username (trim/casefold) at the reconcile lookup and the disable skip filter, so " mcp "/"MCP" reconciles the existing mcp row instead of minting a second service account and disabling the live one. - Honest seed_admin_user log/logic under DEFAULT_ADMIN_MUST_CHANGE=false (no more "must change on first login" when no gate was applied). - disable_stale_service_user(skip_username=...) leaves the live row wholly untouched (no inactive window), variant included. - db.commit() failure after the keys file is written leaves a retriable state (published default still authenticates, orphan file password does not). All owned-suite tests pass; ruff clean. Each fix reproduced then mutation-tested. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193 r3): close the release/CI blocker + major + every release/CI minor M-6 (blocker): commit-lint no longer reds unamendable merge history. - rule 2 now flags ONLY a mis-anchored DECLARATIVE marker (the colon form); a colonless marker-shaped PROSE line the detectors treat as inert (an already-merged body such as "- <MARKER> footer in the body ...") is no longer flagged, so the push-to-main range (before..head, which INCLUDES the PR merge-base) goes green without a history rewrite. Detection of a real mis-anchored marker is unchanged. - deleted the already-merged exemption as dead code: base..head excludes the base by construction, so no scanned commit can ever be an ancestor of it. Removed the BEFORE derivation, _already_merged, tests B3.2/M1.5, and the ~20-line header claim. The release-bot exemption stays. - rule 2 now scans the whole body via _under_detected_markers and reports EVERY mis-anchored marker, not just the first. M-7 (major): secret-scan no longer false-fails a delete-only range. A delete-only commit has rev-list count > 0 but gitleaks scans 0 (it scans added content), so the count-based backstop is replaced by a range- resolvability check plus gitleaks' exit status. Release/CI minors: - release-bot fingerprint single-sourced to scripts/lib/is-release-bot-subject.sh; release.yml's inline copy byte-locked by a parity self-test; dropped the false unforgeability claim and documented the residual honestly. - registry-overwrite-guard: added a fail-closed default arm for an unrecognised/empty probe status (+ malformed/empty test scenarios). - Makefile push-images: FORCE_LATEST now overrides ONLY the recency guard; a new FORCE_OVERWRITE overrides ONLY the immutable-tag guard; fixed the missing-jq remediation text. - registry-tag-probe: the network arm now matches the real doubled "000000" curl-failure shape (was dead code); test fixture reproduces it. - INV-15: single-sourced the marker regex (one canonical value + a detector-parity assertion that every embedded copy is byte-identical). - release.yml Publish summary counts what buildx actually pushed (bake --metadata-file), not the static target list. - registry-tag-probe test enumerates the bake DEFAULT group (scoped), matching the guard's enumeration. - added scripts/tests/secret-scan.test.sh (fake-docker mutation suite). release.yml: added a post-push step running scripts/verify-image-pins.sh so a release cannot complete while shipping an unpublished image pin (script owned by the deploy agent; referenced by path from .release-tooling). Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193 r3): single-source every deploy version pin + close deploy majors/minors B-1/B-1b: dist/docker-compose{,.local}.yml, dist/.env.example and ibm_cloud_bnk_forge.sh hard-pinned 4.0.0, a tag that has never been published, while Helm pinned 3.1.6 -- two shipped paths naming two versions, one of which does not exist. Bring all of them under sync-version-artifacts.sh (new PIN/ DISTENV readers+writers, --check, --list) so every pin derives from VERSION (3.1.6, which exists) and the release re-stamps them atomically via the existing --write $NEW; drop the dist/ disclaimer. Add scripts/verify-image-pins.sh (+ selftest) that resolves every shipped compose image: pin against the registry and fails on manifest unknown, wired post-push in the release job. M-1..M-5: reword NOTES/compose/chart comments that asserted post-guard behaviour as already-true on the pre-guard pinned image (they land with the guard-carrying release); NOTES now leads with the required ALLOWED_ORIGINS override; dist/README and the install guide stop recommending latest/3.1.6 and the keys-file cat the pinned image does not write; install.sh strips quotes and rejects the known- default MCP passwords so the "MCP not active" warning fires instead of a green lie; add deploy-version-lockstep + helm-known-defaults-lockstep selftests. Deploy minors: MCP_USERNAME "do not set" made consistent across docs/Makefile; chart ENCRYPTION_KEY now emits a valid Fernet key; DEFAULT_ADMIN_* added to the ibm P3 backend env; secrets.mcpUsername defaults to "mcp" on null; ibm mapfile -> portable while-read. Verified: sync --check exit 0; --write round-trip moves every pin and restores; helm lint/template clean (default + origin override); script selftests green; bash -n + shellcheck clean. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193 r4): unify the at-rest encryption key (B-3), fail-close key marker (M-1), row-matches-client (M-2) + credential minors B-3: validate_production gated ENCRYPTION_KEY while a second, independent generator in core/encryption.py produced the real at-rest Fernet key unchecked — setting ENCRYPTION_KEY (the documented remedy: token_hex(16), not even a Fernet key) turned the gate green while encryption auto-generated a different key. Unify: one key file (_encryption_key_path == core.encryption.ENCRYPTION_KEY_FILE), one generator. When ENCRYPTION_KEY is set it is VALIDATED as a real Fernet key (fail clearly if not), written to that file with a .operator marker, and consumed by core.encryption and services.backup_service; the provenance flag reflects the value that actually protects data. Never clobber an operator-marked key on a mismatch. config.py:319 and .env.example now print the Fernet recipe. M-1: _persist_or_load_key required a regular-FILE marker (os.path.isfile, not os.path.exists — a directory no longer counts) and treats "marker present, key file absent" as a provisioning error: generate but do NOT persist, so the stale-marker rotation gesture can never heal into auto=False on the next boot. M-2 (regression this PR introduced): ensure_service_user normalised the username before lookup/create, so MCP_SERVICE_USERNAME=MCP seeded 'mcp' while the client sends the raw 'MCP' and authenticate_user matched exactly -> login denied. Create/ reconcile under the RAW value (what the client sends); the disable_stale skip keys on the same raw value; only the reserved-name guard normalises. Fixed the false "Matches the Helm chart lower|trim" docstring. Credential minors: non-vacuous localhost-CORS test (valid MCP password so only the CORS branch fails) + wildcard is now an exact origin-list entry, not a substring; new DPU-websocket must-change/unresolvable-user tests mirroring the k8s twin; middleware unresolvable-JWT-subject-refused and exact-vs-suffix exempt-path tests; corrected the denylist copy count (4th copy in dist/install.sh); corrected v2_155's rationale (v2_154 is new in this diff, not "already shipped"); documented why ensure_service_user's adoption branch is kept. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193 r4): close deploy-surface blocker + majors (B1, M7-M12) and deploy minors B-1: a fresh install of the pinned 3.1.6 bundle seeded an admin nobody could log in as. `${DEFAULT_ADMIN_PASSWORD:-}` delivers the var present-and-empty; 3.1.6's `DEFAULT_ADMIN_PASSWORD: str = "changeme"` is then overridden by "" and the login schema rejects "" (422). The prescribed `${VAR}` form does NOT omit on this compose (map interpolation still renders ""); the working omit-when-unset form is a map entry with NO value (passthrough / `docker run -e KEY` semantics). Converted DEFAULT_ADMIN_PASSWORD to passthrough across all four compose paths (dist base+local, root base+local, IBM embedded). Swept the class: JWT_SECRET_KEY/ENCRYPTION_KEY also converted (3.1.6 uses `if KEY is None`, so "" is used literally, not auto-generated); MCP_SERVICE_PASSWORD kept as `${...:-...}` because omitting it restores 3.1.6's known default "mcp-service-changeme". Added a commented DEFAULT_ADMIN_PASSWORD block to dist/.env.example. Verified via `docker compose config` + real container env both directions (unset -> omitted; set in .env -> forwarded). M-7: chart checksum/secret did not change on mcp-password rotation (3 renders, 3 generated passwords, one identical checksum). Made all generate/rotate fallbacks deterministic (deriveSecret, release-seeded) so the Secret is stable across renders and includes, and hash the RENDERED Secret so the annotation tracks every resolved value. Now stable across renders, identical across the 4 deployments, and it flips when any resolved value changes. M-8: dist/install.sh credential guard failed open on `changeme ` (whitespace). Trim leading/trailing whitespace around the quote-strip before the known-default compare. M-9: removed newly-added forward-dated 4.0.0 prose (install-guide.html x2, DOCKER.md). M-10: default helm install crashlooped (production + localhost). Added a render-time guard mirroring backend validate_production (fail on wildcard under staging/production, localhost under production); defaulted ALLOWED_ORIGINS to empty so the bare render boots (empty is neither wildcard nor localhost). `helm lint` and bare `helm template` stay green; the guard fires with a clear message on a real fatal posture. M-11: portable in-place sed in the IBM installer (`sed -i.bak … && rm`), both sites. M-12: dist/ no longer ships published default DB/redis creds on host networking. install.sh generates strong POSTGRES_PASSWORD/REDIS_PASSWORD on the fresh .env (like Helm/IBM); .env.example ships them empty; a pre-existing default triggers a warning. Deploy minors: extended deploy-version-lockstep.test.sh to the bnk-operator chart (appVersion + image.tag) and dist/VERSION; brought dist/VERSION under sync-version-artifacts.sh (--check/--list/--write green); reworded install.sh's MCP UNHEALTHY assertion to match what the pinned image actually reports; added scripts/tests/ibm-compose-drift.test.sh freezing the credential/hardening env so the IBM embedded compose and dist/docker-compose.yml cannot silently diverge. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193 r4): make the pin verifier reachable pre-push, de-vacuum the parity/self-test harnesses, and close the release minors B-2 (blocker): scripts/verify-image-pins.sh could never pass where the release job runs it — from the 4-file sparse .release-tooling checkout that holds no compose file (ROOT resolved there), with REGISTRY/VERSION handed in as env vars the script reads only as flags, and the whole step wired AFTER the tag/Release/push/signing. Fixes, end to end: - add a consistency mode (--expect-version) that asserts every shipped first-party pin already renders to $NEW without a registry probe, and run it as the PRIMARY PRE-push gate in release-final and release-manual (before anything irreversible); - fix the post-push existence step to pass REGISTRY/VERSION as FLAGS and the compose files explicitly by --file (they live at the tag checkout at the workspace root), keeping it as a secondary confirmation; - widen the default file set to include the IBM Cloud installer's embedded compose; - add a dryrun-release-tooling job that rebuilds the exact publish-job layout and exercises both invocations against a fake probe, and gate release-publish on it, so a step that cannot execute is caught before it is wired ahead of a signature. The sibling registry-tag-probe.sh / registry-overwrite-guard.sh read nothing $ROOT-relative outside the sparse set, so they are unaffected. M-3: detector-parity.test.sh enumerated the marker copies with the very token that drifts, so a copy that drifted in the token vanished from enumeration (drifting :96-97 dropped the count 5->3 yet stayed green). Enumerate by position/count instead: an exact per-file canonical count plus a stable-anchor site scan that flags any drifted site even under a compensating add. M-4: the filesystem self-test loop checked only a non-empty enumeration and each file's exit 0, so a test gutted to a no-op passed and deleting 7 of 8 stayed green. It now requires each file to emit PASS lines, no FAIL line, and an ALL PASS terminal marker, plus a count floor derived from git's tracked *.test.sh set (detector-parity was conformed to that output convention). M-5: release-rc created and pushed the RC tag before the fail-closed notes step; the tag is now created locally, notes generated, then the tag pushed. M-6: added mutation-tested coverage for this PR's four previously-uncovered lint fixes (the PR-title lint, the pending-message lint, the RANGE fail-closed branch, and the skip-checks trailer rule). LEAD: the anti-vacuity staging floor derived the count from a stale literal while --list grew to 8 paths; both sites now derive it from --list and require every listed path to stage, and the stale comments are corrected. Release minors: scope the release-bot commit-lint exemption to the range tip (a forged release subject buried mid-range is no longer exempt) and add a REACHABLE published-history exemption anchored to the last release tag so a mis-anchored marker in unamendable history cannot red the release; add fixtures for the untested registry probe/guard arms (5xx, unexpected code, unknown status, bake-parse failure); ancestry-filter the LAST_FINAL tag queries so a tag on another branch cannot skew the notes range; reconcile the empty-RANGE handling (commit-lint now fails closed on an explicit empty RANGE, ci.yml leaves it unset); give the pre-push hook a clear message and a fetch fallback when the remote tip is absent locally; derive the cosign verify-identity org from REGISTRY instead of hardcoding it. Flagged: gate Makefile push-customer-build through registry-overwrite-guard.sh, the last documented push path that was still unguarded. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193 r4): keep M-7 checksum-tracks-rotation WITHOUT predictable secrets The r4 deploy fix closed M-7 (checksum did not move on a secret rotation, so pods never rolled) by making the generated fallbacks deterministic -- deriveSecret = sha256(Release.Name|Namespace|fullname|purpose). Every input is public (they appear in resource labels and the chart source), so that made the JWT signing key, the at-rest Fernet key and the admin/mcp passwords COMPUTABLE by anyone who can read a label -- a forge-any-token / decrypt-all-secrets exposure, strictly worse than the cosmetic churn it fixed. Revert generation to randAlphaNum (unpredictable) and instead hash the DETERMINISTIC inputs that determine the Secret -- values.secrets, the persisted .data (reused via lookup), plus a per-credential "rotating-from-default" marker for admin/mcp whose persisted value is a known published default. That tracks every rotation (operator edit, persisted-value change, rotate-away-from-default) so the pods roll, is stable across renders including a bare no-cluster `helm template` (the hashed inputs carry no randomness), and never derives a secret from public identity. deriveSecret removed. New scripts/tests/helm-secret-checksum.test.sh locks all three: stable-across-renders, changes-on-rotation, and generated-value-is-random -- so the determinism cannot return. Verified: helm lint 0-failed; bare + override template OK; the M-10 render guard still fires on production+localhost; the new selftest ALL PASS. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193 r4): self-review — close the encryption-key data-loss BLOCKER + deploy minors A cold adversarial self-review (three auditors mirroring the reviewer's method) of the r4 changeset found a data-loss BLOCKER we introduced this round, plus deploy minors. Fixing before it ships. B-3 (BLOCKER, data loss): the r4 encryption-key unification made ENCRYPTION_KEY env OVERWRITE an existing at-rest key file on boot. Traced only to the "operator freshly sets the key" consumer, never to (a) backup_service restore, which writes the backup's key to that file, or (b) the r3->r4 upgrade population, whose data was encrypted under a marker-less auto-gen FILE key (r3 core.encryption used the file regardless of env). The first r4 boot clobbered those -> restored/existing data undecryptable (or bricked the boot on a marker mismatch). A new test even LOCKED the clobber with a false premise. Fix: the at-rest key FILE is the single source of truth. ENCRYPTION_KEY only SEEDS the file when it is ABSENT and never overwrites an existing one; the gate reads the FILE's .operator provenance. backup restore now drops the .operator marker so a restored key passes the gate without a clobber. Rewrote the clobber-locking tests to lock the no-clobber invariant; added upgrade-shape, production-fail-without-data-loss, and restore-marker tests. M-7 (deploy self-review): removed the rotation-marker from secretsChecksum — the auditor proved it redundant (the same .data change already moves the digest; deleting it left the test green) and its admin branch dead. Kept the input-hash; documented the genuine trilemma (cluster-less-template-stable / tracks-generated-rotation / unpredictable-secrets — pick two; determinism is the predictable-secret hole). M-10: the render guard's wildcard check is now an exact comma-split entry, matching the backend's `"*" in cors_origins` since r4, so a legitimate `https://*.example.com` is no longer blocked; the localhost check stays a substring to match the backend. .env.example: the admin-password template was an empty assignment that uncomments into a lockout; it now carries a replace-me placeholder. Verified: backend 8082 passed; config/encryption 66, backup 13; script-selftests all pass; helm lint/template clean (subdomain-wildcard passes, bare '*'/prod+localhost fail); ruff clean. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 * fix(#193 r5): fail closed instead of regenerating over an existing at-rest key (I-1) bonnyr-f5 #193 round-5 closure blocker. B-3 wrote down the invariant "the at-rest key file is the single source of truth; nothing overwrites it once it holds bytes" and config.py honoured it -- but core.encryption.get_encryption_key() did not. A file present but under 32 bytes (truncated / partial write / disk full / bad restore) logged "Invalid key, regenerating" and OVERWROTE it with a fresh key, permanently destroying the key any existing data was encrypted under -- silently, on a GREEN production boot, because the intact .operator marker keeps validate_production passing. Fix: the read path now fails CLOSED. A genuinely absent (or 0-byte) file still generates and persists a new key. A file that HOLDS bytes is validated as a real Fernet key: valid -> returned untouched; unusable -> SystemExit with a clear message, never regenerated. A crashloop is recoverable; an overwritten key is not. This also closes r5 note #3 -- the old `len >= 32` check accepted any blob and surfaced a mis-shaped key as a later cipher error; it now Fernet-validates and says so plainly. Locked by TestAtRestKeyFileNeverRegeneratedOverBytes: a 30-byte truncated key -> SystemExit AND the original bytes survive on disk (recoverable); a valid key -> returned untouched; an absent file -> generates a valid key. Verified: backend 8086 passed; encryption unit tests 19 passed; ruff clean. Claude-Session: https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4 --------- Co-authored-by: John Gruber <john.t.gruber@gmail.com>
Addresses Blocker 2 from @bonnyr-f5's #177 review.
The bug
helm/bnk-forge/values.yamlpinnedimage.tag: "3.0.1"(andChart.yamlappVersion: "3.0.1"); every per-servicetag: ""falls back to it. The release publishes only:${VERSION}and:latest, and:3.0.1was never published onghcr.io/f5devcentral→ImagePullBackOffacross all seven services.frontend-v2/package.jsonhad drifted to2.12.0. The release bumped onlyVERSION/dist/VERSION/CHANGELOG, so everything else drifted silently.Fix
scripts/sync-version-artifacts.sh—--write <v>sets the global Helm image tag, ChartappVersion, and frontendpackage.json;--checkasserts all three equalVERSION(exit 1 otherwise). Anchored seds touch only the global 2-space image tag — postgres/redis and the""per-service tags are untouched.--writeafter bumpingVERSIONand stages the files, so a 4.0.0 release moves the chart to 4.0.0.P1 · Version Consistencyruns--check, wired into the CI gate — drift can't reappear silently. Mirrors the existing image-level VERSION assertion (ci.yml:912), at source level on every PR.Verified
--checkpasses;bash -nclean; both workflow YAMLs validate.One judgment call
This makes
frontend-v2/package.jsontrack the productVERSION, as the review asked. If the frontend is meant to version independently, drop that one line from the assertion — flagging for the maintainers.https://claude.ai/code/session_01UpRYiFserdBE5ESHn759N4