# What Is Security Context?

> This guide explains security context, how systems use it, and how it supports autonomous investigation within enforceable boundaries.

- Canonical URL: https://www.puppygraph.com/learn/security-context
- Published: 2026-12-04
- Author: Hao Wu

A valid credential does not explain whether a data read belongs to an approved task. That judgment also depends on the requester, the resource, the action, and the conditions surrounding it. For an AI agent investigating suspicious access, those facts determine both what it should investigate and what it may access itself.

This guide explains security context, how systems use it, and how it supports autonomous investigation within enforceable boundaries.

## What Is Security Context?

Security context is the security-relevant information associated with a user, workload, session, or operation. It helps a system evaluate access and helps investigators interpret activity. Depending on the system, it includes identity, delegated authority, resource sensitivity, device state, and recent behavior.

In attribute-based access control, these facts become inputs to a decision. [NIST SP 800-162](https://csrc.nist.gov/pubs/sp/800/162/upd2/final) describes evaluating attributes of the subject, object, operation, and environment against applicable rules.

The term also has narrower platform meanings. Kubernetes uses [`securityContext`](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/) for Pod and container settings such as user IDs, Linux capabilities, and privilege controls. Here, the focus is the broader information used in access decisions and investigations.

## Why Security Context Matters

Consider `billing-exporter`, a workload approved to export `invoices-curated`. A successful login establishes an identity, but does not show whether that workload also read payroll records or inherited a broader role than its task required.

An investigator needs to connect the approved task, role assignments, delegation chains, dataset classifications, and read events. Each answers a different question: what was intended, what was possible, and what happened.

For an AI agent, those connections support the next investigative step. Finding a broad permission should prompt a check for actual use; finding an unexpected read should prompt a trace of the authority behind it.

## Key Components of Security Context

**Identity and delegation.** Record the human or workload making the request, the authenticated session, and any authority delegated to it. For an agent acting for a user, retain both identities so downstream services can evaluate the correct scope.

**Resource and action.** Identify the target dataset, its tenant and classification, and the requested operation. Reading approved invoice fields and exporting an entire payroll table require different decisions.

**Environment and task.** Relevant conditions can include device posture, network origin, time, token expiry, and an approved task identifier. Bind task scope to a trusted workflow record; an agent's description of its purpose is insufficient evidence of authorization.

**Provenance and freshness.** Preserve where each fact came from and when it was observed. A cached role assignment and a current revocation event should not silently become one apparently current account state.

## How Security Context Works

An access-control flow assembles context, evaluates policy, and enforces the result. [NIST's zero-trust architecture](https://csrc.nist.gov/pubs/sp/800/207/final) distinguishes the policy decision components from the policy enforcement point that controls access to resources.

1.  **Collect and validate.** Authenticate the requester and retrieve relevant attributes from trusted identity, asset, and data systems. Validate token signatures, issuer, audience, and expiry.
2.  **Evaluate.** Apply policy to the requested action and resource. Define how missing, stale, or contradictory attributes affect the decision.
3.  **Enforce.** The API, gateway, or data service allows or rejects the operation, or requires an additional condition such as stronger authentication.
4.  **Record and reassess.** Retain the decision and supporting evidence. Reevaluate when credentials expire, permissions change, or another sensitive operation begins.

![Security context supports access decisions and investigations, while each evidence query remains subject to the investigator agent's own authorization.](https://o6xswp5m6ilbks2z.public.blob.vercel-storage.com/uploads/ab8e18ef4ebebeddc0b3152c/ab5465e1-81fd-4f48-87d1-97fcb2b20a7d/security-context-figure-1-c7b738473c.png)

Figure: Security context supports access decisions and investigations, while each evidence query remains subject to the investigator agent's own authorization.

For `billing-exporter`, an invoice read and a payroll read are separate requests, even if they use the same credential.

## Security Context in AI Agents

An investigator agent should be able to pursue a business question such as whether an export workload exceeded its approved task. It can inspect observed reads, test a legitimate-export explanation, trace unexpected datasets through delegated roles, and choose its next query from the results. The user need not prescribe every join or investigation step.

Two security contexts remain distinct: the workload being investigated and the agent performing the investigation. Access to evidence about payroll permissions does not automatically authorize the agent to retrieve payroll contents.

Enforce that distinction outside the model. [OWASP's excessive-agency guidance](https://genai.owasp.org/llmrisk/llm062025-excessive-agency/) recommends limiting tool functionality and permissions and executing actions within the user's authorization scope. Retrieved documents can contain hostile instructions; treating their text as data and checking every tool call limits what those instructions can cause. Permission changes and credential revocation need separately authorized actions.

## Security Context vs Security Policies

Context supplies facts for a decision. Policy specifies how those facts affect permitted behavior.

| **Dimension** | **Security context** | **Security policy** |
| --- | --- | --- |
| Example | The workload requests payroll data under an invoice-export task | Invoice-export tasks may read only approved datasets |
| Source | Identity systems, task records, catalogs, telemetry | Rules maintained by security and resource owners |
| Change | A session expires or a role assignment changes | An owner revises the allowed operations |
| Failure mode | Stale, missing, or incorrectly attributed evidence | Overbroad permissions or conflicting rules |

Accurate context cannot compensate for a rule that permits excessive access. A carefully written policy also fails if the system supplies the wrong identity or resource classification.

## Security Context in Enterprise Systems

Identity providers establish principals; applications and data services enforce permissions; catalogs describe resources; audit systems record activity. An investigation crosses these boundaries, so stable identifiers and explicit relationships matter as much as collecting more logs.

Agents also need quick responses because each result determines the next hypothesis. As organizations add systems and retain more history, the investigation must span many tables and large datasets without requiring every table definition in the prompt. Querying existing storage avoids introducing another persistent copy of sensitive evidence, although source ingestion and freshness still require attention.

For this investigation, [PuppyGraph](https://www.puppygraph.com/) lets an agent follow identities, delegated roles, and activity across existing tables. It is a data engine for building AI agents, with a graph model that exposes entities and relationships across 3,000 tables so the agent can discover relevant paths as its investigation develops.

PuppyGraph queries SQL databases, warehouses, and lakehouses in place, including direct reads of Iceberg and Delta Lake, with no data movement into a separate graph database. Its [distributed engine](https://www.puppygraph.com/how-it-works) executes node and edge operators in parallel and scales to [petabytes of data](https://docs.puppygraph.com/#petabyte-level-scalability). It supports [subsecond graph queries on selected workloads](https://www.puppygraph.com/benchmarks), helping agents test successive hypotheses while the same tables remain available to existing SQL tools.

![PuppyGraph queries the existing tables in place, so graph and SQL queries share one copy of the data and no pipeline keeps a graph copy in sync.](https://o6xswp5m6ilbks2z.public.blob.vercel-storage.com/uploads/ab8e18ef4ebebeddc0b3152c/ef1496f9-cf08-4b8b-933c-8baac5450baa/snowflake-zero-copy-clone-figure-2-0777fe67cc.png)

Figure: PuppyGraph queries the existing tables in place, so graph and SQL queries share one copy of the data and no pipeline keeps a graph copy in sync.

The built-in [AI assistant](https://docs.puppygraph.com/ai/puppygraph-ai/) proposes the graph model for approval and explores it with openCypher queries; Gremlin is also supported. Customer-built agents can connect through the [open-source MCP server](https://docs.puppygraph.com/ai/ai-integrations/). With [strict schema validation](https://docs.puppygraph.com/querying/querying-using-opencypher/#strict-schema-validation) enabled, openCypher rejects undefined model references before execution and returns feedback for correction. Configured [row-level security](https://docs.puppygraph.com/security/row-level-security/) filters intermediate traversal steps as well as results. Model-building source reads need separate access controls.

Policy services and resource owners remain responsible for authorization rules and remediation. [Sola Security](https://www.puppygraph.com/case-studies/sola-security-iceberg-ai-security-context) uses PuppyGraph over Iceberg to let agents investigate relationships among identities, cloud resources, and security findings.

We tested this investigation on synthetic workload, role, dataset, and read-event tables. After connecting the catalog and configuring an LLM API key, we asked the assistant to build the model and approved its proposal.

![Modeled permission paths and observed read events share entity identifiers, allowing the investigation to compare possible access with recorded activity.](https://o6xswp5m6ilbks2z.public.blob.vercel-storage.com/uploads/ab8e18ef4ebebeddc0b3152c/088f36f1-af53-4b60-8b8c-62903ea60d3f/security-context-figure-3-1f404ba33e.png)

Figure: Modeled permission paths and observed read events share entity identifiers, allowing the investigation to compare possible access with recorded activity.

Given the task of investigating whether `billing-exporter` stayed within its approved scope, the assistant inspected that scope, followed delegated roles, examined read events, and checked whether the observed reads matched modeled grants. This verification query identifies its restricted-data reach:

```cypher
MATCH p = (w:Workload {name: 'billing-exporter'})
          -[:HAS_ROLE|CAN_ASSUME*1..5]->(r:Role)
          -[:CAN_READ]->(d:Dataset)
WHERE d.classification = 'restricted'
RETURN d.name AS dataset, length(p) - 1 AS role_hops
ORDER BY dataset
```

![Three restricted datasets are reachable in the modeled permission snapshot; a separate check of read events establishes which were actually used.](https://o6xswp5m6ilbks2z.public.blob.vercel-storage.com/uploads/ab8e18ef4ebebeddc0b3152c/84e87374-5589-4218-b885-9cbe6b844c3b/security-context-figure-4-e40a90f9eb.png)

Figure: Three restricted datasets are reachable in the modeled permission snapshot; a separate check of read events establishes which were actually used.

The verified results identify `customer-pii`, `payroll-detail`, and `tax-archive`. Read events show successful access to the first two, outside the workload's approved `invoices-curated` task. No read of `tax-archive` by this workload appears in the data. The evidence supports reviewing the delegation from `billing-runner` to `finance-ops`; it does not establish malicious intent or replace a complete IAM evaluation.

![PuppyGraph customer logos under the heading Trusted by.](https://o6xswp5m6ilbks2z.public.blob.vercel-storage.com/uploads/ab8e18ef4ebebeddc0b3152c/4b17a9ad-9bbb-4dba-b342-1ebf59630ba0/snowflake-zero-copy-clone-figure-3-070c58edc4.png)

![PuppyGraph customer testimonials from Trend Micro, Palo Alto Networks, Sola Security, Netskope, Coinbase, and Baker Hughes.](https://o6xswp5m6ilbks2z.public.blob.vercel-storage.com/uploads/ab8e18ef4ebebeddc0b3152c/8f2946c8-ecd0-4f10-adcb-cb2c9c6ca379/snowflake-zero-copy-clone-figure-4-65c2a94de2.png)

## Benefits of Security Context for AI and Data Security

**More precise access decisions.** Resource sensitivity and task scope let a policy distinguish operations that share the same user or role.

**Useful autonomy within bounds.** An agent can choose which lead to follow while the execution system limits which evidence it may retrieve and which actions it may take.

**Explainable investigations.** Connecting permissions to observed reads gives reviewers a traceable basis for prioritizing a finding. A broad grant with no observed use and an unexpected successful read deserve different follow-up, even when both require remediation.

## Security Context Use Cases

**Adaptive access.** A service can require stronger authentication for a sensitive export when device posture or session conditions change. The policy defines the response; context provides the conditions.

**Agent tool authorization.** A support agent may read a customer's ticket history while a separate control checks its authority to issue a refund. Carrying and [enforcing the customer, user, and task scope](https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html#validate-the-permissions-on-every-request) through both operations prevents the service account's broader permissions from determining what the agent may do.

**Incident investigation.** A security agent can follow a suspicious workload through delegated roles to sensitive resources, then inspect activity and compare it with approved work. This identifies evidence to review without assuming that every reachable resource was accessed.

## Challenges of Implementing Security Context

**Identity resolution and time.** Similar names across accounts can refer to different principals. Current permissions may also differ from permissions at the time of an event. Use scoped identifiers and preserve historical validity where the investigation needs it.

**Incomplete evidence.** A modeled access path may omit explicit denies, session restrictions, or network conditions. Missing read events can reflect collection gaps. State what the model and observation window cover before concluding that access was possible or unused.

**Sensitive context.** Entitlement records and relationship maps can reveal confidential information even when raw data stays hidden. Restrict the evidence returned to agents, control retention, and review what goes to an external model provider.

## Best Practices for Managing Security Context

Define the decisions and investigations you need before gathering attributes. Assign an authoritative source and freshness expectation to each field, including identity, tenant, task scope, and classification.

Use short-lived credentials and narrow tool permissions. Carry the initiating user's identity through delegated requests and check authorization at each service boundary. In relationship queries, protect intermediate records as well as final results.

Test failure cases: revoked roles, expired tokens, missing entitlements, cross-tenant identifiers, stale caches, and an agent requesting data outside its task. Verify the deployed configuration rather than assuming that a security feature is active everywhere.

Retain enough evidence to reproduce a decision: relevant context, policy version, queried records, and observed timestamps. Require an investigator to distinguish a supported finding from a hypothesis that needs more data.

Try the forever-free [PuppyGraph Developer Edition](https://www.puppygraph.com/download-confirmation) and [book a demo](https://www.puppygraph.com/book-demo) with the team to see how openCypher and Gremlin queries connect warehouse and lakehouse tables, with no graph-specific ETL, so agents can trace security evidence across identities, permissions, and activity.
