← Back to Pull requests

Fix osps-ac-03 ruleset remediations #470

Closed
unknown closed this pull request without merging on Nov 20, 2026 19:12 UTC
View on GitHub
unknown unknown commented on Nov 20, 2026 07:59 UTC
Author

Summary

The osps-ac-03-01 (prevent force push) and osps-ac-03-02 (prevent branch deletion) remediations could never succeed. Both had two problems:

1. Invalid JSON body: a trailing comma after the rule type made every remediation fail with cannot unmarshal body: invalid character '}' looking for beginning of object key string.
2. Wrong HTTP method: they used PUT /repos/{owner}/{repo}/rulesets, but creating a repository ruleset in the GitHub API is a POST.

This removes the trailing commas and switches both to POST.

Found while following the new-contributor path discussed in #minder on Slack (applying security-baseline-level-1 with remediation on to a fresh test repo).

cc @shreyaabaranwal, who offered to review.

Testing

On a local Minder server, against a fresh public test repo with security-baseline-level-1 and remediate: "on":

  • Before: both rules failed, and remediation errored with the unmarshal error above.

  • After: both remediations succeeded and created the active rulesets "OSPS-AC-03.01: Prevent force push to default branch" and "OSPS-AC-03.02: Prevent deletion of default branch". On re-evaluation, both rules (and osps-qa-01-02) pass, and no duplicate rulesets are created.

  • mindev test security-baseline passes, and mindev ruletype lint passes.
  • One thing I noticed but have not changed: on one re-evaluation right after the rulesets were created, osps-ac-03-01 still failed once (the next evaluation passed). Remediation then tried to create the ruleset again, and GitHub rejected it with Name must be unique, so no duplicate was created. This looks like a short delay before a new ruleset appears in GET /rules/branches/{branch}, but I could not confirm the cause.

    Diff: 219 lines (+164 / -55) across 2 files Reviewer: evankanderson Review duration: 673m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 219 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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
    Diff Size diff_size
    0.323
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #470"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.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: 36.7% (MEDIUM) · Higher = larger blast radius
    36.7%
    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: 60.5% · Lower = rushed or shallow review
    60.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: 14.5% · Safe to merge
    14.5%