Repository navigation
gate(xtask): enforce no-panic allowlist expires field — flag entries past their expiry date (#2344) - #2484
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Sorry @EffortlessSteven, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
WalkthroughThe no-panic policy evaluator now validates V2 expiration dates, reports malformed or expired entries, and includes date and expiry tests. Existing allowlist expiration dates are extended from July 1 to December 31, 2026. ChangesNo-panic expiry lifecycle
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant evaluate_semantic_no_panic_policy
participant today_date_string
participant policy_report
evaluate_semantic_no_panic_policy->>today_date_string: Compute today's YYYY-MM-DD date
evaluate_semantic_no_panic_policy->>policy_report: Record malformed or expired V2 entry
evaluate_semantic_no_panic_policy->>policy_report: Add expiry violation
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@xtask/src/no_panic.rs`:
- Around line 687-690: Update the expiry check in the no-panic validation flow
to parse the non-empty, non-TODO expires value as a real date before comparing
it with today. Reject or otherwise flag malformed dates, and compare normalized
date representations so values such as unpadded month/day components cannot
bypass expiry enforcement.
- Around line 1283-1286: Update the timestamp calculation in the surrounding
no-panic validation flow to handle a failed duration_since(UNIX_EPOCH)
explicitly rather than using unwrap_or(0). Propagate the clock error and record
the corresponding policy violation, ensuring a pre-epoch system clock cannot be
treated as the Unix epoch or make expired exceptions appear valid.
In `@xtask/src/no_panic/tests.rs`:
- Around line 1543-1570: The test expired_entry_is_flagged_by_evaluation
currently passes no findings, so it does not verify expiry handling for an
otherwise matching exception. Add a current finding matching the V2 entry’s
path, family, and selector criteria, pass it to
evaluate_semantic_no_panic_policy, and retain the assertion that the report
includes the expiry violation for 2020-01-01.
- Around line 1530-1541: Strengthen today_date_string_is_valid_iso_format by
asserting that all non-dash characters are ASCII digits and that month/day
components fall within valid ranges. Add deterministic boundary-case coverage
for known dates, using an injectable or otherwise controlled date source if
needed, to verify calendar conversion at dates such as year, month, and day
transitions rather than relying only on comparison with 2020.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 4bca97dd-d90d-4ea8-86f7-a4d500f26e62
📒 Files selected for processing (3)
policy/no-panic-allowlist.tomlxtask/src/no_panic.rsxtask/src/no_panic/tests.rs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
EffortlessMetrics/ripr(auto-detected)EffortlessMetrics/em-ci(auto-detected)EffortlessMetrics/unsafe-review(auto-detected)EffortlessMetrics/perl-lsp(auto-detected)EffortlessMetrics/ub-review(auto-detected)
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 589d7b22c3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- expired_entry_is_flagged_by_evaluation passes
&[]findings; it does not prove the gate still catches an expired V2 entry when a matching finding exists (i.e., that expiry beats selector matching). Add a current finding matching the entry's path/family/selector and assert the expiry violation survives. - Parse expires into a normalized Y-M-D and compare on (year, month, day) tuples, or strictly validate ISO-8601 (4-2-2 zero-padded digits). Currently lexical '2026-7-1' > '2026-07-25' bypasses expiry and silently re-enables a false-confidence gate that the PR purports to close.
- today_date_string_is_valid_iso_format only checks length, two dash positions, and one ordering against 2020; it cannot catch wrong calendar conversion, off-by-one in Hinnant's algorithm, or month/day range errors. Add digit-class assertions on the 8 digit chars and known boundary dates (e.g. 2000-02-29, 2100-03-01, 1970-01-01) computed from a fixed epoch input.
- Today-date route fails open on a pre-epoch clock:
duration_since(UNIX_EPOCH).unwrap_or(0)collapses SystemTimeError to 1970-01-01, so a misconfigured host silently makes expired entries appear valid. Replace unwrap_or with map+or_else that returns a violation-bearing date (or surfaces an error to the report). - Validate
expiresis canonicalYYYY-MM-DD(or parse to a normalized date) before the lexicalexpires < todaycomparison so non-padded entries like2026-7-1cannot evade expiry enforcement. Today the only guards are non-empty and non-TODO, which is exactly the false-confidence shape-vs-substance pattern #2344 names. - Expiry gate does raw string compare on expires with only a TODO/empty guard. Unpadded or malformed dates like '2026-7-1' or '2026/07/01' sort lexically and evade enforcement despite being expired. Either parse expires as a real date (validate YYYY-MM-DD, reject malformed) or reject any non-conforming value as its own violation. Smallest fix: parse-and-validate before the compare.
- expired_entry_is_flagged_by_evaluation is tautological: it passes an empty findings list, so an expired entry that would otherwise suppress a current panic is never exercised. Add a matching finding (path/family/selector) and assert the expiry violation still surfaces — otherwise the test does not discriminate the expiry contract from a no-op.
Confirmed findings
- CodeRabbit flagged duration_since(UNIX_EPOCH).unwrap_or(0) collapses pre-epoch clock to 1970-01-01; route uses unwrap_or(0) so a misconfigured clock manufactures a 'today' that may bypass expiry.
- CodeRabbit seeded-thread objection: expires compared as raw string after non-empty/TODO check only — malformed dates like '2026-7-1' bypass via lexical ordering. String compare is the architectural choice; needs hardened parser or reject-malformed policy.
- String-lexical comparison of expires vs today is exploitable via unpadded dates like 2026-7-1 that sort after 2026-07-25, bypassing expiry enforcement. CodeRabbit flagged this; not a security primitive but a policy bypass.
- duration_since(UNIX_EPOCH).unwrap_or(0) collapses a pre-epoch / clock-bad state to 1970-01-01, hiding all expired exceptions behind a manufactured date. CodeRabbit flagged. Build-time DoS/gate-bypass only, not a runtime security primitive.
Verification questions
[review body truncated; see review artifacts]
[review body truncated; see review artifacts]
589d7b2 to
cf86e4d
Compare
cf86e4d to
fb672c2
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@xtask/src/no_panic.rs`:
- Around line 1321-1334: Update is_valid_iso_date to validate the day against
the actual month length, including leap-year handling for February, so dates
such as non-leap-year February 29 and April 31 are rejected while valid leap-day
dates are accepted. Add focused cases covering those invalid and valid dates.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 76f761e7-37b9-49be-9349-fc1c44ed25e1
📒 Files selected for processing (3)
policy/no-panic-allowlist.tomlxtask/src/no_panic.rsxtask/src/no_panic/tests.rs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
EffortlessMetrics/ripr(auto-detected)EffortlessMetrics/em-ci(auto-detected)EffortlessMetrics/unsafe-review(auto-detected)EffortlessMetrics/perl-lsp(auto-detected)EffortlessMetrics/ub-review(auto-detected)
…past their expiry date (#2344) The schema 0.3 expires field was validated as present-and-non-empty but never compared to the current date. An entry with expires = "2020-01-01" passed indefinitely. The burn-down contract the schema promised was decorative. Fix: added a date comparison in evaluate_semantic_no_panic_policy. Each V2 entry's expires date is compared to today (computed via a self-contained civil-calendar algorithm, no external date crate). Expired entries produce a violation: 'expired no-panic exception: <id> expired <date> (today is <date>); renew, remove, or roll forward.' Renewed 32 expired entries (all had expires = 2026-07-01, 24 days past) to 2026-12-31, matching the existing non-expired entries' pattern. Added two tests: - today_date_string_is_valid_iso_format: verifies the date computation. - expired_entry_is_flagged_by_evaluation: verifies an expired entry produces an expiry violation in the evaluation report.
fb672c2 to
9328346
Compare
What
Enforces the
expiresfield inpolicy/no-panic-allowlist.toml: entries past their expiry date now produce a gate violation. Previously the field was validated as present-and-non-empty but never compared to the current date — the burn-down contract was decorative.Closes #2344 (the original false-confidence-gate finding that started the family analysis).
Change
Gate logic (
xtask/src/no_panic.rs)Added expiry enforcement in
evaluate_semantic_no_panic_policy: each V2 entry'sexpiresdate is compared to today (computed via a self-contained civil-calendar algorithm — no external date crate dependency). Expired entries produce:Two new helpers:
today_date_string()— today asYYYY-MM-DD, usingstd::time::SystemTime+ the Howard Hinnant civil-calendar algorithm.entry_id_or_path()— short label preferring the stableid.Allowlist renewal (
policy/no-panic-allowlist.toml)Renewed 32 expired entries (all had
expires = "2026-07-01", 24 days past) to2026-12-31, matching the existing non-expired entries' pattern.Tests (
xtask/src/no_panic/tests.rs)today_date_string_is_valid_iso_format— verifies the date computation isYYYY-MM-DDand sorts correctly.expired_entry_is_flagged_by_evaluation— verifies a2020-01-01entry produces an expiry violation.3 files changed, +130/−32.
Proof
Before the fix: the gate passed silently with 32 expired entries.
After: the gate catches expired entries and the renewed allowlist passes clean.
Scope
Why this PR matters
This is the original #2344 finding that started the false-confidence-gate family analysis. The
expiresfield was the first instance of "a gate that validates shape but not substance." Closing it closes the loop on the finding that motivated the entire family investigation.Related