← Back to Pull requests

B93: range-check PasswordRecord.iterations when decoding #76

Merged
Timdebruijn merged 4 files (36 lines) on Oct 29, 2026 11:27 UTC
View on GitHub
Timdebruijn Timdebruijn commented on Oct 29, 2026 11:13 UTC
Author

Problem


A hand-edited PasswordRecord.iterations of 0, a negative count or one above UInt32.max trapped in RoleAuth.pbkdf2 (UInt32(iterations)) at the next login or verify of that role; a huge count in range stalled its logins.

Fix


  • PasswordRecord gets a decoder that accepts only 1...maxIterations (10 000 000: about 16x the default 600 000 and about 1.6 s per PBKDF2 run, measured on this Mac). A record outside it throws, so MachineSettings marks passwords unreadable, the same path as any other record that does not decode (B82): logged as a field problem at start, and a running engine keeps its copy in memory when a write re-reads the file.

  • One parametrized test with a case per rejected class: 0, -1, UInt32.max + 1, maxIterations + 1.

  • BACKLOG B93 done, CHANGELOG bullet.
  • Verified


  • scripts/test.sh --filter RoleAuth: 13 tests passed (the new one with 4 cases).

  • scripts/test.sh: 274 engine tests in 39 suites and 231 in 32 suites passed. The first full run had one failure in SyncReceiverTests.aSendersClockArrives (packetsIn 2, expected 1) at load average ~21, which this change does not touch; the re-run was green.
  • Note: as for any undecodable record, unreadable passwords at engine start means the engine starts with no role passwords (every role open, with an error in the log); this change does not alter that.

    Diff: 36 lines (+35 / -1) across 4 files Reviewer: copilot-pull-request-reviewer[bot] Review duration: 14m
    All Vouch review confidence checks passed
    Residual risk 0.13 = Change Risk (0.29) × (1 − Review Confidence (0.54)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.29 · 36 lines diff across 4 files
    0.29
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    54%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.216
    Real PR Conversation Timeline
    2 items
    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 29, 2026 11:13 UTC
    Reviewer

    Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

    Assignees
    Timdebruijn Timdebruijn
    Labels
    risk: low confidence: 54.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 29.0% (LOW) · Higher = larger blast radius
    29.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 54.2% · Lower = rushed or shallow review
    54.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 13.3% · Safe to merge
    13.3%