Skip to content

Console and deploy follow-ups from the codebase review (#197) - #207

Merged
icebergai-review-bot[bot] merged 1 commit into
mainfrom
claude/codebase-review-cleanup-ovlli4
Aug 20, 2026
Merged

Console and deploy follow-ups from the codebase review (#197)#207
icebergai-review-bot[bot] merged 1 commit into
mainfrom
claude/codebase-review-cleanup-ovlli4

Conversation

@richardmhope

Copy link
Copy Markdown
Contributor

Closes #197 — the last of its three sections, after the API (#205) and core/connectors (#206).

1. A crafted link could put words in the console's own chrome

A failed save redirects carrying its reason, and that reason travelled as plain query text. Autoescaped, so never script — but /login?error=Your account is locked, call 555-0100 renders inside this console's own frame and reads exactly as though this console said it.

The reason is now a signed two-minute token under the session key, minted by the same JWT-with-an-audience mechanism the login state already uses, and a page renders nothing for anything it cannot verify.

  • Signed, not an enum of codes — the API's own sentence (base_url: is not a valid URL) is the useful half, and codes would throw it away.
  • Signed, not a server-side flash — this deployment keeps no per-user state between requests, which is why the login state rides in a cookie too.
  • Two minutes — a URL pasted into a chat later shows nothing rather than a stale complaint.

Seven pages read it (/login, /schedules, /suppressions, /channels, /users, /engines, /ownership); a parametrised test posts phishing text at every one.

2. A successful triage left the rest of the page stale

The swap updated #triage only, so the header's state chips and the Record card's assignee, owner and due date went on showing pre-save values until somebody reloaded. docs/web.md already said what to do here — "where a change is bigger than one region, the mutation answers hx_redirect()" — so it does.

A rejected triage still answers the panel: nothing moved, and navigating away would take the analyst off the explanation of why. There's a test for each half.

3. The "assigned to you" tile counted one capped page

An analyst with 300 open findings assigned saw a number derived from the first 200 rows — and, unlike its unassigned sibling, the tile did not even admit the cap. It's a query now (assignee_id=, which the API already supported), with the same + every other tile uses.

The test drives it with OVERVIEW_LIMIT monkeypatched to 2 rather than 200 fixtures, and scopes its assertion to this tile — a page-wide search for "2+" passes without the fix, because the open-findings tile is capped in the same fixture.

4. The gitleaks image is pinned by digest

test_ci_actions_are_pinned_to_a_commit's own docstring claimed this repository pins "the gitleaks image". It did not — a mutable tag, on a container that runs with the whole repository history mounted into it. Now ghcr.io/gitleaks/gitleaks@sha256:691af3c… (v8.30.0, resolved from the registry), and the invariant covers images as well as actions.

Scoped to ci.yml rather than every docker run in the tree: verify-chart.sh's helm image is a laptop fallback CI never reaches, and now says so where it's set.

5. verify-chart.sh: a contradictory log and a sidecar-shaped hole

  • It printed ok every workload runs non-root, unprivileged, read-only… unconditionally, after a loop that may have just recorded failures. The exit code was right; the log said the opposite, and the log is what somebody reads.
  • It inspected containers[0], so a sidecar (or an initContainer) would have walked straight past every hardening check.

Both fixed, and failures now name which container. Verified by extracting the embedded Python and running it against synthetic manifests — a pod with a hardened primary and an unhardened sidecar produces api/sneaky allows privilege escalation, …does not drop all capabilities, …declares no resource requests, and no green line; a clean set produces the green line and nothing else.

Also: the drain bound, from the #202 review

The bot flagged the drain budget as per-thread. It isn't — join_all deducts elapsed time, so the worker threads share one budget — but the observation next door is real: Worker.stop then joins the consumers under a second budget of the same size. The invariant asserted only "under the grace period"; it now requires a 20-second margin, and both the docstring and docs/deployment.md explain that a consumer join costs seconds in practice but "in practice" is not a bound.

Validation

Every fix has a test confirmed to fail against the code before it. New: test_flash.py, plus tests in test_web_screens.py, test_web_ownership.py and test_deploy_invariants.py.

make check green: ruff, mypy (285 files), docs check, 2024 passed / 2 skipped.


Generated by Claude Code

**A crafted link could put words in the console's own chrome.** A failed save
redirects carrying its reason, and that reason travelled as plain query text.
Autoescaped, so never script — but `/login?error=Your account is locked, call
555-0100` renders inside this console's frame and reads exactly as though this
console said it. The reason is now a signed two-minute token under the session
key, minted by the same mechanism the login state already uses, and a page shows
nothing at all for anything it cannot verify. Signed rather than replaced by an
enum of codes because the API's own sentence is the useful half, and rather than
a server-side flash because this deployment keeps no per-user state between
requests.

**A successful triage left the rest of the page stale.** The swap updated
`#triage` only, so the header's state chips and the Record card's assignee,
owner and due date went on showing pre-save values until somebody reloaded. It
redirects now, which is what docs/web.md already said a change spanning more
than one region should do. A *rejected* triage still answers the panel: nothing
moved, and navigating away would take the analyst off the explanation.

**The "assigned to you" tile counted one capped page** and, unlike its
"unassigned" sibling, did not admit the cap — so an analyst with 300 findings
assigned read a number that was simply wrong. It is a query now, with the same
`+` every other tile uses.

**The gitleaks image is pinned by digest.** The invariant test that requires
every CI action to be pinned to a commit said in its own docstring that this
repository pins "the gitleaks image", and it did not: a mutable tag, running
with the whole repository history mounted into it. The test now covers images
as well as actions.

**verify-chart.sh printed its green line even after recording failures**, and
inspected only `containers[0]` — so a sidecar would have walked past every
hardening check. Both fixed; a failure now names which container, and the
"every workload is hardened" line only prints when it is true.

Also, from the review of #202: `Worker.stop` spends the drain budget on the
worker threads as a group and then joins its consumers under a second budget of
the same size. The deploy invariant asserted only that the budget was under the
grace period; it now requires a margin, and both the docstring and
docs/deployment.md say why.

Refs #145, #146.

Claude-Session: https://claude.ai/code/session_012sohE85sRDt6t2w3936rGJ

Co-authored-by: Claude <noreply@anthropic.com>

@icebergai-review-bot icebergai-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

APPROVE

Completed bounded review across 1 immutable scope(s). No actionable findings in the supplied immutable change.

Scope health

Convergence: healthy. Review mode: initial.
Recommended action: CONTINUE_INCREMENTAL.

  • No escalation signals.

Prior findings

Finding Status
No prior finding state

New findings

No new findings.

Fix-induced regressions

  • None evidenced.

Uncertainty

  • No material uncertainty recorded.

Validation

  • Reviewed the supplied diff; exact-head CI is reported as passed.
  • No prior findings were supplied for recheck.

Residual risks

  • None identified.

@icebergai-review-bot
icebergai-review-bot Bot merged commit 9836b6c into main Aug 20, 2026
6 checks passed
@icebergai-review-bot
icebergai-review-bot Bot deleted the claude/codebase-review-cleanup-ovlli4 branch August 20, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Smaller follow-ups from the codebase review

2 participants