Skip to content

fix: approval queue limit, envelope test coverage, example CI and k8s fsGroup - #337

Merged
jfcmartins merged 5 commits into
mainfrom
claude/focused-thompson-nc44w9
Nov 15, 2026
Merged

jfcmartins merged 5 commits into
mainfrom
claude/focused-thompson-nc44w9

Conversation

@jfcmartins

Copy link
Copy Markdown
Collaborator

What and why

Four independent fixes from a scheduled review of the repository. Each is its own commit. None of them overlap with the open PRs: #331 (five review fixes), #300 (OIDC groups claim), #276 (release) and the dependabot bumps.

  1. access: the approval queue could come back empty, and ignored limit (access/store.rs, access/mod.rs)
    • scope: approvable read the oldest 500 pending requests across the organisation and then kept the ones the caller may approve.
    • Once more than 500 requests are open (MAX_OPEN is 20 per person), an approver whose roles only have newer requests sees an empty queue. The console's "waiting for your decision" count and the approvals tab miss them too, and the requests lapse unseen.
    • limit was never applied either.
    • The query now selects by the roles the caller may approve and leaves out the caller's own requests (lower(requester) <> lower($2), as separation of duties does elsewhere). It applies the limit and keeps the per-row may_approve check.
  2. session: the envelope tests skipped ControlsReport (limen-session/src/envelope.rs)
    • ALL listed 5 of the 6 purposes, so the cross-purpose replay test and the signer-kind test never covered the controls report.
    • ControlsReport is now in ALL. A new test has a wildcard-free match, so adding a Purpose without updating ALL stops it compiling. It also checks that labels are unique.
    • This was listed as a remaining concern in fix: five small correctness fixes from a repository review #331 and not fixed there.
  3. examples: the policy-check workflow's comment step couldn't resolve the repository (examples/ci/policy-check.yml)
    • Both checkouts are in subdirectories (head/, base/), so the workspace root isn't a git repository. gh api repos/{owner}/{repo}/… therefore has nothing to fill the placeholders from, because gh reads GH_REPO, not GITHUB_REPOSITORY.
    • The step now sets GH_REPO: ${{ github.repository }}. The workflow header and the guide now say that scripts/policy-pr-comment.sh must be copied too, since the workflow calls head/scripts/policy-pr-comment.sh.
    • Also listed in fix: five small correctness fixes from a repository review #331.
  4. deploy: the plain control-plane StatefulSet had no pod security context (deploy/kubernetes/limen/control-plane.yaml)
    • The image runs as distroless nonroot (uid 65532), and the spool is a volumeClaimTemplate. A freshly provisioned volume such as EBS is root-owned, so without fsGroup the spool isn't writable.
    • It now uses the same podSecurityContext as the Helm chart's default. The proxy and worker manifests use emptyDir and are left alone.
    • Also listed in fix: five small correctness fixes from a repository review #331.

Related: no phase change; bug fixes only.

How it was verified

  • cargo fmt --all --check: clean.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.
  • Built with protoc 3.21 from apt, not the 36.2 that mise.toml pins, because mise isn't available here. Tests were built with CARGO_PROFILE_DEV_DEBUG=0 to fit the disk.
  • cargo test -p limen-session --lib: 26 passed, including the new all_lists_every_purpose_once.
  • cargo test -p limen-control-plane --test access_requests, against a local PostgreSQL 16 (LIMEN_TEST_DATABASE_URL): 15 passed, including the new the_approval_queue_honours_its_limit_and_skips_your_own.
    • With the fix reverted, the new test fails: limit: 1 returned all 3 requests.
  • YAML: the manifest parses (yaml.safe_load_all).

Not verified

  • The example workflow was not run in a GitHub Actions policy repository. The GH_REPO reasoning comes from gh's documented placeholder resolution.
  • The manifest was not applied to a cluster, and the spool-not-writable failure was not reproduced on EBS.
  • The 500-request case was not reproduced at scale; the test covers the limit and the self-exclusion.
  • The full workspace test suite, the integration tests that need kms/s3, the demos, shellcheck, actionlint and gitleaks were not run (the tools are not installed here).

Checklist

  • Tests added or updated; cargo fmt and cargo clippy ... -D warnings clean
  • Docs updated: docs/guides/policy-tooling.md (copy the script too)
  • Phase work: n/a
  • Secrets stay out of logs; mTLS and fail-closed audit intact (no change to either)
  • New dependency: n/a
  • New entry point or data store: n/a
  • Commits are conventional, small and focused

Compatibility and rollback

  • ListAccessRequests with scope: approvable now returns at most limit rows (0 means 200), oldest first. The console asks for 100, so an approver with more than 100 waiting sees the oldest 100 and a count of 100, rather than up to 500 rows before.
  • No migrations or config changes. Each commit reverts on its own.

Remaining concerns

  • Some findings from the same review are security-relevant. Following SECURITY.md, they were reported to the maintainer privately and are not described here.
  • Not fixed, needs a decision: the Kafka handler answers a Fetch with no permitted topics locally, with session_id = 0. That includes the empty incremental fetches consumers send in steady state, so clients fall back to full fetches and lose long-polling. Forwarding them would mean reasoning about broker-side fetch sessions under policy changes, so it was left alone.
  • Still open from fix: five small correctness fixes from a repository review #331's list: duplicate audit events in access::expire, the stale fuzz/Cargo.lock, no shellcheck in CI, and no validation of the alerts or manifests in CI.
  • Lower priority: under pipefail, page … | grep -q in demo-phase4.sh (lines 148-159) can misread an early match if a console page exceeds the pipe buffer. That is the same pattern fix: five small correctness fixes from a repository review #331 fixed for log greps. It was not measured.

Generated by Claude Code

ALL listed five of the six purposes, so the cross-purpose and signer-kind
tests never checked ControlsReport. Add it, and a wildcard-free match that
stops compiling when a new purpose is added without updating ALL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEiXYYveWxqv7a2tV4a3dG
Both checkouts sit in subdirectories, so the workspace root is not a git
repository and gh can't resolve {owner}/{repo}: the comment step failed.
Set GH_REPO, and say that scripts/policy-pr-comment.sh must be copied too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEiXYYveWxqv7a2tV4a3dG
…context

The image runs as nonroot uid 65532 and the spool is a PVC, which starts
root-owned on EBS. Without fsGroup the spool isn't writable. Match the Helm
chart's podSecurityContext.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEiXYYveWxqv7a2tV4a3dG
The approvable scope read the oldest 500 pending requests and then kept
the ones the caller may approve. With more than 500 open requests, an
approver whose roles only had newer ones saw an empty queue, and the
requested limit was never applied. Select by approvable role and exclude
the caller's own requests in SQL, apply the limit there, and keep the
per-row check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEiXYYveWxqv7a2tV4a3dG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEiXYYveWxqv7a2tV4a3dG
@jfcmartins
jfcmartins marked this pull request as ready for review November 15, 2026 22:33
@jfcmartins
jfcmartins merged commit 382d147 into main Nov 15, 2026
24 checks passed
@jfcmartins
jfcmartins deleted the claude/focused-thompson-nc44w9 branch November 15, 2026 22:59
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.

2 participants