Repository navigation
v1.21.0: shell normalization, consistent credential detection, whole-document policy adoption
LatestMINOR. The sensor normalizes shell commands and argument values before it
judges them, reads one credential table on every path a secret can leave by,
and adopts a local action policy only when the whole document is valid.
What the sensor does
Shell commands are normalized before classification. A shell command in a
tool-call argument is rewritten to the form the shell acts on: $IFS and
${IFS} read as a space, and an in-line literal variable is substituted. That
form goes through the same classifiers as the raw string. Normalization only
adds to a verdict; it never lowers one.
Command substitution is refused, not run. A $(...) or backtick
substitution is detected and never executed, evaluated or imported to find out
what it expands to. A value the sensor cannot resolve is reported as
shell_unresolved, never guessed.
Recursive forced rm is recognized however its flags are spelled: -rf,
-r -f, --recursive --force. Relative cleanup inside a project still passes.
Credential-egress detection is consistent across paths. Input, model
output, A2A messages and tool-call arguments read one secret table, so a
credential in that table gets the same verdict, under the same rule id, on
every boundary. Argument values are also read in normalized
form, with adjacent quoted literals joined and base64 or base64url runs decoded
to printable text, so a split or encoded credential gets the verdict of its
inline form. The table recognizes Anthropic, GitLab, Slack app, Stripe
restricted, Hugging Face and npm tokens alongside the shapes it already knew.
A Stripe test-mode key, and a long quoted value under a key name the table does
not list, are reported as signals and do not block.
The action-policy core adopts a policy whole or not at all.
Sensor.set_policy() parses a candidate policy in full before it changes
anything, and installs an accepted one in a single step. A refused policy
installs nothing: set_policy() returns False, the refusal is logged at
ERROR, and the policy already in force keeps enforcing. Every key in a
document is either read by the engine or the document is refused with a
reason. xaidr.authz.explain_action_policy() returns the verdict on a
document: the normalized policy, or a stable reason code and the path of the
refused part. tests/action_policy_conformance/corpus_v1.json defines what an
ActionPolicy v1 document means, and another implementation conforms when it
gives the same verdict on every case. Rules are evaluated in document order and
the first match decides.
Reporter destination URLs are never written to logs. No log record from
any logger, and nothing on stdout or stderr, carries a WebhookReporter
destination's credential. The request lines httpx logs for that destination,
and the reporter's own failure lines, name its scheme, host and port with the
credential redacted. Other httpx log records pass through unchanged.
Upgrading
A local action policy is adopted only if every key in it is one the
ActionPolicy v1 format defines. A document may carry version, defaults and
rules; a rule may carry id, effect, match, conditions and message.
Any other key, at the top level, on a rule, or under match:, conditions:
or defaults:, refuses the whole policy with an error naming the key and the
nearest valid field. So do a match:, conditions: or defaults: key with no
value, a non-finite number in a condition, a version other than 1 or
1.0, and a key that appears twice in a policy file.
When a policy is refused, the policy already in force keeps enforcing. A
policy file refused at startup leaves the sensor detection-only. Before
upgrading, pass each policy, as the dict you load, to
xaidr.authz.explain_action_policy(): a refusal comes back with its reason
code and the field to change. docs/policies.md lists every refused shape.