This release is a pre-release and may not be stable for production use.
MintMap
A reviewed map of the code paths that create a login session or credential in a Django app, enforced in CI.
Status: experimental (0.6.0a2; the analysis and catalog are those evaluated as 0.6.0a1). MintMap was built on eight open-source Django projects, then frozen and tested on three it had never seen (CVAT, Label Studio, Tandoor). There it linked 28 of 66 credential paths to the right route, pointed to 30 more only indirectly (an unlinked mint, a candidate or a named gap) and missed 8 (12%) with no warning. 43% of the paths it reported were false alarms, and
difflet 23 of 65 harmful test changes through. (The previous release, 0.5.0a1, missed 30% with no warning on an earlier, harder set of unseen projects.) It is a review aid, not a guarantee. Read Accuracy first.
In a Django app the ways to get logged in are scattered: the login view, auto-login after sign-up or password
reset, SSO callbacks, magic links, two-factor steps, API tokens, admin impersonation. Any pull request can add one
or weaken one without the reviewer noticing that it touched authentication; a classic bug is a two-factor check
that still runs but whose result is ignored. MintMap parses the code (it never runs it), looks for the paths that
create a session or credential, stores the ones it finds in a human-reviewed mintmap.lock, and fails CI when that
set, or the code and checks on it, change. What makes it different is the combination: a reviewed baseline plus a
CI diff, an explicit list of what it could not analyse, and a published miss rate measured on projects it had
never seen.
Contents: Try it in 60 seconds · How it works · Use it on your project · GitHub Action · Exit codes · Accuracy · Known blind spots · Semgrep or CodeQL? · FAQ · Contributing
Try it in 60 seconds
You need Python 3.11 or newer and git. Check python3 --version: the python3 of macOS's command-line tools
(3.9) and of Ubuntu 22.04 (3.10) are too old; with a newer one installed, run
PYTHON=python3.12 bash scripts/demo.sh. Nothing is installed, and Django is not needed: MintMap only parses code.
git clone https://github.com/mohamedmoatazsec/mintmap
cd mintmap
bash scripts/demo.sh
The script scans the small Django project in examples/demo, applies a bad pull request
(bad-pr.patch) to a temporary copy and shows mintmap diff failing. The image
above is its output, and CI re-checks both on every push.
On Windows, run the script in Git Bash or WSL, or follow the steps by hand below in PowerShell. mintmap diff
prints its exit code on its last line; in PowerShell use echo $LASTEXITCODE where the steps say echo $?.
The same steps by hand
python3 -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install . # or skip both lines and use: python3 -I scripts/run_mintmap.py <arguments>
mintmap scan examples/demo # the review queue, the check evidence and the gaps
mintmap diff examples/demo; echo $? # 0: the code matches the reviewed lock
git apply --directory=examples/demo examples/demo/bad-pr.patch
mintmap diff examples/demo; echo $? # 12: fingerprint_changed + evidence_downgraded
git apply -R --directory=examples/demo examples/demo/bad-pr.patch # undo
How it works
(Diagram: see the README on GitHub.)
- Finds mint sites: calls that create a session or credential (
django.contrib.auth.login, DRF and JWT tokens, django-allauth flows, OAuth2 provider tokens, project-made tokens built fromsecrets/uuid4, ...). - Traces them to entry points: URL routes (including
include(), routers, helper functions, i18n patterns), middleware, admin registrations and library views. - Records the checks it can see on the way: password, TOTP, WebAuthn, token signature, permission gates, and a best-effort judgement of whether each check's result decides the outcome. This evidence is often weaker than the truth and sometimes wrong (see Accuracy).
- Writes
mintmap.lock, which a security reviewer approves once. - Fails CI when a pull request adds or removes a path, changes the code or checks on a reviewed path, weakens a check, or reduces what MintMap can analyse. Many constructs it cannot analyse are listed as gaps, but not all: on projects it was not developed against, 0.6.0a1 missed 12% of credential paths with no gap at all (0.5.0a1 missed 30% on an earlier, harder project set; see Accuracy).
Since 0.6.0a1 MintMap also reports two lower-confidence tiers, both fingerprinted and diffed like paths:
| Tier | What it is | Lock entry |
|---|---|---|
| Candidates | Sites with a structural reason to be reviewed: hand-written session state, passwords set from a value the code does not generate, calls into authentication libraries the catalog does not describe, project code that authenticates requests itself, and more | one per kind, candidates:<kind> |
| Watched sites | Sites a precision rule set aside as not being credentials, kept under watch so that a wrong judgement on unfamiliar code still shows up in diff |
one per rule, watched:<kind> |
The full explanation of paths, candidates, watched sites, gaps, settings groups, the review queue and the lock is in docs/CONCEPTS.md.
Real output on a real project (Healthchecks)
After a one-line change that makes the Healthchecks TOTP form accept every code:
$ mintmap diff .
FINGERPRINT_CHANGED e06b237f9895851e evidence inputs changed (checks); previous review (accepted) no longer applies
EVIDENCE_DOWNGRADED e06b237f9895851e factor otp: guards_mint -> present_unproven; status: check_guards_mint -> check_present_relationship_unproven
exit 12 (fingerprint_changed, evidence_downgraded)
Use it on your project
Install MintMap in a virtualenv or with pipx (the system Python of current Debian, Ubuntu and Homebrew refuses
pip install outside one, PEP 668). It needs Python 3.11 or newer and nothing else.
python3 -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install mintmap # or: pipx install mintmap
# or from the release tag: python -m pip install "git+https://github.com/mohamedmoatazsec/mintmap@v0.6.0a2"
Then point it at the Django project (the directory that contains manage.py) and review what it finds:
mintmap scan path/to/django/project # the review queue, path evidence and the gaps
mintmap init path/to/django/project # write mintmap.lock (all entries unreviewed)
# review every group the scan lists, then record the decision: one --group at a time
# (kind:session, kind:token, ..., settings), or all of them at once after the review:
mintmap accept path/to/django/project --all --reviewer "alice" --note "initial review"
mintmap diff path/to/django/project; echo $? # must print exit 0; 64 means some entries are still unreviewed
git add path/to/django/project/mintmap.lock && git commit -m "Add reviewed MintMap lock"
| Command | What it does |
|---|---|
mintmap scan <dir> |
Prints the review queue, the check evidence of each path it reports and the gaps. --json out.json writes the full report |
mintmap init <dir> |
Writes mintmap.lock with every entry unreviewed |
mintmap accept <dir> ... |
Records a review: --group <group>, --all, or entry ids, with --reviewer <name> |
mintmap diff <dir> |
Compares the code with the lock and exits with a bitmask. This is what CI runs |
mintmap update <dir> |
After an intended change: refreshes the lock (changed entries become unreviewed again) |
mintmap --version |
Prints the version (since 0.6.0a2) |
The review queue. The text report of scan starts with a review queue (since 0.6.0a1): confirmed paths
grouped by credential kind (kind:session, kind:token, kind:precursor, kind:custom, kind:other) and entry
point, candidate sites by kind, the settings groups and the watched groups. Inside a group the entries are ranked
by a transparent risk score, each with a why line. The ranking is a hint, not a verdict: in the evaluation,
false alarms were sometimes ranked high and an administrator setting any user's password was ranked low.
mintmap accept --group <group> accepts one such group. Details: docs/CONCEPTS.md.
After an intended change: mintmap update <dir> refreshes the lock, then
mintmap accept <dir> <ids...> --reviewer <name>.
Optional: --library-path <dir> lets MintMap read library source (still without importing it), which can
resolve library view aliases in some layouts. In our evaluation it changed no result.
GitHub Action
# .github/workflows/mintmap.yml
on: pull_request
permissions:
contents: read
jobs:
mintmap:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Replace the tag with the release's full commit SHA (keep the tag as a comment): a tag can be moved.
- uses: mohamedmoatazsec/mintmap@v0.6.0a2
with:
project-dir: .
To pin the full commit SHA of a release tag, look it up with
git ls-remote https://github.com/mohamedmoatazsec/mintmap refs/tags/v0.6.0a2 and write
mohamedmoatazsec/mintmap@<sha> # v0.6.0a2.
The job fails on any finding (configurable with fail-on; exit 128, "MintMap could not run", always fails) and
writes a summary table to the job page. The action runs MintMap from its own checkout with python -I, so files
added by a pull request cannot replace it; no package is built or installed. It also pauses workflow commands while
MintMap prints text from the pull request. See examples/mintmap.yml.
The check is only as strong as the review rules around
mintmap.lock. Without code-owner review, a pull request can accept its own change. Do not run code from the pull request (installing its dependencies, running its tests) in the same job before MintMap: anything that runs in the job can replace the check. Follow docs/ENFORCEMENT.md.
Exit codes
mintmap diff exits with a bitmask:
| bit | name | meaning |
|---|---|---|
| 1 | new_path |
a new way to obtain a session/credential |
| 2 | removed_path |
a reviewed path disappeared |
| 4 | fingerprint_changed |
code, checks, hooks or settings on a reviewed path changed |
| 8 | evidence_downgraded |
a check on a path got weaker |
| 16 | purpose_changed |
the credential issued on a path changed kind |
| 32 | coverage_regression |
MintMap can analyse less than before (new gaps, parse failures, changed roots) |
| 64 | unreviewed |
lock entries not yet accepted |
| 128 | error |
MintMap could not run (bad arguments, missing or invalid lock, catalog error, or an internal error) |
Candidate groups, watched groups and shared mint sites
A candidate group (candidates:<kind>) uses the same bits for its sites (a new site sets 1, a vanished one 2, a
changed one 4, naming new or lost entry points); its findings carry "tier": "candidate". A watched group
(watched:<kind>) does the same with "tier": "watched". A mint site shared by many entry points (one lock entry
listing them) sets bit 1 when a new entry point reaches it, and the finding names that entry point.
Refactors. Formatting, comments, docstrings, renamed local variables and several kinds of extracted helper are normalised and do not change fingerprints. Moving code to another module or class still does (a false alarm). Even so, 7 of 22 harmless changes raised a finding in the latest evaluation. The exact rules are in docs/CONCEPTS.md.
Accuracy
MintMap 0.6.0a1 (frozen before the test; 0.6.0a2 has the same catalog and gives the same scan results on these projects) was measured on three open-source Django projects that nobody looked at while it was built: CVAT, Label Studio and Tandoor. The previous release, 0.5.0a1, was run on the same projects as a control. The reference inventories were written by separate AI agents (not humans) that never saw the tool's output, and every result was re-checked by an adversarial AI verifier that re-ran both versions:
| 0.6.0a1 | 0.5.0a1 (control) | |
|---|---|---|
| credential paths found and linked to the right route | 28 of 66 (42%) | 26 of 66 (39%) |
| found, but only as an unlinked mint, a candidate or a named gap (1) | 30 of 66 (45%) | 29 of 66 (44%) |
| missed with no warning (2) | 8 of 66 (12%) | 11 of 66 (17%) |
| reported paths that are not real credential paths | 25 of 58 (43%) | 30 of 61 (49%) |
| lock entries to review on day one / of which false alarms | 88 / 33 | 82 / 33 |
| check evidence on matched paths: agrees / weaker than the truth / wrong (3) | 2 / 38 / 2 of 42 | – |
harmful code changes caught by diff (required categories) |
13 of 18 | 13 of 18 |
| harmful code changes caught (all, incl. project-specific and verifier probes) | 42 of 65 (65%) | 36 of 65 (55%) |
| harmless changes that raised a finding | 7 of 22 | 8 of 22 |
(1) 4 of the 11 "named gap" units are visible only in --json output (the text report lists the first 40 gaps).
Label Studio's personal access tokens, its main API credential, are among them and do not appear in the review
queue. (2) By class: full login sessions 0 of 28, tokens 4 of 26, precursors (reset, invitation, MFA state) 4 of
12. Scoring judgement calls move the 0.6.0a1 count between 4 and 12. (3) "Weaker" means the tool claimed less than
was true, typically "no check found" on a login whose password check runs in a serializer or form named by a
library setting. "Wrong" means it claimed something false.
In short: 0.6.0a1 is somewhat better than 0.5.0a1 on code neither had seen: 3 fewer silent misses, 6 more
harmful changes caught, fewer false-alarm paths. But most of the large gains it made on its development projects
(silent misses 51 → 4 of 213, harmful changes caught 98 of 98) did not transfer. The project set matters too: on an
earlier set of unseen projects (InvenTree, Weblate, pretix) 0.5.0a1 missed 30% silently, against 17% here. Expect
to miss some tokens and precursors in an unfamiliar codebase, to dismiss many false alarms on day one, and to see
about a third of harmful changes to auth code pass diff, mostly where the changed check is reached through
settings-named serializers, library-called hooks or admin code.
Full methodology, per-project numbers and the earlier rounds: docs/EVALUATION.md.
Known blind spots
General causes of the misses found in the latest evaluation (0.6.0a1 on CVAT, Label Studio and Tandoor):
- A library's mint function called through the library's settings object (dj-rest-auth
api_settings.TOKEN_CREATOR(...)): neither a path nor a gap. - Credentials created or edited through the Django admin for project models (
ModelAdminsaves, admin actions, a token field in an admin form). Admin registrations are linked only when the model'ssave()is a known mint. - A settings module that star-imports its base module through a source-root alias: the base module's
INSTALLED_APPS,MIDDLEWARE,AUTHENTICATION_BACKENDSandREST_FRAMEWORKare not read, and the scan reports only the unresolved import (settings_star_import_unresolved) andmissing_settinggaps, not which settings the unread base module holds. - Hooks named in settings and loaded by a project helper (
load_func(settings.X)), and adapter classes re-exported from a package__init__: such code is in no fingerprint, so weakening it can passdiff. - DRF routers extended at run time (one global gap), tokens created by
ModelSerializer.create()throughsuper(), and credentials written from request data by an update serializer. - Values whose field name has no credential word (
InviteLink.uuid) and session writes without a principal-like signal are set aside in the JSON report only, not watched. - Libraries outside the catalog (for example django-auth-ldap) and project code that only such a library calls;
their settings (for example
AUTH_LDAP_GLOBAL_OPTIONS) are in no fingerprint, so weakening them passesdiff(2 of the 23 harmful test changes that passed in the latest evaluation). - Not modelled: session lifetime and token revocation checks, project view decorators, admin actions as entry
points, signed cookies (
set_signed_cookie) as credentials, multi-request flows. There is no option to choose one settings module: MintMap analyses the modules thatDJANGO_SETTINGS_MODULEliterals in the code name and, as alternatives, every other leaf settings module except test settings. - Django only. Library knowledge covers Django auth, DRF, SimpleJWT, knox, djoser, dj-rest-auth, django-allauth, social-auth, django-otp, two-factor-auth, sesame, oauth-toolkit and a few more (about 15 packages). Other libraries usually show up as gaps, but not always.
What 0.6.0a1 added for the blind spots of 0.5.0a1
0.6.0a1 added general mechanisms for the blind spots of 0.5.0a1:
- hand-written sessions with run-time keys
- credentials created through related managers and
CreateView - library flows called directly
- settings computed by function calls
- library URL builders
- admin-chosen passwords and step-up state (as candidates)
The evaluation above is the measure of how far that went.
Each blind spot is an open item in docs/ROADMAP.md.
How is this different from Semgrep or CodeQL?
Semgrep and CodeQL find code that matches a query. You can write a CodeQL query that traces login() calls back
to request handlers (we did, while evaluating MintMap), but you then still need: knowledge of what Django auth
libraries mint and check (MintMap's catalog covers about 15), a reviewed baseline, fingerprints that ignore harmless refactors,
a diff that fails CI only when the reviewed set changes, and an explicit list of what the analysis could not see.
MintMap is that package for one framework. It is a combination of established techniques (call-graph tracing,
library models, baselines), not a new kind of analysis.
FAQ
Is it a vulnerability scanner? No. MintMap does not look for bugs and does not say whether a login path is safe. It tells you that the set of ways in has changed, or that the code or checks on a reviewed one changed, so that a person looks at it.
Does it run my code?
No. MintMap reads source code with Python's ast module. It never imports or runs the project or its
libraries, needs no database or settings, and has no dependencies beyond the Python standard library (3.11+).
Which Python versions? 3.11, 3.12, 3.13 and 3.14 are tested. MintMap must run on a Python that can parse the project's code: a project that uses Python 3.12 syntax (for example the same quotes nested inside an f-string) needs MintMap on 3.12 or newer, otherwise those files are reported as parse failures. Lock fingerprints are the same on Python 3.11, 3.12 and 3.13 (tested on eight projects), so a lock written with one of these versions can be checked with another; with any other version, write the lock with the Python minor version CI uses.
Which Django versions?
MintMap does not import Django, so it does not need a particular version installed. What it knows about Django and
the other libraries comes from a catalog that was read from specific releases: Django 6.1.2 and 5.2.17, DRF 3.18,
django-allauth 65 and the others listed in
django_catalog.json (verified_package_versions). Projects on much
older or newer releases have not been measured.
How long does a scan take? Seconds, for projects of these sizes. Measured on 2026-11-13 with Python 3.13 on a 2-vCPU Linux machine (Intel Xeon, 2.3 GHz), three runs each, on the then-current default branch of each project:
| Project | Python files parsed | mintmap scan wall time |
|---|---|---|
examples/demo |
9 | 0.1 s |
Healthchecks (255075ce) |
419 | 1.7 s |
Tandoor (82a1ad8a) |
343 | 2.6 to 2.8 s |
CVAT (873008de) |
534 | 7.2 to 7.5 s |
Peak memory over all of these scans was about 170 MB. A much larger codebase takes longer: Zulip (1,769 Python
files, one of the development projects) took 37 to 42 s (six runs) with a peak of about 400 MB, measured with
Python 3.13 on a 4-vCPU Intel Xeon at 2.1 GHz. diff runs the same analysis and then compares it with the lock.
Does it replace code review of authentication changes? No. It points the review at the right pull requests. It misses things (see Accuracy), and the check is only as strong as the review rules around the lock (see docs/ENFORCEMENT.md).
Can I use it with Flask, FastAPI or another framework? No. Django only.
Documentation
| Document | What is in it |
|---|---|
| docs/CONCEPTS.md | Paths, candidates, watched sites, gaps, settings groups, the review queue, the lock, fingerprints |
| docs/ENFORCEMENT.md | The GitHub settings that make the check binding |
| docs/EVALUATION.md | How the accuracy numbers were measured, per project and per round |
| docs/ROADMAP.md | The known blind spots as open work |
| examples/demo | The demo project, its lock and the bad pull request |
| CHANGELOG.md | Release notes |
Contributing
Contributions are welcome: see CONTRIBUTING.md. The library catalog
(src/mintmap/data/django_catalog.json) is the most valuable place to help: entries cite the library source file
they were read from, with a line number where the fact is line-specific. Bug reports with a minimal Django snippet
that MintMap misses silently are especially welcome. Tests: python -I -m unittest discover -s tests -t tests.
To report a vulnerability in MintMap itself, see SECURITY.md.
Development history
The internal development log of the prototype (design notes, rounds 1 and 2 in detail including their failures; rounds 3 and 4 are summarised in docs/EVALUATION.md) is archived in docs/history/DEVELOPMENT_HISTORY.md. Its commands and paths refer to the prototype, not to this package.
License
Apache License 2.0. See LICENSE.
Metadata
Release files for mintmap 0.6.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mintmap-0.6.0a2.tar.gz | 438.8 kB | With provenance | Details for mintmap-0.6.0a2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mintmap-0.6.0a2-py3-none-any.whl | Python 3 | none | any | Details for mintmap-0.6.0a2-py3-none-any.whl |
Total release size: 714.2 kB
Release files / mintmap-0.6.0a2.tar.gz
| Download URL | mintmap-0.6.0a2.tar.gz |
|---|---|
| Size | 438.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b691d58a7b7e2a5cf3b2436ff72ae094e4382b276361104f68e2a4bfc2429456
|
|
BLAKE2b-256 checksum How to use checksums |
4337ed5f06ae0d39803a601c76a894806f5b27b50c41b20560e5ef40810a59dc
|
| 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 Nov 13, 2026.
Transparency logRelease files / mintmap-0.6.0a2-py3-none-any.whl
| Download URL | mintmap-0.6.0a2-py3-none-any.whl |
|---|---|
| Size | 275.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9708e38456dd6d74f8b01b4cb7fc9f399060979ee695c8ff79dda212c1077ad
|
|
BLAKE2b-256 checksum How to use checksums |
86b39bf8536b6e88363387f9393e7b948abb41b2f9a63aad6065659ccc2c70c7
|
| 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 Nov 13, 2026.
Transparency logSecurity for mintmap 0.6.0a2
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.
Attestation for mintmap-0.6.0a2.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 Nov 13, 2026.
Transparency logA 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.