Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PermitDiff — permission plans for AI agents

Detect when an AI-agent permission change can grant more power.
Deterministic permission plans and CI gates for tool-calling agents.

CI Security OpenSSF Scorecard Python 3.11–3.14 Apache-2.0

PermitDiff blocking an approval bypass

Why PermitDiff

A text diff shows that policy YAML changed. It does not tell a reviewer whether the proposed change can materially widen reviewed authority.

PermitDiff evaluates the same review corpus against baseline and candidate policies and performs bounded static authority analysis over the policy change. The result separates observed scenario evidence from conservative policy-level findings.

Detects Example
Observed privilege expansion scenario resolves deny → allow
Approval bypass require_approval → allow
Scope widening payments.refund → payments.*
Constraint weakening amount <= 100 → amount <= 10000
Coverage drift New rule has no observed scenario
Unsafe defaults Fallback becomes more permissive
Precedence uncertainty Mixed-effect rules change order
Stale exceptions Waiver expired, drifted, or unused

When bounded static analysis cannot prove a changed construct non-expanding, the result is unknown and the strict gate fails closed. PermitDiff does not convert uncertainty into safety.

Five-minute start

pipx install git+https://github.com/TensorScholar/permitdiff.git@v0.1.0rc2
permitdiff init permissions && cd permissions
permitdiff compare policies/baseline.yaml policies/candidate.yaml corpus.jsonl \
  --gate permitdiff-gate.yaml

Exit 0 = pass · 2 = valid comparison blocked by policy · 1 = invalid input or execution.

Git-resolved baseline

The post-v0.1.0rc2 development line can compare the current candidate against a policy stored at an already-fetched Git ref, so a PR workflow does not need to materialize a separate baseline file:

permitdiff compare \
  permissions/policy.yaml \
  permissions/policy.yaml \
  permissions/corpus.jsonl \
  --baseline-ref origin/main \
  --baseline-evidence-output permitdiff-baseline-source.json \
  --gate permissions/permitdiff-gate.yaml

With --baseline-ref, the first policy path is resolved from the local Git object database. PermitDiff resolves the requested ref to an exact commit, resolves the policy to an exact blob, enforces the normal policy-size/schema bounds, and reads the blob without checking it out or executing repository code. The evidence file records requested ref, resolved commit, repository-relative policy path, Git object ID, and raw SHA-256. PermitDiff does not fetch remotes implicitly; the ref must already be available locally.

Ref syntax is deliberately conservative. Arbitrary Git revision expressions and traversal-style paths are rejected rather than interpreted. The normal semantic report still binds the validated policy through its canonical policy digest; Git-source evidence separately binds where the baseline bytes came from.

Native Claude Code preapproval projection

The post-v0.1.0rc2 development line adds a bounded native on-ramp for Claude Code project settings. It projects a documented subset of permissions.allow into the same semantic engine used by PermitDiff policies instead of reducing native rules to a text or rank diff.

permitdiff claude compare \
  .claude/settings.baseline.json \
  .claude/settings.local.json \
  corpus.jsonl \
  --strict \
  --format markdown

The initial adapter accepts only explicit permissions.defaultMode = "dontAsk" pairs whose deny and ask rules are unchanged. Bare-tool translation is deliberately limited to Bash, PowerShell, WebFetch, and WebSearch; other bare tools remain opaque because their approval semantics can differ. The adapter also translates exact WebFetch(domain:HOST) preapprovals, de-noises documented same-effect redundancies such as Bash(git mv *) when bare Bash is already granted, and fails closed when changed native semantics cannot be represented faithfully.

This is a preapproval projection, not a complete Claude effective-authority importer. Non-permissions root settings are not modeled; their values are compared through canonical digests while evidence exposes only their key names and identifies which ignored root keys changed. If such root settings differ, comparison stops unless the reviewer explicitly passes --allow-ignored-root-changes. That flag acknowledges only that the reviewer wants to analyze the bounded permission projection; it does not approve or waive the ignored changes.

Claude Code's current documentation states that domain-scoped WebFetch rules can also affect sandbox network-domain policy. PermitDiff models exact WebFetch(domain:HOST) rules here only as WebFetch preapprovals. If any exact WebFetch-domain declaration changes—even one that is preapproval-redundant beneath bare WebFetch—comparison stops unless the reviewer passes --acknowledge-webfetch-sandbox-gap. This acknowledgement allows analysis of the preapproval projection only; it is not evidence that sandbox/network consequences were reviewed or accepted.

WebFetch(domain:*) is intentionally not collapsed into bare WebFetch; a changed wildcard-domain rule is unsupported and fails closed because the two forms have different sandbox effects. The public regression pilot also changes enabledPlugins, so its two reported expansions are specifically the two modeled permissions.allow preapproval expansions—not a claim about the entire settings file.

The adapter also does not model managed/user overrides, hooks, plugin-provided capabilities, built-in exceptions, other permission modes, arbitrary file/path rules, or arbitrary Bash/PowerShell patterns. WebFetch domain scenarios use reserved _claude.permission_domain review metadata created for normalization; that field is not claimed to be raw Claude tool input.

