QueryContext class allows you to query whether filesystem or network operations would be permitted by a given capability set. This is useful for:
- Testing your sandbox configuration before applying it
- Debugging permission issues
- Building tools that preview sandbox effects
Constructor
CapabilitySet
required
The capability set to query against.
Methods
queryPath
string
required
The path to check access for.
AccessMode
required
The access mode to check:
Read, Write, or ReadWrite.QueryResultInfo
Result object describing whether access would be allowed or denied.
queryNetwork
QueryResultInfo
Result object describing whether network access would be allowed or denied.
QueryResultInfo
The result of a query operation.Properties
string
required
Either
"allowed" or "denied".string
required
The reason for the result. Possible values:For allowed results:
"granted_path"— Access granted by a filesystem capability"network_allowed"— Network access is not blocked
"path_not_granted"— No capability covers this path"insufficient_access"— Path is covered but with insufficient permissions"network_blocked"— Network access has been blocked
string | undefined
For
granted_path results, the path of the capability that grants access.string | undefined
For
granted_path results, the access level of the granting capability.string | undefined
For
insufficient_access results, the access level that was granted.string | undefined
For
insufficient_access results, the access level that was requested.