Skip to main content
Pre-release

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

SafeRevoke

Experimental permission-removal testing for Python and Django applications.

SafeRevoke helps developers investigate what changes when an access grant is removed. Its pytest plugin reuses existing Django test fixtures and assertions, records actual authorization decisions, and generates HTML/JSON findings.

Version 0.1.0a1 is an early alpha. Support currently covers serial, synchronous pytest-django tests using Django 5.2's standard user/group authorization backend. Licensed under the MIT License.

Install

After the release is available on PyPI:

python -m pip install --pre "saferevoke[pytest]"

For development from the repository:

python -m pip install -e ".[pytest]"

The plugin registers automatically. Permission mutation is disabled until --saferevoke is supplied; installing it does not enable mutation in ordinary tests.

Use your existing Django tests

python -m pytest tests/test_refunds.py --ds=myproject.test_settings --saferevoke --saferevoke-deny group:refund_operators:orders.approve_refund

Replace the illustrative test path, Django settings and permission selector with values from your application. Fixtures must create the relevant test users and grants. Test functions do not need SafeRevoke workflow wrappers.

Selectors use user:USERNAME:app_label.codename for a direct grant or group:GROUP_NAME:app_label.codename for a group grant. Repeat --saferevoke-deny to test additional grants independently.

To use observed dependencies to skip unrelated mutation variants before fixture setup, add:

--saferevoke-selection affected

Every selected test still gets a fresh baseline. Empty or uncertain traces keep their mutation runs. Full mode, --saferevoke-selection all, is the default.

Results

Reports are written to reports/pytest-saferevoke/report.html and report.json. They include baselines, permission traces, remaining-access findings, failed assertions and selection counts. Tests that fail under permission removal retain pytest's usual failure status and nonzero exit code. This may indicate expected access enforcement or a broken required workflow; review the evidence.

The engine can also compare observed identities and privilege scope to flag a more privileged fallback. Such a path must actually execute and reach the supported permission backend to be detected. Passing tests alone are not proof that production permission removal is safe.

Boundaries

  • Runs against the test database managed by pytest-django, with database rollback after each observed test body.
  • Supports standard Django direct/group permissions and active non-superuser identities. Custom authorization backends, async/live-server workflows, xdist and multiple database aliases are not supported by this alpha.
  • Database rollback does not reset files, email, workers or external services. Use isolated test settings and deterministic fixtures.
  • Dependency selection covers observed baseline paths. Direct permission-table queries, custom checks and unobserved branches can be missed. Full mode remains available for broader validation.
  • The library does not automatically sandbox or copy an entire application.

Documentation and examples

Metadata

Release files for saferevoke 0.1.0a1

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

Source distribution (sdist)

Source distribution for saferevoke 0.1.0a1
File Size Uploaded Provenance
saferevoke-0.1.0a1.tar.gz 62.7 kB With provenance Details

Built distribution (wheel)

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

Total release size: 92.7 kB

Release files / saferevoke-0.1.0a1.tar.gz

Download URL saferevoke-0.1.0a1.tar.gz
Size 62.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cc5c52d49a899265be4f8bdffbf8f1c26f070a0bb243fa06477f432e8bfcdaf3
BLAKE2b-256 checksum
How to use checksums
019e2274c5c5b937332630e8c2c0a8d811a66de56467a74a4e4fd02ddbc7b692
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 25, 2026.

Transparency log

Release files / saferevoke-0.1.0a1-py3-none-any.whl

Download URL saferevoke-0.1.0a1-py3-none-any.whl
Size 30.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62f29794f3daf5d180b1257cc66c0e6509f22b50664a7f50e6a0ae61a2c667f5
BLAKE2b-256 checksum
How to use checksums
b70055a38bb0eaae0b1913773ad38d8f272490f314917d5e96aef81f8b1471cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 25, 2026.

Transparency log

Security for saferevoke 0.1.0a1

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for saferevoke-0.1.0a1.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 Oct 25, 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.

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