Repository navigation
fix: evidence packs verify after signer expiry, spool gap, session TTL overflow, two hygiene fixes - #299
Merged
Conversation
verify_pack checked the signing control plane's certificate against the current time. That certificate lives about a day, so every genuine pack stopped verifying offline a day after export, which is when an auditor checks it. Judge it as of the manifest's signed generated_at instead, as the audit bucket verifier already does for manifests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYXpNCrqYnNbKiHVaey
read_from ignored scan's short result, so a closed segment damaged after open returned a batch with a gap; the consumer committed past it and the missing records were never shipped. Return a corruption error instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYXpNCrqYnNbKiHVaey
max_session_ttl has no upper bound in policy validation, and now + ttl panics past year 9999, so one oversized role broke every session open for its holders. Compute the expiry with checked_add and deny on overflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYXpNCrqYnNbKiHVaey
redis::target::Credentials derives Debug and held the session token as a plain String, unlike db/sigv4.rs. Nothing logs it today; this keeps it that way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYXpNCrqYnNbKiHVaey
demo-idp-offboarding ran cargo test without --nocapture, so libtest swallowed the SKIPPED line a passing-but-skipped test prints and the guard could never trigger. Both demos now grep a here-string rather than a pipe, which pipefail plus grep -q could turn into a miss. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYXpNCrqYnNbKiHVaey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
This PR has five small, independent fixes, one commit each. They come from a routine review, and none of them overlaps the open PRs #294, #295 or #276.
limen-verify/src/pack.rs).verify_packchecked the signer's certificate against now. The control plane's certificate livesLIMEN_COMPONENT_CERT_TTL(24h by default), solimen audit verify --evidencerejected every genuine pack once that certificate expired. That is exactly when an auditor checks a pack (ADR-0029: "verify offline").generated_at, the same waybucket.rsalready judges audit manifests withverify_at.tests/reviews.rsdidn't catch this because it verifies the pack straight after generating it.limen-audit/src/spool.rs,read_from).scanreturned fewer records than requested when a closed, fsynced segment had been damaged afteropen(a truncated or bad-CRC tail), andread_fromignored the short count.run_consumerthen committed past the missing records, so they were never shipped, and the segment was later deleted.SpoolError::Corrupt, which matches the module's own rule of never skipping records silently.max_session_ttl(limen-proxy/src/sessions.rs).max_session_ttl:3000000dparses.now + ttlpanics past year 9999, so one such role broke every session open for the people holding it.checked_add, and the session is denied with a reason on overflow.Secret(limen-worker/src/redis/target.rs).Credentialsstruct derivesDebugand heldsession_token: Option<String>, unlikedb/sigv4.rs. Nothing logs it today; this keeps the "secrets never logged" invariant from depending on that.demos/demo-idp-offboarding.sh,demos/demo-shadow.sh).demo-idp-offboardingrancargo testwithout--nocapture. libtest swallows a passing test's stderr, which is whereSKIPPED: …is printed, sogrep '^SKIPPED'could never match.pipefailplusgrep -qexiting early can SIGPIPE theechoand turn a match into a miss.Related: no phase work; these are bug fixes to shipped behaviour (ADR-0029 for item 1).
How it was verified
cargo fmt --all: clean.cargo clippy --locked -p limen-verify -p limen-audit -p limen-proxy -p limen-worker --all-targets --all-features -- -D warnings: clean.cargo test --locked -p limen-verify -p limen-audit -p limen-proxy --lib: all pass (7, 23 and 38 tests), andcargo test -p limen-verifyintegration tests pass.cargo test --locked -p limen-worker --lib redis::: 57 pass.pack::tests::a_pack_still_verifies_after_its_signers_certificate_expiresissues a 1-second certificate and waits 2.1s.pack::tests::a_pack_dated_after_its_signers_certificate_expired_is_refused.spool::tests::a_closed_segment_damaged_after_open_fails_the_read_instead_of_skipping.sessions::tests::a_session_ttl_past_year_9999_is_refused_not_a_panic.redis::target::tests::debug_output_hides_the_secret_key_and_session_token.SKIPPEDappears 0 times without--nocaptureand once with it.bash -non both demos.Not verified
clippyorcargo test --workspace --all-features; CI runs them. I did not run any integration tests needing PostgreSQL/KMS/S3 or Dex, includinglimen-control-plane/tests/reviews.rs, which callsverify_pack.shellcheck,gitleaksorcargo deny(not installed). No external dependency was added: the new dev-dependencies oflimen-verify(limen-ca,limen-core,rcgen) are already in the workspace.Review guide
bucket.rsdocuments. Someone holding a key from an expired control-plane certificate could sign a pack backdated into that certificate's validity. Before this change, every pack failed once its certificate expired, so this widens what verifies back to what ADR-0029 intended. Theevidence.exportaudit event, which carriesmanifest_sha256, is the anchor that catches a forged pack. Worth a look whetherlimen audit verify --evidenceshould require that event by default.Checklist
cargo fmtandcargo clippy ... -D warningsclean (on the touched crates)limen_core::secret::Secret); mTLS and fail-closed audit intactCompatibility and rollback
None. Two behaviour changes:
Revert any single commit to roll it back.
Generated by Claude Code