PermDock
CLI

explain

Show which grants decide an action for each fixture subject, with the deny that won and the grants passed over.

permdock explain <action> decides every fixture for one permission key with explain: true and prints the trace: the grant that granted or asked for approval, the denial reasons, every deny that matched and each grant passed over with the reason. It reads the same fixtures as rls verify and diff --impact, and changes nothing.

Usage

permdock explain post.update
permdock explain invoice.send --fixtures ./fixtures.ts --json
FlagMeaning
--policy <module>Module exporting the policy; default policy in the config
--fixtures <file>Fixtures file; default rls.fixtures in the config, else rls.fixtures.json
--jsonPrint { action, rows: [{ subject, tenant, outcome, matched, denials, evaluated, allows, denies, skipped }] }
post.read: 1 fixture(s)
u1: granted by member; 3 grant(s) evaluated
  passed over: admin allow (role)

A row adds expected when the fixture's expected differs from the outcome. A fixture for another action is not shown; an action no fixture checks prints explain: no fixture checks <action>. An action the policy does not declare exits 2 with config_invalid.

Why

can() answers yes or no, and a denial names a reason but not the grant that lost. The trace from permdock.explain() names them, and running it over the fixtures answers "why can't this user do this" without a debugger or a database. The trace never reaches a DecisionSink (decisions).

Side effects

CommandEffects
permdock explainNone

Last updated on

On this page