← Back to Pull requests

Validate base64 content #131

Merged
aryan-25 merged 2 files (89 lines) on Sep 09, 2026 10:43 UTC
View on GitHub
aryan-25 aryan-25 commented on Sep 09, 2026 08:23 UTC
Author

Motivation

We currently ignore unknown characters when parsing the body of a PEM document. We should also validate whether the body forms a valid base64 encoded string.

Modifications

  • Repurposed the checkLineLengthsOfBase64EncodedString() method to also return the base64 encoded bytes with the line endings removed.

  • Updated LazyPEMDocument to now require base64 encoded bytes _without_ line endings.

  • Now that the input doesn't have any line endings, the presence of any non-base64 characters must mean that the input has invalid characters.

  • - As such, LazyPEMDocument/decode() was updated to no longer pass the .ignoreUnknownCharacters option to Data(base64Encoded:).
    - This means that when the body contains non-base64 characters, Data(base64Encoded:) returns nil (we already throw ASN1Error.invalidPEMDocument when receiving nil).

    Result

    Better validation.

    Diff: 89 lines (+69 / -20) across 2 files Reviewer: Lukasa Review duration: 139m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.31) × (1 − Review Confidence (0.48)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.31 · 89 lines diff across 2 files
    0.31
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.00 · 1 substantive comment(s)
    0.00
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    48%
    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.350
    Diff Size diff_size
    0.269
    Real PR Conversation Timeline
    2 items
    Lukasa Lukasa approved these changes on Sep 09, 2026 10:43 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    aryan-25 aryan-25
    Labels
    risk: low confidence: 48.5% 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: 31.4% (LOW) · Higher = larger blast radius
    31.4%
    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: 48.5% · Lower = rushed or shallow review
    48.5%
    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: 16.2% · Safe to merge
    16.2%