Context-Based Access Control (CBAC)

What is context-based access control (CBAC)?

Context-based access control (CBAC) is an access model that decides what each user, application or AI agent can see based on the context of the request: who is asking, for what task, under which policy and how sensitive the data is. Instead of relying only on a fixed role, CBAC checks every request at runtime.

For example, a support rep and a fraud analyst both ask the same AI assistant about one customer’s account. The assistant pulls the same records for both. The support rep sees the account history with the card number and income details masked. The fraud analyst, working an open fraud case, sees the real card number. Same data, same tool, different task, different view.

How CBAC works

  • Request context. The application passes who is asking, their role, the AI agent or tool involved and the task, together with an auth key.
  • Data sensitivity. The content is classified. Some data is entity-based (names, account numbers, PHI). Some is context-based and has no fixed pattern, such as pricing terms, fraud signals or legal strategy.
  • Policy check. The request is compared with policy that was defined once, centrally.
  • Result. Allowed values are revealed. Everything else stays masked, or text that is sensitive as a whole is rewritten so the meaning stays without the detail.
  • Record. Each access decision is logged for audit.

CBAC vs RBAC vs ABAC

RBAC ABAC CBAC
Decides based on The user’s role Attributes of the user, resource and environment The request context, including task and content sensitivity
Unit of control System, dataset or file Record or file, by rule Individual values inside the content
When access is not allowed The file or system stays closed The file or record stays closed Sensitive values stay masked; the rest is usable

Why CBAC matters for AI systems

User access is not task access. An AI assistant connected to SharePoint, a CRM and a ticketing system can pull a dozen documents into one prompt. Role checks on each source answer whether the user may open a file. They do not answer which values inside it should reach the model for this task.

Closing whole documents stops the task. Passing everything exposes data the task never needed. CBAC sits between the two: content flows to the model, sensitive parts stay masked, and real values appear only where policy allows. The same check applies to RAG retrieval, MCP tool calls and AI agent memory.

How Protecto helps

Protecto’s CBAC checks each request against the user, role, task and policy at runtime. Sensitive values stay masked as tokens for anyone the policy does not cover, and real values are revealed only to the roles and tools the policy names. CBAC also rewrites text that is sensitive as a whole, such as deal terms, so the model keeps the meaning without the detail. Every access decision is logged. See Context-Based Access Control for AI.

Frequently asked questions

What is the difference between RBAC and CBAC?

RBAC grants access by role, so everyone in a role sees the same data. CBAC also looks at the task and the sensitivity of the content, so two people in the same role can see different values. Read more in RBAC vs CBAC.

Does CBAC replace identity and access management?

No. CBAC uses the identities and roles your existing systems already manage. It adds a decision about which values inside the data each request may see.

Does Protecto work with Active Directory or Okta?

Yes, through Privacy Gateway. You keep each user’s masking and unmasking access in AD or Okta groups, and Gateway issues a Protecto auth key with that access at login. If you use Protecto Vault directly, it’s a headless API, so your team can build the integration around it.

Related terms

Role-based access control (RBAC) · Attribute-based access control (ABAC) · Least privilege access · Controlled unmasking · AI agent

Book a demo

See Protecto on your own data

Book a demo to see how Protecto finds and masks sensitive data before it reaches any AI model.

New: Protecto now runs inside LiteLLM. Control what sensitive data your models and tools see.
Read the launch blog