@vensofts-integration-testkit/authz-cli
v0.1.4
Published
Command-line interface for the Authorization Contract SDK: init, validate, plan, run, explain, doctor.
Maintainers
Readme
@vensofts-integration-testkit/authz-cli
Test your API's authorization against a written contract. You describe who may do what (roles,
tenants, grants, states) in a small contract; authz turns it into allow/deny/forbid cases, runs
them against your real HTTP app, and tells you exactly which request leaked data or refused a
legitimate user. MIT.
Part of the NodeSDK Authorization Contract SDK. Node.js 22 or newer.
Install
npm install --save-dev @vensofts-integration-testkit/authz-cli @vensofts-integration-testkit/authz-coreQuick start
npx authz init # writes contract.mjs and authz.config.mjs (never overwrites without --force)
npx authz validate # checks the contract, world and bindings
npx authz plan # compiles the cases and shows how many obligations they cover
npx authz run # runs every case against your app and writes a JSON reportinit creates a working example you edit for your app:
contract.mjs: the rules, e.g. "members of a tenant may read its notes".authz.config.mjs:- the world: the test users and records that exist in your test database;
- the bindings: which HTTP request performs each operation, such as
GET /notes/{resource.id}; - the runtime: where your app runs and how each test user logs in.
$ npx authz plan
plan sha256:fd2d1253…
cases 3, obligations declared 8, runnable 8, unsatisfied 0Ask why a decision comes out the way it does:
$ npx authz explain --operation note.read --actor outsider --resource note1
decision: DENY (default-deny)
rule members-read [allow] not matched
✗ all
✗ sameTenant — resource.tenant=org-1
✓ actorState — actor.state=activeCommands
| Command | What it does |
| ------------------------------------------------- | ------------------------------------------------------------------------------- |
| init | Create a small, compilable config and sample contract |
| validate | Validate the contract, world and bindings |
| plan [--out plan.json] | Compile the obligations and print how many are runnable |
| run [--format …] [--out-dir dir] | Execute the plan against your app and write reports |
| explain --operation --actor --resource [--time] | Explain one decision rule by rule |
| inventory --openapi api.json | List API operations that have no binding yet |
| doctor | Check Node, configuration, app reachability, identity controls and license |
| sensitivity (Pro) | Find blind spots: contract mistakes your current test data cannot detect |
| review --base <module> (Pro) | Show the concrete allow/deny changes of a contract edit; check an approval file |
Global options: --config <file> (default authz.config.mjs), --json for machine-readable output
and errors, --help.
Every deny case is paired with an identity control (the user really is logged in) and an allow control (the same user succeeds on a request they are allowed to make), so a broken login can never pass as "access denied".
In CI
npx authz run --out-dir reportsExit codes: 0 pass, 1 violation, 2 invalid configuration, 3 unresolved obligations,
4 environment or budget, 5 unlicensed. A plan that cannot run all its obligations never passes.
Free and Pro
Everything above is free, including run with JSON reports. A NodeSDK Pro license adds:
- Reports:
run --format json,html,junit,sarif,mdwrites an accessible HTML report, JUnit for test dashboards, SARIF for GitHub code scanning and a Markdown job summary. - Lifecycle scenarios: revoked grants, role downgrades, suspensions, tenant moves and stale sessions.
sensitivityandreview(see the table above).
The Pro features are in @vensofts-integration-testkit/authz-pro,
whose page shows more screenshots from a real run.

Install it next to the CLI and pass your license with --license license.json or
license: { file: 'license.json' } in the config. Without a license, Pro options stop with exit code
5 before any work starts; they never silently run a smaller test.
Pricing: a free 14-day trial, then USD 299 per year per organization; see the price table. Email [email protected] to buy a license or ask a question.
