Skip to main content
QueryContext lets you check what operations would be permitted by a capability set without actually applying the sandbox. This is useful for validation, testing, and building permission-checking UIs.

Constructor

Create a query context from a capability set.
CapabilitySet
required
The capability set to query against.
The context captures a snapshot of the capabilities at creation time. Changes to the original CapabilitySet after creating the context are not reflected.

Methods

query_path

Check if a path operation would be permitted.
str
required
Path to check.
AccessMode
required
Requested access mode.
Returns: Dictionary with query result.

Allowed Result

When the operation would be permitted:

Denied Results

When the operation would be blocked: Path not granted:
Insufficient access level:

Example


query_network

Check if network access would be permitted. Returns: Dictionary with query result.

Allowed Result

Denied Result

Example

Use Cases

Configuration Validation

Validate a capability configuration before deployment:

Permission Checking UI

Build an interactive permission checker:

Testing Capability Sets

Write tests for your sandbox configuration: