Repository navigation
fix: five small correctness fixes from a repository review - #331
Merged
Merged
Conversation
Under `set -o pipefail`, `logs | grep -q X` returns 141 when grep matches early and the writer gets SIGPIPE, so the `if` reads a found secret as "not found". The phase 4 token check and phase 6 password check could therefore pass with a secret in the logs; the public-cert demo had the mirror problem (a spurious "no warning" failure). Grep a captured copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYZ8UQNGWJJHgaqCU64
`Labels` allows an empty value, but `IdentityUri::parse` rejects an empty
segment, so a join token labelled `{"zone": ""}` enrolled a component
whose certificate then failed every verification as "malformed identity
URI". Validate label keys and values in `issue_component` as
`issue_user` already does for CI facts; the refusal happens before the
join token is consumed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEiXYZ8UQNGWJJHgaqCU64
A send that succeeded but could not be committed reset the backoff and looped straight back: the offset hadn't moved, so the same batch was re-sent immediately, forever, while the commit kept failing (a full disk, an unwritable offsets directory). The new test saw ~40k sends in 300 ms. Retry with the shipper's jittered backoff instead, and reset it only once a commit lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYZ8UQNGWJJHgaqCU64
The claim on a batch of logins is sized to outlast 50 sequential IdP calls, so another replica can't re-claim and redeem the same rotating refresh token mid-batch (the second redemption reads as a refusal and locks the person). It was passed through the ±10% check jitter, which could shorten it to 90% of that bound. Spread it by 0..+10% instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYZ8UQNGWJJHgaqCU64
`seq` is read from event lines in S3, which a tamperer can write. Gap detection did `seq + 1`, which panics in debug builds and wraps in release. Saturate instead; the line still shows up as a gap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYZ8UQNGWJJHgaqCU64
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
Five independent fixes found in a scheduled review of the repository. Each is its own commit. None of them overlap with the open PRs (#329 console UX, #327 motion, #300 OIDC groups claim, #276 release).
demo-phase4.sh,demo-phase6.sh,demo-public-cert.sh)set -o pipefail,logs | grep -q Xreturns 141 when grep matches early and the writer gets SIGPIPE. Theifthen reads that as "not found".set -o pipefail; if seq 1 2000000 | grep -qF 5; …takes the not-found branch.limen-ca/src/authority.rs)Labelsallows an empty value, butIdentityUri::parserejects an empty segment.{"zone": ""}therefore enrolled a component whose certificate failed every verification with "malformed identity URI".issue_componentnow validates labels the wayissue_useralready validates CI facts. It refuses before the join token is used up.limen-audit/src/ship.rs)limen-control-plane/src/idp_check.rs)seq = u64::MAX(limen-verify/src/bucket.rs)seqcomes from event lines in the bucket.seq + 1panics in debug builds and wraps in release. It now saturates, and the line still shows up as a gap.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.mise.tomlpins, because mise isn't available here:cargo test -p limen-ca: 30 passed, including the newcomponent_labels_must_round_trip_through_the_certificate.cargo test -p limen-audit: 43 lib tests passed. The newa_failed_commit_backs_off_instead_of_resending_at_oncewas also run with the fix reverted, and it failed (sent 39827 times).cargo test -p limen-control-plane --lib idp_check: 5 passed, including the newa_claim_always_outlasts_a_whole_batch_of_slow_calls.cargo test -p limen-verify: all passed, including the newthe_largest_seq_is_a_gap_not_an_overflow.bash -non all three scripts, plus a shell test showing that the old pattern misses an early match and the new one catches it.Not verified
postgres kms s3.Checklist
cargo fmtandcargo clippy ... -D warningscleanCompatibility and rollback
Remaining concerns
These came out of the same review and are not fixed here.
access::expireemits audit events inside a 100-row transaction. An audit failure partway through rolls back the rows whose events were already written, and the next tick writes them again.UserLockevent.limen-session/src/envelope.rslists 5 of the 6Purposevariants;ControlsReportis missing.fuzz/Cargo.lockis stale, and the fuzz targets are only built weekly.*.sh, althoughmise.tomlpins it.deploy/prometheus/alerts.ymlanddeploy/kubernetes/**are not validated in CI.fsGroup: 65532), so the spool volume may not be writable on EBS.examples/ci/policy-check.ymlcallshead/scripts/policy-pr-comment.sh, which won't exist in a user's policy repository.Generated by Claude Code