Post

RAG Access Control with Attribute-Based Authorization

RAG Access Control with Attribute-Based Authorization

Role-based controls are often too coarse for retrieval systems. Two users with the same role may still require different document visibility based on region, project, or data classification.

Attribute-based access control (ABAC) gives finer control at query time. It also maps well to RAG because both retrieval filters and policy decisions are metadata-driven.

Context

Problem: Coarse authorization models allow overexposure of retrieved content. Approach: Apply ABAC filters using user, resource, and environment attributes. Outcome: Retrieval results align more precisely with least-privilege requirements.

Threat model and failure modes

  • Users receiving documents outside project or regional boundaries.
  • Misconfigured role grants across sensitive knowledge domains.
  • Policy bypass during fallback retrieval paths.
  • Stale identity attributes after org changes.

Control design

  • Tag documents with owner, region, classification, and lifecycle state.
  • Inject user/session attributes from IdP claims at query time.
  • Fail closed when required attributes are missing.
  • Cache policy decisions briefly to limit stale authorization windows.
  • Log policy reason codes for every denied retrieval.

Implementation pattern

ABAC policies should run before vector similarity ranking returns candidates to the model. It is safer to reduce candidate space early than rely on output masking later.

1
2
3
4
5
6
7
{
  "subject": {"department": "finance", "region": "us", "clearance": "restricted"},
  "resource": {"classification": "restricted", "region": "us", "domain": "payroll"},
  "action": "retrieve",
  "decision": "allow"
}

Research and standards

These controls align well with guidance from OWASP Top 10 for LLM Applications, NIST AI RMF practices, and MITRE ATLAS adversarial behavior patterns.

Validation checklist

  • Test access after simulated org transfer or department change.
  • Verify denied retrievals never reach generation step.
  • Audit policy coverage for high-sensitivity document classes.
  • Check latency impact of ABAC evaluation under load.
  • Run quarterly policy review with data owners.

Takeaways

ABAC lets RAG retrieval align with real business boundaries. Least privilege becomes practical when policy uses rich identity and document attributes.

This post is licensed under CC BY 4.0 by the author.