Skip to main content

Django Access Inspector

Django Access Inspector is a comprehensive access control app for Django that helps you enforce fine-grained access control on your views. It provides a flexible and easy-to-use interface to check and analyze authentication and permission classes for each view in your Django project.

Installation

To install Django Access Inspector, you can use pip, poetry, or uv. Here are the commands:

pip install django-access-inspector
poetry add django-access-inspector
uv add django-access-inspector

After installing, make sure to add "django_access_inspector" to your INSTALLED_APPS setting in your Django project's settings.py file:

INSTALLED_APPS = [
    ...,
    "django_access_inspector",
]

Usage

Basic Usage

To run Django Access Inspector, use the following command:

python manage.py inspect_access_control

By default, it will provide a human-readable output. If you prefer a JSON output, you can use the --output json flag:

python manage.py inspect_access_control --output json

CI Mode

Django Access Inspector supports a CI mode that helps ensure your application's access control remains secure over time. This mode uses snapshots to track the current state of your endpoints and fails if new unauthenticated or unchecked endpoints are introduced.

Generating a Snapshot

First, generate a baseline snapshot of your current access control state:

python manage.py inspect_access_control --snapshot baseline.json

This will save the current state of all your endpoints to a JSON file.

Running in CI Mode

In your CI pipeline, use the snapshot to validate that no new security issues have been introduced:

python manage.py inspect_access_control --ci --snapshot baseline.json

The command will:

  • Compare the current analysis with the saved snapshot
  • Exit with code 0 if no new security issues are found
  • Exit with code 1 if new unauthenticated or unchecked endpoints are detected
  • Display detailed information about any changes found

This is particularly useful in CI/CD pipelines to prevent introducing new security vulnerabilities.

Debug Mode

When you need to troubleshoot authentication detection issues, you can enable detailed debug logging:

python manage.py inspect_access_control --debug

Debug mode provides detailed information about:

  • URL pattern extraction process
  • View function discovery and analysis
  • Authentication and permission detection logic
  • Categorization decisions for each endpoint
  • Detailed analysis of Django and DRF authentication mechanisms

This helps you understand why certain endpoints might be categorized as "unchecked" and allows you to verify that the tool correctly identifies your authentication setup.

Example

cli example output

Here's an interpretation of the output:

  • Unchecked views: Views that Django Access Inspector was not able to check. As the tool is still a work in progress, we aim to make it check all views in the future.
  • Model Admin views: Views generated by Django Admin that are checked with the Django Admin permission system.
  • Views: All views that Django Access Inspector was able to check, including their authentication and permission classes.

Coding Agent Integration

Django Access Inspector can be used with coding agents (Claude Code, Cursor, etc.) via a bundled skill or directly through the CLI.

Using the django-access-audit Skill

A ready-to-use Claude Code skill is included in docs/skills/django-access-audit/. Copy it into your project:

cp -r docs/skills/django-access-audit/ .claude/skills/django-access-audit/

Then invoke the skill from your coding agent to get a structured security audit of your endpoints.

Using the CLI Directly

Coding agents can also use the CLI command directly to get JSON output:

python manage.py inspect_access_control --output json

The JSON output includes authenticated, unauthenticated, unchecked, and admin endpoints with their permission and authentication classes. Agents can parse and analyze this output to provide security recommendations.

Migrating from MCP Server

The MCP server (start_mcp_server command) was removed in v0.5.0. If you previously used the MCP server:

  1. Remove any MCP server configuration from your editor
  2. Use the django-access-audit skill or the CLI command directly instead
  3. The fastmcp dependency is no longer required

Metadata

Release files for django-access-inspector 0.5.0

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

Source distribution (sdist)

Source distribution for django-access-inspector 0.5.0
File Size Uploaded Provenance
django_access_inspector-0.5.0.tar.gz 34.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-access-inspector 0.5.0
File Interpreter ABI Platform
django_access_inspector-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 81.4 kB

Release files / django_access_inspector-0.5.0.tar.gz

Download URL django_access_inspector-0.5.0.tar.gz
Size 34.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2ac992dac47056f37d4be12c3e490f9b7e03fcd93a50f9222004a42afff4b634
BLAKE2b-256 checksum
How to use checksums
66313f70cec37f8dbe9e22adcd60d77407c952f1174c037cc314df582b6db194
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.14.2

Release files / django_access_inspector-0.5.0-py3-none-any.whl

Download URL django_access_inspector-0.5.0-py3-none-any.whl
Size 46.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de37a5eebe02ed3977e6a0ebd5fd2de59b859fdc773ee6d6a9683d96d2e377df
BLAKE2b-256 checksum
How to use checksums
157b0d6342e944fa315d76584705452d78385d84b2757355951336028c82b01b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.14.2

Security for django-access-inspector 0.5.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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