← Back to Pull requests

Return proper 4xx API responses on auth issues #285

Closed
unknown closed this pull request without merging on Mar 06, 2026 17:40 UTC
View on GitHub
unknown unknown commented on Mar 06, 2026 01:46 UTC
Author

<!--
Thanks for opening a PR! Please delete any sections that don't apply.
-->

Description

<!--
A concise explanation of the change. You may include:

  • Motivation: why this change is needed

  • What changed: key implementation details

  • Related issues: e.g., Fixes #123

  • -->

    Originally I had preemptively decided on returning 404s instead of actual auth errors to prevent resource leakage. I'm walking back on this decision for a few reasons now:
    1. This is very confusing UX when someone can view a resource, and when they try to modify it, they get 404s.
    - Similar to this, if I can view a resource now and in the future can't (due to authz), it would be confusing to see a 404 as I would believe the resource no longer exists, instead of the real issue: lack of permissions.

    Actually, that's just one reason, but still important.

    While the leakage prevention makes sense in public registries where any non-authenticated user can peruse, we currently do not have authn implemented that would warrant this precaution.

    If we ever truly need or want resource leak protection, we can later expand on this (e.g. adding an AppOption to prevent resource existence leakage and checking it to decide on the API's return). In the meantime, we should keep this simple and straightforward.

    Change Type

    /kind fix
    

    Changelog

    <!--
    Provide the exact line to appear in release notes for the chosen changelog type.

    If no, just write "NONE" in the release-note block below.
    If yes, a release note is required:
    -->

    ``release-note
    Return proper API responses due to auth issues (4XX).
    ``

    Additional Notes

    <!--
    Any extra context or edge cases for reviewers.
    -->

    Diff: 216 lines (+162 / -54) across 2 files Reviewer: inFocus7 Review duration: 954m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.60) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.60 · 216 lines diff across 2 files
    0.60
    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%
    56%
    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.322
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.060
    Real PR Conversation Timeline
    1 comments
    "Review active on #285"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed sensitive_module
    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: 59.8% (MEDIUM) · Higher = larger blast radius
    59.8%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 25.9% · Safe to merge
    25.9%