← Back to Pull requests

feat: send X-Amz-X509-Chain and derive AccountID from the ARN #36

Closed
unknown closed this pull request without merging on Jun 29, 2026 15:51 UTC
View on GitHub
unknown unknown commented on Jun 26, 2026 15:21 UTC
Author

Add NewSignerWithChain so callers can attach intermediate CA certificates. When present, the intermediates are sent to IAM Roles Anywhere in the X-Amz-X509-Chain header (comma-delimited base64 DER, capped at the 5-cert limit) and included in the canonical request's signed headers. This lets the end-entity (leaf) certificate validate against a trust anchor registered higher in the chain (e.g. the root) instead of requiring the anchor to be the immediate issuer. Wires up the previously-unused x_amz_x509_chain constant.

Also fix CredentialProvider.Retrieve setting aws.Credentials.AccountID to the full assumed-role ARN. It now extracts the account ID from the ARN, so the AWS SDK's account-based endpoint routing (e.g. DynamoDB) resolves correctly instead of failing with "Credentials-sourced account ID parameter is invalid".

The NewSigner API and the no-chain canonical request are unchanged (byte-identical), so this is backwards compatible; scope remains ECDSA-only.

  • signer.go: add Signer.chain, NewSignerWithChain, chainHeader(), maxX509ChainDepth

  • signer_aws.go: include x-amz-x509-chain in the canonical request when present

  • credential_provider.go: accountIDFromARN parses the account ID from the ARN

  • tests: chain construction, chain-depth limit, ARN parsing
  • Diff: 161 lines (+120 / -41) across 2 files Reviewer: lrascao Review duration: 4349m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.35) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 161 lines diff across 2 files
    0.35
    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.304
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #36"
    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: 34.9% (LOW) · Higher = larger blast radius
    34.9%
    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: 13.8% · Safe to merge
    13.8%