Use --evidence-output <path> when you need the adapter's normalization record. The evidence records declared exact WebFetch domains and whether each projection gap was explicitly acknowledged, but can also contain native permission-rule text and should be treated as potentially sensitive review material rather than automatically published CI output.

Architecture

flowchart LR
  B[Baseline policy] --> C[Deterministic comparison]
  N[Candidate policy] --> C
  S[Scenario corpus] --> C
  C --> O[Observed transitions]
  C --> A[Bounded static authority findings]
  O --> P[Permission plan]
  A --> P
  P --> G{Release gate}
  G -->|pass| M[Merge]
  G -->|fail| R[Review / exact bounded waiver]
  • No LLM in the decision path — deterministic, local, reproducible.
  • Semantics over text — rule effects, scopes, constraints, defaults, and precedence matter; descriptions do not grant authority.
  • Two evidence channels — observed scenario transitions remain distinct from bounded static authority findings.
  • Fail-closed — invalid inputs and unresolved static semantics do not become allow or pass.
  • Evidence-first — policy/corpus digests, action/finding fingerprints, JSON, Markdown, SARIF.
  • Bounded waivers — observed transitions and policy-level findings require exact, expiring review evidence; all waivers are bound to baseline/candidate digests.

GitHub Action

The current v0.1.0rc2 release supports explicit baseline/candidate files:

- uses: actions/checkout@v6
- uses: actions/setup-python@v6
  with: { python-version: "3.13" }
- uses: TensorScholar/permitdiff@v0.1.0rc2
  with:
    baseline: permissions/policies/baseline.yaml
    candidate: permissions/policies/candidate.yaml
    corpus: permissions/corpus.jsonl
    gate: permissions/permitdiff-gate.yaml

The Action writes a Markdown step summary and a SARIF report for code scanning.

On the post-v0.1.0rc2 development line, the same Action also accepts baseline-ref. A PR integration should use a read-only checkout with full history, resolve the base branch as an already-fetched ref such as origin/${{ github.base_ref }}, and use the same repository-relative path for baseline and candidate when the policy is modified in place. The Action surfaces baseline_commit, baseline_object, and baseline_evidence outputs and places resolved provenance ahead of the semantic report in the step summary. Pin a release containing this capability before adopting it in another repository; do not replace a release pin with a moving main ref.

Scope

PermitDiff is a release-time semantic permission regression gate. It is not a runtime authorizer, credential broker, sandbox, identity provider, generic behavioral evaluator, or proof of exhaustive authorization safety.

Its observed corpus evidence is effective only for the supplied review scenarios. Its built-in static analyzer is a bounded static declared-authority over-approximation that fails closed on unsupported or ambiguous containment. Neither channel is an exhaustive effective-authority proof, and a clean report does not establish runtime authorization safety. Review the methodology, threat model, and limitations before sensitive use.

Trust & delivery

The release pipeline is configured for Python 3.11–3.14 tests, branch-aware coverage, strict typing, linting, dependency audit, CodeQL, OpenSSF Scorecard, clean-wheel smoke tests, CycloneDX SBOMs, Trusted Publishing, checksums, and GitHub build attestations. The v0.1.0rc2 release execution completed artifact build, external-repository validation, checksums, artifact attestation, SBOM attestation, and GitHub Release creation. PyPI publication is not yet claimed.

Commercial adoption: permission architecture reviews, scenario-corpus design, CI rollout, policy migration, and private adapters. Engagement model →

0.1.0rc2 is the latest GitHub release candidate using the versioned v1alpha1 schema. Mutable main advances under a separate development identity after releases; breaking changes remain possible before v1.

Docs · Security · Contributing · Roadmap · Citation

Metadata

Release files for permitdiff 0.1.0rc3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for permitdiff 0.1.0rc3
File Size Uploaded Provenance Actions
permitdiff-0.1.0rc3.tar.gz 273.6 kB With provenance Details for permitdiff-0.1.0rc3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for permitdiff 0.1.0rc3
File Interpreter ABI Platform Actions
permitdiff-0.1.0rc3-py3-none-any.whl Python 3 none any Details for permitdiff-0.1.0rc3-py3-none-any.whl

Total release size: 328.1 kB

Release files / permitdiff-0.1.0rc3.tar.gz

Download URL permitdiff-0.1.0rc3.tar.gz
Size 273.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1e7b8e77968d3b74e71e57d913bc6de3b34a27d0d4c0ccf7f4ec99e5af154634
BLAKE2b-256 checksum
How to use checksums
a66ec66ae3c0e7a6cade25d0b447113733fe1115a0fd354f15a449c8add5f32e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Release files / permitdiff-0.1.0rc3-py3-none-any.whl

Download URL permitdiff-0.1.0rc3-py3-none-any.whl
Size 54.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c1b09fd5cfa12b8213b5b8c56bdb36be18982fa49b5c8e0e45703dfe5defbdb
BLAKE2b-256 checksum
How to use checksums
b6b42bfe8d8e7b13e45a38c5455a08053dc4a4e3b0829cbafe42738b0e39c81f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Security for permitdiff 0.1.0rc3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for permitdiff-0.1.0rc3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page