← Back to Pull requests

fix(jwt): overwrite converted claim headers and drop absent claims #7967

Closed
unknown closed this pull request without merging on Oct 23, 2026 03:16 UTC
View on GitHub
unknown unknown commented on Oct 22, 2026 03:04 UTC
Author

What

DefaultJwtConvertStrategy converts JWT claims into request headers. Three behaviors in that conversion are corrected:

  • It used HttpHeaders.add, which appends. If the request already carried a header with the configured headerVal, upstream received multiple values and getFirst() could return the pre-existing one instead of the claim.

  • A missing claim was written as the literal string "null".

  • Nested claim paths returned an intermediate node when the path did not match the token: user.id against {"user":"admin"} resolved to "admin".
  • Changes

  • Write claims with headers.set, so the configured header always carries exactly the claim value. Header names match case-insensitively, and multi-value headers are replaced by the single claim value.

  • When a claim is absent or explicitly null, remove the header instead of writing "null".

  • Rewrite parse to walk the claim path once. It returns null when any node is missing or is not a map. This also removes the per-level entry iteration and the AtomicInteger allocation.


  • Behavior change

  • A request header with the same name as a configured converter headerVal is now overwritten by the claim value, or removed when the claim is absent.

  • Converter paths that do not match the token structure no longer produce a header.
  • Tests

    New cases in DefaultJwtConvertStrategyTest:

  • an existing header with the same name is replaced by the claim (flat and nested)

  • mixed-case and multi-value existing headers collapse to the single claim value

  • missing and explicit-null claims remove the existing header (flat and nested)

  • a non-map intermediate node (user.id, multi.web.name) removes the header
  • Make sure that:

  • You have read the contribution guidelines.

  • You submit test cases (unit or integration tests) that back your changes.

  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.
  • Diff: 248 lines (+186 / -62) across 3 files Reviewer: Aias00 Review duration: 1452m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.62) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.62 · 248 lines diff across 3 files
    0.62
    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.330
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.062
    Real PR Conversation Timeline
    1 comments
    "Review active on #7967"
    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: 62.1% (MEDIUM) · Higher = larger blast radius
    62.1%
    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: 26.9% · Safe to merge
    26.9%
    Repository