← Back to Pull requests

identity: one authorizer assembly for every policy enforcement point #839

Closed
unknown closed this pull request without merging on Nov 01, 2026 11:37 UTC
View on GitHub
unknown unknown commented on Nov 01, 2026 10:14 UTC
Author

Follow-up to #838 (merged). Rebased onto main at c5562280. Three commits: the authorizer consolidation, the two review items on the merged ingress code (bounded ingress dial; api.HasDotSegment as the single dot-segment check, backslash-aware), and a scrub of test identities to example.com personas.

Summary

The node's in-mesh verifier (verifyBiscuitTokenWithRules), the node's external ingress handler, and the control plane's /sts/token each assembled their Datalog authorizer by hand: service fact, HTTP and egress facts, replay binding, target facts and check, local attenuation, baseline policies and rules, mesh rules — three copies. They matched by discipline, not by construction, and one divergence had already crept in: the ingress path took an EnforceTargetCheck knob and skipped BaselineTargetCheck when the node had no identity, where the in-mesh path always added it.

identity.AuthorizeMeshRequest(authorizer, MeshRequest, MeshPolicy) is now the only place a mesh authorizer is assembled.

  • MeshRequest says what the request is: service(); method()/path() only when HasHTTP; host()/port() only when HasEgress; connection_peer_id() + BaselineReplayCheck only when ConnectionPeer is set; target_unrestricted only when Unrestricted. Every absent field means "not present" and fails closed.

  • MeshPolicy says what the PEP adds: its own target facts, local attenuation, synced mesh rules.

  • Always added, no knob: BaselineTargetCheck, baseline policies/rules/HTTP rules, expiration().

  • MeshRequest.TaskRequest() derives the TaskAuthorizationRule context from the same value.
  • Callers

    | PEP | Change |
    |---|---|
    | Node in-mesh (internal/node/middleware.go) | ~90 lines of inline assembly and injectIdentityFacts replaced by MeshRequest{ConnectionPeer, Unrestricted: Local, …} + n.meshPolicy() |
    | Node ingress (internal/node/ingress.go) | same n.meshPolicy(); EnforceTargetCheck removed, target check now unconditional |
    | Router edge (internal/router/ingress.go) | IngressEvalParams keeps its fields and delegates to the shared assembly |
    | Control plane /sts/token (internal/controlplane/sts.go) | MeshRequest{egress, Unrestricted, ConnectionPeer: clientPeer}; stsDestinationRules as LocalRules |

    Production code is net +27 lines (+305/−278); the rest is tests and docs.

    Tests


  • TestAuthorizeMeshRequest — 11 table cases pinning what each MeshRequest field contributes and that each fails closed when absent (HTTP-narrowed grant on a bare stream, node-scoped grant without provider target facts, replay from a different connection peer, border bearer without connection peer, local deny).

  • TestIngressEvalParamsMatchMeshRequest — runs the ingress evaluator and the shared assembly on identical inputs and requires the same decision: the structural "no leak between paths" guard.
  • Docs


  • external-ingress.md: new section "Ingress is for callers without a sidecar" — an agent on the mesh calls peers through its sidecar; the ingress URL is neither a second route for it nor one that accepts its node credential; same policy on both paths, no privilege by path choice.

  • security-architecture.md: "One authorizer assembly for every PEP".
  • Validation


    On the rebased branch: make, go vet, make lint (0 findings), -race unit tests for api, identity, node, router, controlplane, envoy, standalone, and the full tests/integration suite serially (all pass).

    Diff: 439 lines (+329 / -110) across 5 files Reviewer: aojea Review duration: 83m
    All Vouch review confidence checks passed
    Residual risk 0.29 = Change Risk (0.68) × (1 − Review Confidence (0.58)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.68 · 439 lines diff across 5 files
    0.68
    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%
    57%
    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.364
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.068
    Real PR Conversation Timeline
    1 comments
    "Review active on #839"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 58.0% 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: 68.5% (HIGH) · Higher = larger blast radius
    68.5%
    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: 58.0% · Lower = rushed or shallow review
    58.0%
    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: 28.7% · Safe to merge
    28.7%