Inspector
See why a decision came out the way it did, compare subjects across permissions, replay an audit trail and simulate a change, in a window, in the terminal or in the browser.
strig-inspect is built on Engine::explain, which Rust and JavaScript can also call directly. Ask why Ben cannot view the secret document in the example scenario:
strig-inspect explain --scenario crates/strig-inspect/examples/scenario.json \
--subject ben --permission document.view --resource secret
DENIED — ben asks document.view on document:secret → project:roadmap → org:acme → global
reason: grant no-secret (document.view, step 0) chosen by strategy most_specific
permissions that grant: document.view, project.view
effective roles: member
override resource_owner: abstained
grants (5):
+ members-view allow project.view → role member on org [step 2]
candidate
- editors-edit allow project.edit → relation editor on project
permission not related
★ no-secret deny document.view → any subject on document:secret [step 0]
candidate
- pro-export allow document.export → role member on org
permission not related
- no-invoice-export deny document.invoice.export → role member on doc_type:invoice
permission not related
The star marks the grant that decided. + is a candidate that applied, - a grant that did not and why.
Install#
The crate is not on crates.io and is outside the workspace default-members. Install it from a clone:
cargo install --path crates/strig-inspect # window and terminal commands
cargo install --path crates/strig-inspect --no-default-features # terminal commands only, no gpui
Commands#
strig-inspect --scenario scenario.json --audit trail.jsonl # window
strig-inspect --scenario scenario.json --subject ben --permission document.export --resource invoice-7 \
--disable pro-export --tab matrix # window opened on a selection and tab
strig-inspect matrix --scenario scenario.json --resource secret --disable no-secret --add grant.json
strig-inspect audit --audit trail.jsonl --scenario scenario.json
strig-inspect fmt [--check] <file|dir>
A scenario is a JSON file with the policy (spec, an EngineSpec), the data (grants, tuples, env) and the named subjects and resources to examine. The example in crates/strig-inspect/examples/ comes with a forensic trail of six decisions, audit.jsonl, generated by:
cargo run -p strig-inspect --no-default-features --example trail -- \
crates/strig-inspect/examples/scenario.json > crates/strig-inspect/examples/audit.jsonl
The three tabs#
- Evaluation: pick a subject, permission and resource and see the decision, the reason, the resource path with the deciding step, the effective roles, each override, and why each grant did or did not apply, with its condition tree and the resolved values.
- Matrix: every catalog permission for every subject on one resource. Click a cell to open its trace.
- Audit: reads a JSON Lines trail, checks the hash chain of the
forensicrecords, shows the recorded trace and re-evaluatesdetailedandforensicdecisions against the current policy, flagging the ones that would change. See Audit.
Simulation works across the tabs. Turn grants off or on, or add some with --add, and see whether the set would allow the access. When a decision changes, the original is shown next to it, and changed matrix cells are marked.
Files reload when they change on disk. The window follows the system light or dark appearance and embeds its fonts and icons, so it looks the same on any machine. The interface is in English.
In the browser#
The playground also hosts the inspector: strig-playground.vercel.app/inspector.html. It has the same three tabs and the same simulation, over the engine compiled to WebAssembly, so there is nothing to install. It reads the same scenario JSON, from a file, a paste or the built-in example.
In the Audit tab it verifies the forensic chain with verifyAuditChain. The page follows the light or dark scheme and works from 360 px wide. The scenario and the trail are read in the page and never leave the browser. To run it locally, see playground/README.md in the repository.
Where to go next#
- The same question from code:
why_notin Why not. - Check a decision in a test: Testing a policy.