Skip to content

Latest commit

 

History

History
703 lines (638 loc) · 89.6 KB

python.md

File metadata and controls

703 lines (638 loc) · 89.6 KB

Python web apps: TLS and authentication

Flask, FastAPI and Django are Python web frameworks, served by Uvicorn or Gunicorn. This guide helps your AI assistant deploy them securely, including loopback behind a TLS proxy or a managed platform's required listener, Django's HTTPS settings, authentication, and http.server only as a last resort, for curated files over SSH.

If an AI assistant is helping you secure a deployment, give it the prompt below:

Read the secureconfig guide at
https://raw.githubusercontent.com/jposluns/secureconfig/main/python.md
in full, including the section for AI assistants at the end. Then, for my
deployment: state which of its recommendations apply and the exact changes
to make; compare the versions the guide was written against with the
releases I am running and with the vendor's current releases, and flag any
guidance a newer release may have changed; and run or adapt the guide's
Verify steps where you can. List separately every item you could not
verify instead of reporting it as passed.

Written against Django documentation 6.1, Python http.server documentation 3.14.4, Python http.server source v3.14.10, Python standard library documentation 3.14, CPython ssl source and documentation v3.14.10, CPython ssl source v3.14.9, and CPython secrets documentation and source v3.14.10, plus 8 more recorded bases; 5 further sources are pinned to a commit and 6 carry no recorded version. Metadata reviewed 2026-11-06; documentation checked September 2026. The guide records 27 claims, all reasoned from cited sources and any earlier-form run, not a live demonstration of the shipped form.

A newer release of any of this software can make version-specific details here outdated. To prioritize an update, open a GitHub issue, send a pull request, add a request under requests/, or reach the maintainer as CONTRIBUTING.md describes. The machine-readable version basis and claim list are in the section for AI assistants at the end of this guide.

Covers Flask, FastAPI/Uvicorn, Gunicorn, and Django. This guide's preferred production layout: bind the app server to 127.0.0.1 and terminate TLS in a reverse proxy (caddy.md, nginx.md) or behind cloudflare.md. For managed HTTP ingress, bind the listener required by your deployment; TLS termination depends on the platform and configuration described below (paas.md). The app servers can also terminate TLS themselves, shown below. Certificates: free-certificates.md or self-signed.md.

1. TLS per server

Flask's built-in server (development only; it is not a production server, TLS or not):

app.run(host="127.0.0.1", port=8443, ssl_context=("cert.pem", "key.pem"))
# ssl_context="adhoc" generates a throwaway self-signed cert; requires the cryptography package

The snippet assumes a Flask app created as in the example on PyPI's Flask 3.1.3 entry: from flask import Flask, then app = Flask(__name__); the package name is Flask and the import name flask. Install Flask with pip install Flask, per the Flask 3.1.3 installation page. The "adhoc" option's cryptography package installs with pip install cryptography, the line in PyPI's cryptography 50.0.2 entry.

Gunicorn (Flask/Django/WSGI in production):

gunicorn --bind 0.0.0.0:8443 \
  --certfile /etc/ssl/certs/server.crt \
  --keyfile  /etc/ssl/private/server.key \
  app:app

Install Gunicorn with pip install gunicorn, the install line in the Gunicorn 27.0.1 README; release 27.0.1 is in PyPI's gunicorn 27.0.1 entry.

Uvicorn (FastAPI/ASGI):

uvicorn main:app --host 0.0.0.0 --port 8443 \
  --ssl-certfile /etc/ssl/certs/server.crt \
  --ssl-keyfile  /etc/ssl/private/server.key

Install Uvicorn with pip install uvicorn, the install line in the Uvicorn 0.55.0 documentation index; release 0.55.0 is in PyPI's uvicorn 0.55.0 entry. The snippet's main:app names the ASGI application to run in the "<module>:<attribute>" format of the Uvicorn 0.55.0 settings page, so it expects an app attribute in a main module; the documentation index's example defines app in main.py and runs uvicorn main:app.

This guide's advice: Bind to 0.0.0.0 only when either (a) the process itself terminates TLS with authentication in place, or (b) a platform terminates TLS at its ingress and reaches your app over a private or container network. Otherwise, on a host you expose directly, keep 127.0.0.1 and terminate TLS in a reverse proxy.

This guide's advice for managed platforms: do not add extra listeners; bind only the listener required by your deployment. The documented HTTP ingress mappings are:

  • Render web services must bind 0.0.0.0. Render recommends the PORT environment variable (at the time of writing, default port 10000, configurable), can usually detect another bound port, and requires the public HTTP server to use PORT when multiple ports are bound (web services).
  • Heroku assigns each web process its port through PORT (runtime principles), and Heroku's Node.js deployment page says the web process must bind to that port or the dyno does not start (deploying Node.js). Fir Private Spaces networking uses IPv6 by default; Heroku warns that IPv4-only assumptions do not bind properly and recommends an IPv6 or dual-stack listener, typically :: (generations). Heroku's HTTP routing page lists IPv6 as unsupported in the Cedar generation without naming a listener address (HTTP routing). This guide's assessment: none of the Heroku pages checked (runtime principles, HTTP routing, generations, dynos, Procfile, Gunicorn deployment, Node.js deployment, the Python and Node.js getting-started tutorials and Node.js best practices, all listed in Sources) states a listener address for Cedar. This guide's assessment of those pages: apart from the Fir recommendation above, the addresses they show are local-development URLs and sample log output. That absence is not evidence that Heroku accepts any listener address.
  • Fly Proxy HTTP services must be reachable over IPv4: use 0.0.0.0 and match the configured internal_port to the app listener (service binding). IPv4-mapped IPv6 wildcard behaviour depends on the VM and runtime (wildcard qualification).
  • Railway domains route to a detected or selected internal target port (target ports). Railway says web servers should bind 0.0.0.0 and listen on the automatically injected PORT (listener and port). Its edge proxy (tcp-proxy) terminates TLS; traffic is then forwarded over Railway's internal network to the deployment (request flow).

Render's load balancer terminates inbound HTTPS and forwards HTTP to the web service (web services). Heroku's HTTP routing page describes a load balancer offering SSL termination and routers forwarding HTTP to web dynos; it notes that both Private Spaces generations have different routers, so this is not a complete account of Private Spaces routing (HTTP routing). Fly Proxy's tls handler terminates TLS and forwards plaintext (TLS handler); without handlers it passes TCP through, allowing the app to terminate TLS itself (TCP passthrough). This guide's advice: plain HTTP is acceptable only behind protected ingress that terminates TLS; application authentication is still required (paas.md).

2. Django settings for HTTPS

DEBUG = False                            # never True in production: debug pages leak source excerpts, local variables and settings
ALLOWED_HOSTS = ["app.example.com"]      # your public host names only; '*' matches any Host and leaves validating it to you
SECURE_SSL_REDIRECT = True
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")  # only behind a proxy that STRIPS the client's value and sets its own
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = 3600               # start small; raise to 31536000 (1 year) after HTTPS is confirmed working
SECURE_HSTS_INCLUDE_SUBDOMAINS = False   # True ONLY after every subdomain also serves valid HTTPS; the commitment is irreversible for SECURE_HSTS_SECONDS

Install Django with python -m pip install Django, the install line in the Django 6.1.3 installation guide; release 6.1.3 is in PyPI's Django 6.1.3 entry.

Django 6.1's deployment checklist says you must never enable debug in production, because debug pages leak excerpts of your source code, local variables and settings; DEBUG defaults to False, so set it explicitly in production settings in case development settings turned it on. ALLOWED_HOSTS (default: an empty list) lists the host names the site may serve, as a guard against HTTP Host header attacks; a value of '*' matches anything and leaves validating the Host header to you, and code that reads the Host header from request.META directly bypasses this check. With DEBUG = False, an empty ALLOWED_HOSTS makes Django return every request as "Bad Request (400)".

SECURE_PROXY_SSL_HEADER must be set only when a proxy you control, or a managed platform that reliably guarantees this, strips any client-supplied X-Forwarded-Proto from every request and sets it itself from the real connection scheme; otherwise a client can spoof it and make Django treat plain HTTP as HTTPS. Leave it unset if you are not behind such a proxy, and confirm the app is reachable only through that proxy, not directly. Run python manage.py check --deploy and fix what it reports.

3. Authentication

Follow authentication.md. Framework specifics:

  • Keep Django's built-in password hashing; do not replace it with custom code (this guide's advice).
  • If your Flask or FastAPI application implements its own password accounts, provide its account storage and hash passwords with argon2-cffi or bcrypt (this guide's advice; follow the algorithm and legacy-bcrypt constraints in authentication.md):
from argon2 import PasswordHasher
ph = PasswordHasher()
hash_ = ph.hash(password)
ph.verify(hash_, password)   # raises on mismatch

Install it with python -Im pip install argon2-cffi, the line on the 25.1.0 installation page; the package installs as argon2-cffi but imports as argon2, as from argon2 import PasswordHasher on PyPI's argon2-cffi 25.1.0 entry shows.

The argon2-cffi 25.1.0 example documents these PasswordHasher, hash and verify calls and a VerifyMismatchError on mismatch. The pinned bcrypt example documents hashpw(password, gensalt()) and checkpw(password, hashed); these API examples do not establish framework user-store capabilities.

  • Generate tokens and secrets with the standard library, and load them from the environment (this guide's advice):
import secrets
token = secrets.token_urlsafe(32)

In CPython v3.14.10, token_urlsafe(nbytes=None) returns URL-safe Base64 text from nbytes random bytes; the argument counts input bytes, not output characters. The explicit 32 above is this guide's example choice, not a size suitable for every secret. If the argument is omitted or None, it uses DEFAULT_ENTROPY, 32 bytes at this pin; the documented default can change, including in maintenance releases.

  • FastAPI's fastapi.security classes (HTTPBearer, APIKeyHeader, OAuth2AuthorizationCodeBearer, and so on) extract the credential from the request and declare the OpenAPI security scheme. The OpenIdConnect helper is documented as a stub that does not implement the scheme or use the discovery URL. The checks those classes perform vary by helper (an API-key helper checks only that a value is present; the HTTP and OAuth2 bearer helpers may also check the scheme), but none of those classes authenticate the credential (no signature, issuer, audience, or expiry check). Use them to extract the token, then validate it (signature, issuer, audience, expiry) with an OIDC library such as Authlib, and authorize per oidc-integration.md.
  • Rate-limit login routes (this guide's advice; for example with a proxy-level limit or a library such as slowapi for Starlette/FastAPI ASGI apps' HTTP endpoints; endpoints using slowapi's limit decorator must take an explicit request argument, and slowapi does not support WebSocket endpoints).
  • MFA: add TOTP with pyotp plus the qrcode package for enrolment QR codes; django-otp integrates this into Django. Requirements and options in mfa.md.

4. Client-side TLS discipline

Never ship verify=False (requests/httpx) or ssl._create_unverified_context (this guide's advice). For an internal CA, point the client at it instead (this guide's advice):

export REQUESTS_CA_BUNDLE=/path/ca.crt   # requests
export SSL_CERT_FILE=/path/ca.crt        # HTTPX with verify=True and trust_env=True; OpenSSL default CA file for ssl when its default verify paths apply (see caveat below)

HTTPX 0.28.1's SSL guide says SSL_CERT_FILE and SSL_CERT_DIR are not automatically used and shows an explicit context; its code path contradicts that: its sync and async transports pass verify and trust_env to create_ssl_context, which reads SSL_CERT_FILE when both are true. Its environment guide says environment variables are used by default but does not list SSL_CERT_FILE. This guide's advice: use the export above for that HTTPX code path; pass an explicit CA context for other configurations. With no CA specified and verification enabled, CPython's ssl.create_default_context() tries to load default CAs (CPython notes this may fail silently). ssl.get_default_verify_paths() reports OpenSSL's default verify paths and environment-variable names.

At CPython v3.14.10, SSLContext.load_default_certs() calls set_default_verify_paths(), whose _ssl.c implementation calls OpenSSL's SSL_CTX_set_default_verify_paths(). get_default_verify_paths() in _ssl.c gets the file and directory environment-variable names from OpenSSL's X509_get_default_cert_file_env() and X509_get_default_cert_dir_env(); ssl.py returns those names and the resolved paths. OpenSSL openssl-4.0.3 documents that SSL_CTX_set_default_verify_paths() honours both SSL_CERT_FILE and SSL_CERT_DIR for its default CA file and directory, subject to its environment rules: these variables are security-sensitive for CA loading, and security-sensitive environment variables are not consulted for set-user-ID or set-group-ID executables.

On Windows builds, where sys.platform is "win32", ssl.py imports enum_certificates and the same load_default_certs() first loads certificates from the CA and ROOT system stores before the default-path call; on other platforms it makes that call alone. _load_windows_store_certs() loads each x509_asn certificate whose trust is True or includes the requested purpose's OID, and catches an SSLError for a certificate that fails to load and a PermissionError while enumerating the store, issuing a warning for each. In _ssl.c, ssl_collect_certificates() collects the named store, read-only, from whichever of the local-machine, local-machine enterprise, local-machine group-policy, current-user, current-user group-policy, services and users system store locations it can open and add. enum_certificates returns each certificate with its encoding and a trust value that is True when neither an enhanced key usage property nor an extension is found, and otherwise a set of OIDs. This guide's reading: the Windows store loading does not depend on SSL_CERT_FILE or SSL_CERT_DIR, and neither ssl.py nor _ssl.c at v3.14.10 has macOS-specific store code, so in these files a macOS build makes only the default-path call into OpenSSL. At v3.14.10, the clinic header defines the enum_certificates and enum_crls method-table macros only when _MSC_VER is defined, and defines both as empty otherwise. _ssl.c compiles both functions and their Windows store helpers only under _MSC_VER, so without it the module method table lists neither function. This guide's assessment: because ssl.py imports both names whenever sys.platform is "win32", a win32 build compiled without _MSC_VER is expected to fail at that import rather than make the default-path call alone; whether such a build exists, and what it does, needs a run. _ssl.c includes _ssl/debughelpers.c, and _ssl/misc.c and _ssl/cert.c. At v3.14.10 it also includes _ssl/distrusted_spki.h, which defines the _distrusted_spki list as 8 SHA-256 digests under the comment "Compromised eMudhra intermediates", each commented with one eMudhra CA name, such as CN=EM OV TLS CA - G3B,O=eMudhra BV,C=NL. This guide did not check that each digest is the key of the CA its comment names. At v3.14.10, _ssl.c passes a verify callback to SSL_CTX_set_verify(), and that callback, which its comment says is called once per certificate, checks each certificate in the chain. When OpenSSL's own check of a certificate passed and the SHA-256 of its SubjectPublicKeyInfo is on that list, the callback sets X509_V_ERR_CERT_REJECTED and returns 0, so verification of that certificate fails. In the 3.14 line this check is new in v3.14.10: at v3.14.9, _ssl.c passes NULL, not a callback, to SSL_CTX_set_verify(), and this guide did not read other release lines. This guide's reading: the check does not depend on where the CAs came from, so it applies whichever CA source was loaded, the default paths, the Windows stores or load_verify_locations; loading a CA lets OpenSSL build a chain to it, but does not by itself mean a certificate in that chain is accepted. This guide's reading: cert.c, misc.c and debughelpers.c hold no CA-loading, default-path or system-store code. By the same reading, the clinic header supplies wrappers for the CA-loading, default-path and system-store methods and functions load_verify_locations, set_default_verify_paths, get_default_verify_paths, enum_certificates and enum_crls. They delegate to the implementations in _ssl.c (the header's lines 1581, 1850, 2690, 2884 and 2965).

At v3.14.10, _set_verify_mode() passes the distrusted-key callback whatever the mode, and _ssl.c calls it when it creates a client or server context, from the verify_mode setter, and from the check_hostname setter when it turns on hostname checking for a context whose mode is CERT_NONE. This guide's reading: the check covers a server verifying client certificates as well as a client verifying a server. A server socket that allows TLS 1.3 post-handshake authentication passes its current verify callback back when it adds SSL_VERIFY_POST_HANDSHAKE, under the comment "Keep ctx verify callback (distrusted SPKI check)". This guide's reading: neither _ssl.c nor the header offers an ssl setting, environment variable or build condition that shows, removes or extends the list or the callback; the rest of the CPython tree was not searched. What verify_mode = CERT_NONE does to this check is not established by these files: _set_verify_mode() passes that mode to OpenSSL as SSL_VERIFY_NONE, and ssl.rst says that under CERT_NONE validation errors do not abort a client socket's handshake and a server does not request a client certificate. The header's comment calls the list a last line of defence, says the list is meant to block keys only while a platform root store's removal of trust is still propagating, and says to block another key by adding its digest to the list. This guide's inference, not run: when the check refuses a certificate, the verifying side sees ssl.SSLCertVerificationError, because _ssl.c chooses that class when OpenSSL reports a failed certificate verification, takes verify_code and verify_message from OpenSSL's verify result, here X509_V_ERR_CERT_REJECTED, and sets them on the exception. What the peer whose certificate was refused sees is not established.

This guide's inference: that CPython default-path call uses those OpenSSL overrides when linked to a library with the cited behaviour, subject to the executable exclusions above. This guide's assessment: a CPython build may link a different OpenSSL release from openssl-4.0.3; these lines do not establish which release a given build links, which CAs OpenSSL's default paths or the Windows stores hold on a given host, or whether a deployed configuration takes this path and loads its intended CAs. At v3.14.10, the Windows build script PCbuild/get_externals.bat names openssl-3.5.9 as its OpenSSL source library and openssl-bin-3.5.9 as its OpenSSL binaries. The macOS installer build script Mac/BuildScript/build-installer.py names OpenSSL 3.5.9, with a tarball URL from the openssl-3.5.9 release. This guide's OpenSSL citations above are at openssl-4.0.3, a different release from the OpenSSL 3.5.9 that these build files name. At openssl-3.5.9, SSL_CTX_load_verify_locations documents the same SSL_CERT_DIR and SSL_CERT_FILE overrides of the default CA directory and file as the cited openssl-4.0.3 lines. The two releases' openssl-env pages differ: the 3.5.9 page says the environment is "usually not consulted" when the executable is set-user-ID or set-group-ID. Its SSL_CERT_DIR and SSL_CERT_FILE entry does not call either variable security-sensitive. This guide's assessment: only that documentation was read, not OpenSSL 3.5.9's code, so whether 3.5.9 consults SSL_CERT_FILE and SSL_CERT_DIR for set-user-ID or set-group-ID executables is not established. Which OpenSSL release a given installed, distribution or source build links still needs observation, for example of ssl.OPENSSL_VERSION on that installation.

5. Do not quick-share files with http.server

python -m http.server is a common quick-share suggestion, and it is the wrong one on any reachable host. By default it binds every interface (as of Python 3.14.10), and it serves the current directory: source, .env, private keys, and database dumps are all downloadable by anyone who can reach the port. It also follows symbolic links, so a link in that directory hands out files from outside it, and the Python docs mark the module as not suitable for production. If you have no alternative, bind loopback and serve a directory that holds only what you mean to share:

cd /path/to/a/directory/with/nothing/private || exit
python -m http.server -b 127.0.0.1 8000

Reach it through an SSH tunnel, including one that runs over your tailnet, never a public bind.

6. Verify (REASONED: TLS, authentication and listener expectations follow the Sources below and linked deployment guidance; no deployment run or outcome is recorded in this guide. This metadata-only review has no deployed Python application, proxy or managed ingress to test. The block needs bash: in a shell without bash's shopt, such as dash, it refuses with status 2 before probing. At the end it exits 2 when ss is not installed only if no other part found something or was inconclusive, because a finding and an inconclusive result both outrank that refusal.)

(                                       # a subshell, so your own script arguments are untouched
  set -- PASTE_WHOLE_BLOCK 'REPLACE_WITH_YOUR_HOST' 'REPLACE_WITH_PROTECTED_PATH'   # the deployment's public host name, no scheme, user name, port, path, query, fragment, percent sign or trailing dot, then a real protected path without its leading slash: replace inside the quotes, keeping them
  [ "${1-}" = PASTE_WHOLE_BLOCK ] || { echo "paste the whole block, including its set -- line; not probing"; exit 2; }
  shift
  [ "$#" -eq 2 ] || { echo "the set -- line needs exactly 2 values; not probing"; exit 2; }
  case "$(LC_ALL=C; case "$1" in *[![:print:][:cntrl:]]*) printf n ;; *) test "$LC_ALL" = C && printf a ;; esac)" in   # in the C locale every byte above 127 is outside these two classes, whatever your locale
    a) ;;
    n) echo "the host name holds a non-ASCII character: give its ASCII (punycode, xn--) form; not probing"; exit 2 ;;
    *) echo "could not switch to the C locale; not probing"; exit 2 ;;
  esac
  case "$1" in
    ""|*REPLACE_WITH_*|*/*|*:*|*.|*[@?%]*|*'#'*|*[[:space:][:cntrl:]]*) echo "substitute your public host name (no scheme, user name, port, path, query, fragment, percent sign or trailing dot) inside the quotes on the set -- line above; not probing"; exit 2 ;;
  esac
  shopt -s nocasematch || { echo "this block needs bash; run it in bash; not probing"; exit 2; }   # host names ignore letter case, so this case matches them in any case through a bash option, not an outside command that could fail
  case "$1" in
    example.com|example.net|example.org|*.example.com|*.example.net|*.example.org) echo "example.com, example.net, example.org and their subdomains are not your deployment: substitute your own host name on the set -- line above; not probing"; exit 2 ;;
  esac
  shopt -u nocasematch   # every match below compares letter case exactly again
  # guard-conventions: allow C5-NON-ASCII-TARGET not a host: the protected path, value 2, a path that its own case checks for a leading slash, white space and control characters and that goes only into the probe URL's path, after the literal / that follows the host name, never in a host name
  case "$2" in
    ""|*REPLACE_WITH_*|/*|*[[:space:][:cntrl:]]*) echo "substitute a protected path, without its leading slash, inside the quotes on the set -- line above; not probing"; exit 2 ;;
  esac
  set -- "$1" "$2" 0                      # the 3rd value is the block's status so far: 1 (a finding) outranks 3 (inconclusive), which outranks 2 (a part refused to run), which outranks 0
  curl -q -g -sSI --noproxy '*' "https://$1/" ||     # public HTTPS endpoint: must succeed without -k; if not, investigate the cert, chain, hostname, or your client trust store, never -k
    { echo "curl exit $?: the HTTPS request failed; inconclusive"; [ "$3" = 1 ] || set -- "$1" "$2" 3; }
  # An unauthenticated request to a real protected path must be REJECTED and a valid credential ACCEPTED. --noproxy
  # disables YOUR client proxy, not a reverse proxy in front of the app, so if the app sits behind an auth proxy this
  # pair cannot tell whether the app or the proxy enforced it: confirm the layer by probing the app directly or in its logs.
  set -- "$1" "$2" "$3" "$(if curl -q -g -sS --noproxy '*' -o /dev/null -w '%{http_code}\n' "https://$1/$2"; then printf '\n0'; else printf '\n%s' "$?"; fi)"
  set -- "$1" "$2" "$3" "${4##*$'\n'}" "${4%%$'\n'*}"   # curl's exit status, then the HTTP code
  printf '%s\n' "$5"                      # no credentials: expect 401/403
  case "$4:$5" in
    0:401|0:403) ;;
    0:2??) echo "FINDING: the protected path answered $5 with no credentials"; set -- "$1" "$2" 1 ;;
    0:*) echo "HTTP $5 without credentials is neither the 401/403 pass nor a 2xx finding; inconclusive"; [ "$3" = 1 ] || set -- "$1" "$2" 3 ;;
    *) echo "curl exit $4: the request without credentials failed; inconclusive"; [ "$3" = 1 ] || set -- "$1" "$2" 3 ;;
  esac
  set -- "$1" "$2" "$3" "$(if curl -q -g -sS --noproxy '*' -H @cred.txt -o /dev/null -w '%{http_code}\n' "https://$1/$2"; then printf '\n0'; else printf '\n%s' "$?"; fi)"
  set -- "$1" "$2" "$3" "${4##*$'\n'}" "${4%%$'\n'*}"   # curl's exit status, then the HTTP code
  printf '%s\n' "$5"                      # valid credential from a file (cred.txt holds a full header line, e.g. "Authorization: Bearer ..."): expect 2xx
  case "$4:$5" in
    0:2??) ;;
    0:*) echo "HTTP $5 with the credential is not the expected 2xx, so the positive control failed; inconclusive"; [ "$3" = 1 ] || set -- "$1" "$2" 3 ;;
    *) echo "curl exit $4: the request with the credential failed (is cred.txt in this directory?); inconclusive"; [ "$3" = 1 ] || set -- "$1" "$2" 3 ;;
  esac
  if command -v ss >/dev/null; then
    ss -tlnp ||   # every listener: loopback for a same-host reverse proxy, or the platform's required address and port from section 1 on managed ingress
      { echo "ss -tlnp failed; inconclusive"; [ "$3" = 1 ] || set -- "$1" "$2" 3; }
  else
    echo "ss is not installed here; not listing sockets"
    case "$3" in 0) set -- "$1" "$2" 2 ;; esac
  fi
  echo "block exit $3; the HTTPS headers and the listener list above are not classified, so judge them yourself: read every listener against section 1"
  exit "$3"
)

REASONED: Django DEBUG and ALLOWED_HOSTS checks for section 2, from Django 6.1's settings, system-check and django-admin references cited below; no Django project is available here, so no run is recorded. In the project's directory, with the production settings module loaded, run python manage.py shell --no-imports -c "from django.conf import settings; print(repr(settings.DEBUG), '*' in settings.ALLOWED_HOSTS, len(settings.ALLOWED_HOSTS))", which prints three values and no host names or secrets. --no-imports turns off the automatic imports the cited page documents for shell, so they add nothing to the output, and repr prints a string value such as 'False' with its quotes, which is not the fixed state. The fixed state is exactly False False followed by a number of 1 or more. A first value of True is the exposed state for DEBUG. A second value of True means '*' is listed, which leaves Host validation to you and is the exposed state by this guide's advice. A count of 0 is the exposed state for ALLOWED_HOSTS. A traceback, an import error, no output or any other output is inconclusive, never a pass. Then run python manage.py check --deploy: output naming security.W018 ("You should not have DEBUG set to True in deployment.") or security.W020 ("ALLOWED_HOSTS must not be empty in deployment.") is the exposed state. Its silence on both is not a pass by itself, because a run that fails to load the settings names neither warning, and W020, by its wording, covers only an empty list, not '*'; read it only alongside the shell line above, and only when it ran to completion without an error. Both commands read the settings they load, so they do not show that the deployed process uses the same settings module.

Sources (checked September 2026)

The month in this heading is the month of the whole-guide documentation pass, and an item that carries its own later "checked" month was rechecked individually after that pass, so the later month applies to that item only.

About the AI assistant section below

This generated section holds the recorded versions, claim statuses and source mappings for AI assistants; use the prompt at the top. This guide is guidance to verify against your own deployment, not a certification, an audit, or a guarantee of compliance with any standard.

Version basis

AI assistants must compare the versions listed below with current releases and treat this guide as guidance, re-verifying version-specific defaults when newer releases exist.

DEMONSTRATED refers to historical evidence in this guide; REASONED records source reasoning, and any earlier-form run it rests on, not a live demonstration of the shipped form. Unknown means no version recorded.

Components (recorded basis):

  • django: Django documentation (6.1)
  • python: Python http.server documentation (3.14.4)
  • python-pin: Python http.server source (v3.14.10)
  • stdlib-docs: Python standard library documentation (3.14)
  • cpython-ssl: CPython ssl source and documentation (v3.14.10)
  • cpython-ssl-3149: CPython ssl source (v3.14.9)
  • cpython-secrets: CPython secrets documentation and source (v3.14.10)
  • gunicorn: Gunicorn documentation (unknown)
  • uvicorn: Uvicorn source (5ac6265a01ff6dcadb0e4250152c3deaf8a168a9)
  • fastapi: FastAPI documentation (unknown)
  • oidc-stub: FastAPI OpenIdConnect source (31bbb380748ccead62fc0f42dbf4273f11dadccf)
  • bcrypt-api: Python bcrypt API example (2b4ba9ac84df972e8e81311d09559af8dc82ef33)
  • werkzeug: Werkzeug documentation (unknown)
  • argon: argon2-cffi documentation (unknown)
  • pyotp: PyOTP (v2.9.0)
  • qrcode: qrcode (v8.2)
  • django-otp: django-otp (1.6.1)
  • requests: Requests (v2.32.3)
  • slowapi: slowapi source (v0.1.10)
  • httpx: HTTPX source and documentation (0.28.1)
  • openssl: OpenSSL documentation (openssl-4.0.3)
  • openssl-359: OpenSSL documentation (openssl-3.5.9)
  • argon-api: argon2-cffi API example (25.1.0)
  • render: Render documentation (unknown)
  • heroku: Heroku documentation (unknown)
  • fly-pinned: Fly.io pinned documentation (2f68a40e09bb6ef4c4ac6f90c15c1cf5a176d7e9)
  • railway: Railway documentation (72354493198302677fb6be6c692dd75c64cae2c6)

Claims (full source mapping in the JSON block below):

  • bind (REASONED; gunicorn, uvicorn, render, heroku, fly-pinned, railway): Guide advice: loopback behind same-host TLS proxies, no extra managed listeners, wildcard only for authenticated TLS ingress, direct or private; app auth required. Railway: 0.0.0.0 on injected PORT, edge TLS; Fly w/o handlers: TCP passthrough; Heroku web processes must bind PORT, IPv6/dual-stack advised for Fir Private Spaces; checked pages state no Cedar address (guide's view, not proof any address works).
  • flask-tls (REASONED; werkzeug): Flask development server binds 127.0.0.1:8443 with cert/key ssl_context; adhoc requires cryptography and remains development-only.
  • gunicorn-tls (REASONED; gunicorn): Gunicorn binds 0.0.0.0:8443 with --certfile and --keyfile for direct TLS.
  • uvicorn-tls (REASONED; uvicorn): Uvicorn binds 0.0.0.0:8443 with --ssl-certfile and --ssl-keyfile for direct TLS.
  • django-redirect (REASONED; django): Set SECURE_SSL_REDIRECT=True.
  • django-proxy (REASONED; django): Guide advice: set SECURE_PROXY_SSL_HEADER only behind a trusted proxy that strips and replaces X-Forwarded-Proto; prevent direct bypass.
  • django-cookies (REASONED; django): Set SESSION_COOKIE_SECURE and CSRF_COOKIE_SECURE true.
  • django-hsts (REASONED; django): Guide advice: begin HSTS at 3600 seconds and include-subdomains false; raise duration and scope only after valid HTTPS is confirmed.
  • deploy-check (REASONED; django): The Django deployment checklist says to run manage.py check --deploy. Guide advice: fix its findings.
  • django-debug (REASONED; django): Set DEBUG = False in production; Django 6.1 says never to deploy with DEBUG on, as debug pages leak source excerpts, local variables and settings. check --deploy reports security.W018 when DEBUG is True.
  • django-hosts (REASONED; django): Set ALLOWED_HOSTS to the site's host names; it guards against HTTP Host header attacks, a wildcard leaves Host validation to you, and with DEBUG False an empty list returns 400 for every request. check --deploy reports security.W020 when it is empty.
  • verify-django-settings (REASONED; django): Guide advice: manage.py shell -c printing DEBUG, whether a wildcard is in ALLOWED_HOSTS and its length must print False False and 1 or more; anything else, including errors or no output, is not a pass. check --deploy naming W018 or W020 is exposed, but its silence alone is not a pass.
  • password (REASONED; django, argon, argon-api, bcrypt-api): Keep Django's built-in hashing; do not replace it with custom code (guide advice). For Flask/FastAPI apps implementing local password accounts, this guide advises account storage and argon2-cffi or bcrypt under authentication.md's constraints; argon2-cffi 25.1.0's PasswordHasher.verify raises VerifyMismatchError on mismatch, and these APIs do not establish framework user-store capabilities.
  • secrets (REASONED; django, stdlib-docs, cpython-secrets): Generate secrets.token_urlsafe(32) and load secrets from the environment (guide advice); 32 counts random input bytes and is this guide's example choice, not a universal size. CPython v3.14.10 uses DEFAULT_ENTROPY (32 bytes) when omitted or None, but that default may change, including in maintenance releases.
  • credential-extraction (REASONED; fastapi): FastAPI security helpers extract credentials and declare schemes; presence/scheme checks do not verify signature, issuer, audience or expiry.
  • oidc (REASONED; fastapi, oidc-stub): OpenIdConnect is a stub and does not use its discovery URL; validate extracted tokens with an OIDC library and authorize separately.
  • login-limit (REASONED; fastapi, slowapi): Rate-limiting login routes and a proxy-level limit are this guide's advice. slowapi v0.1.10 documents limits for Starlette/FastAPI HTTP endpoints; endpoints using its limit decorator must take an explicit request argument, and WebSocket endpoints are not supported.
  • mfa (REASONED; django, pyotp, qrcode, django-otp): Use pyotp and qrcode, django-otp for Django, or linked MFA guidance.
  • client-validation (REASONED; python, requests, httpx, cpython-ssl): Never ship requests/httpx verify=False or ssl._create_unverified_context; HTTPX documents verify=False and CPython defines _create_unverified_context. The prohibition is this guide's advice.
  • client-ca (REASONED; cpython-ssl, cpython-ssl-3149, openssl, openssl-359): ssl gives OpenSSL default paths/env vars; verifying create_default_context w/o CA tries defaults (may fail silently), after _MSC_VER win32 CA/ROOT stores; ssl.py, _ssl.c, clinic header, 3 read _ssl/ includes lack macOS store code. 3.14.10: 8 listed eMudhra CA keys fail cert verification, any CA source. SSL_CERT_FILE/DIR use inferred per cited OpenSSL; linked OpenSSL, stores, deployment unverified.
  • client-ca-httpx (REASONED; httpx): HTTPX 0.28.1's transport passes verify and trust_env to create_ssl_context, which reads SSL_CERT_FILE when verify=True and trust_env=True; its SSL guide contradicts that source. Its environment guide says environment variables are used by default but does not list SSL_CERT_FILE.
  • client-ca-advice (REASONED; requests, httpx, cpython-ssl, openssl, openssl-359): REQUESTS_CA_BUNDLE selects a requests CA. openssl-4.0.3 honours SSL_CERT_FILE/SSL_CERT_DIR for its default CA file/directory except in set-user-ID/set-group-ID executables (openssl-3.5.9 docs: whole environment usually not consulted). This guide's advice: use the exports for requests, the stated HTTPX path and CPython's qualified default-path call, or an explicit context for other configurations.
  • http-server-bind (REASONED; python-pin): As of Python 3.14.10, http.server binds every interface by default; explicitly bind 127.0.0.1:8000.
  • http-server-files (REASONED; python): http.server serves the current directory and follows symlinks outside it; it is unsuitable for production. Share only a non-private directory through an SSH tunnel.
  • verify-tls (REASONED; gunicorn, uvicorn): Public HTTPS must succeed without -k; certificate, chain, hostname and trust failures need investigation.
  • verify-auth (REASONED; django, fastapi): A real protected route denies no credentials with 401/403 and accepts valid file-supplied credentials with 2xx; logs or direct probing distinguish app from proxy enforcement.
  • verify-bind (REASONED; gunicorn, uvicorn): Guide advice: inspect every listener for loopback behind a same-host proxy or the required managed-ingress address and port.
{
  "schema": 1,
  "checked": "2026-11-06",
  "documentation_checked": "2026-09",
  "body_sha256": "b9f49b591123f0f2473d98a01e81b86fa9785b8d48bd723fa8edb79823fda4e4",
  "components": {
    "django": {
      "name": "Django documentation",
      "basis": "6.1",
      "sources": {
        "s7289e1c111ae": "https://docs.djangoproject.com/en/6.1/howto/deployment/checklist/",
        "sdad568b908d4": "https://docs.djangoproject.com/en/6.1/ref/settings/#debug",
        "sb6ca09be0c98": "https://docs.djangoproject.com/en/6.1/ref/settings/#allowed-hosts",
        "s2f10535d1755": "https://docs.djangoproject.com/en/6.1/ref/checks/#security",
        "s70ca478a857d": "https://docs.djangoproject.com/en/6.1/ref/django-admin/#cmdoption-check-deploy"
      }
    },
    "python": {
      "name": "Python http.server documentation",
      "basis": "3.14.4",
      "sources": {
        "s8fae94406709": "https://docs.python.org/3/library/http.server.html"
      }
    },
    "python-pin": {
      "name": "Python http.server source",
      "basis": "v3.14.10",
      "sources": {
        "s4f2ce0f2d249": "https://github.com/python/cpython/blob/v3.14.10/Lib/http/server.py#L1326-L1338",
        "sff1a6765fff4": "https://github.com/python/cpython/blob/v3.14.10/Lib/http/server.py#L1375-L1377"
      }
    },
    "stdlib-docs": {
      "name": "Python standard library documentation",
      "basis": "3.14",
      "sources": {
        "s971d128efc65": "https://docs.python.org/3.14/library/secrets.html",
        "sdad376a711c3": "https://docs.python.org/3.14/library/os.html#os.getenv"
      }
    },
    "cpython-ssl": {
      "name": "CPython ssl source and documentation",
      "basis": "v3.14.10",
      "sources": {
        "s75d453b1f46c": "https://github.com/python/cpython/blob/v3.14.10/Lib/ssl.py#L390-L405",
        "s3a116911a8c3": "https://github.com/python/cpython/blob/v3.14.10/Lib/ssl.py#L542-L548",
        "se68659ffc532": "https://github.com/python/cpython/blob/v3.14.10/Lib/ssl.py#L730-L736",
        "sf3f2da11f578": "https://github.com/python/cpython/blob/v3.14.10/Lib/ssl.py#L744-L754",
        "s991f2eca1452": "https://github.com/python/cpython/blob/v3.14.10/Doc/library/ssl.rst#L421-L433",
        "sb2149c4d150d": "https://github.com/python/cpython/blob/v3.14.10/Doc/library/ssl.rst#L1650-L1657",
        "s582b7959104d": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L4677-L4696",
        "s698db797c917": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L5943-L5984",
        "s4ce22e36a10d": "https://github.com/python/cpython/blob/v3.14.10/Lib/ssl.py#L257-L258",
        "s2fb5328e9280": "https://github.com/python/cpython/blob/v3.14.10/Lib/ssl.py#L439-L439",
        "sf4ca40d7d2c7": "https://github.com/python/cpython/blob/v3.14.10/Lib/ssl.py#L529-L540",
        "s3090ebe73d48": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L6089-L6142",
        "s5b3f1f7bb55a": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L6144-L6191",
        "sa67df222bc40": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L6193-L6291",
        "s403133e21b82": "https://github.com/python/cpython/blob/v3.14.10/Modules/clinic/_ssl.c.h#L2811-L2980",
        "s15a452345fdf": "https://github.com/python/cpython/blob/v3.14.10/Modules/clinic/_ssl.c.h#L1-L2981",
        "s67ad0451c2e4": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L6061-L6380",
        "s5c1119a02258": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L6389-L6390",
        "s6321f4512a60": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L428-L428",
        "s1c0c355f821f": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L1836-L1837",
        "sa9ca6235a1a9": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L3083-L3083",
        "s5e29fb3c3ce9": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L3085-L3114",
        "s57ce05cdea81": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L3116-L3141",
        "sf01a7ef966ec": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L3167-L3167",
        "s53e0dbce9da5": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl/distrusted_spki.h#L23-L73",
        "s69dc2acbb937": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl/distrusted_spki.h#L1-L17",
        "s9ae41359aa34": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L3143-L3169",
        "s5edff147f433": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L3285-L3298",
        "s682c08f22389": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L3604-L3618",
        "s6d08dc565fc8": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L3998-L4015",
        "sadefae68ec7b": "https://github.com/python/cpython/blob/v3.14.10/Doc/library/ssl.rst#L483-L492",
        "s1d76d4454ec2": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L936-L954",
        "s391cda9a0090": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L723-L733",
        "sd1770e02b78d": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L517-L553",
        "sc6f21a0db06f": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl.c#L619-L626",
        "s38ff06b93c8e": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl/cert.c#L1-L251",
        "s797ee692f3e3": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl/misc.c#L1-L34",
        "s4fa35850ded9": "https://github.com/python/cpython/blob/v3.14.10/Modules/_ssl/debughelpers.c#L1-L240",
        "s394797cf1988": "https://github.com/python/cpython/blob/v3.14.10/PCbuild/get_externals.bat#L57-L57",
        "sa129690241f0": "https://github.com/python/cpython/blob/v3.14.10/PCbuild/get_externals.bat#L82-L82",
        "s6ca732f7e53d": "https://github.com/python/cpython/blob/v3.14.10/Mac/BuildScript/build-installer.py#L249-L252"
      }
    },
    "cpython-ssl-3149": {
      "name": "CPython ssl source",
      "basis": "v3.14.9",
      "sources": {
        "s65ba2864e2d4": "https://github.com/python/cpython/blob/v3.14.9/Modules/_ssl.c#L3098-L3098"
      }
    },
    "cpython-secrets": {
      "name": "CPython secrets documentation and source",
      "basis": "v3.14.10",
      "sources": {
        "s416f4713b5f7": "https://github.com/python/cpython/blob/v3.14.10/Doc/library/secrets.rst#L91-L103",
        "sfb3ebebb7112": "https://github.com/python/cpython/blob/v3.14.10/Lib/secrets.py#L31-L45",
        "sfd1f5e77a0e1": "https://github.com/python/cpython/blob/v3.14.10/Doc/library/secrets.rst#L125-L130"
      }
    },
    "gunicorn": {
      "name": "Gunicorn documentation",
      "basis": "unknown",
      "sources": {
        "s72daf362300c": "https://gunicorn.org/reference/settings/"
      }
    },
    "uvicorn": {
      "name": "Uvicorn source",
      "basis": "5ac6265a01ff6dcadb0e4250152c3deaf8a168a9",
      "sources": {
        "s02429a4a09d9": "https://github.com/Kludex/uvicorn/blob/5ac6265a01ff6dcadb0e4250152c3deaf8a168a9/docs/settings.md"
      }
    },
    "fastapi": {
      "name": "FastAPI documentation",
      "basis": "unknown",
      "sources": {
        "s077aff608a5c": "https://fastapi.tiangolo.com/reference/security/"
      }
    },
    "oidc-stub": {
      "name": "FastAPI OpenIdConnect source",
      "basis": "31bbb380748ccead62fc0f42dbf4273f11dadccf",
      "sources": {
        "s876e3d51e7ac": "https://github.com/fastapi/fastapi/blob/31bbb380748ccead62fc0f42dbf4273f11dadccf/fastapi/security/open_id_connect_url.py"
      }
    },
    "bcrypt-api": {
      "name": "Python bcrypt API example",
      "basis": "2b4ba9ac84df972e8e81311d09559af8dc82ef33",
      "sources": {
        "s340a2923b6da": "https://github.com/pyca/bcrypt/blob/2b4ba9ac84df972e8e81311d09559af8dc82ef33/README.rst#L62-L76"
      }
    },
    "werkzeug": {
      "name": "Werkzeug documentation",
      "basis": "unknown",
      "sources": {
        "sd5066c63a3ca": "https://werkzeug.palletsprojects.com/en/stable/serving/"
      }
    },
    "argon": {
      "name": "argon2-cffi documentation",
      "basis": "unknown",
      "sources": {
        "s685ac81e6157": "https://argon2-cffi.readthedocs.io/en/stable/"
      }
    },
    "pyotp": {
      "name": "PyOTP",
      "basis": "v2.9.0",
      "sources": {
        "sc118b8ed3bdd": "https://github.com/pyauth/pyotp/blob/v2.9.0/README.rst#L4-L5"
      }
    },
    "qrcode": {
      "name": "qrcode",
      "basis": "v8.2",
      "sources": {
        "s8247ddfed3d3": "https://github.com/lincolnloop/python-qrcode/blob/v8.2/README.rst#L41-L44"
      }
    },
    "django-otp": {
      "name": "django-otp",
      "basis": "1.6.1",
      "sources": {
        "sa5c0f7097219": "https://pypi.org/project/django-otp/1.6.1/"
      }
    },
    "requests": {
      "name": "Requests",
      "basis": "v2.32.3",
      "sources": {
        "s21c6be6f6df4": "https://github.com/psf/requests/blob/v2.32.3/docs/user/advanced.rst#L238-L239",
        "s17c5a0a7ffb2": "https://github.com/psf/requests/blob/v2.32.3/docs/user/advanced.rst#L241-L243"
      }
    },
    "slowapi": {
      "name": "slowapi source",
      "basis": "v0.1.10",
      "sources": {
        "sf150aa58aa31": "https://github.com/laurentS/slowapi/blob/v0.1.10/README.md#L1-L3",
        "s4ca3e1e80817": "https://github.com/laurentS/slowapi/blob/v0.1.10/README.md#L24-L50"
      }
    },
    "httpx": {
      "name": "HTTPX source and documentation",
      "basis": "0.28.1",
      "sources": {
        "s52608d6c5e47": "https://github.com/encode/httpx/blob/0.28.1/docs/environment_variables.md#L3-L7",
        "sd33b79237122": "https://github.com/encode/httpx/blob/0.28.1/docs/environment_variables.md#L9-L53",
        "s928d85a8d13e": "https://github.com/encode/httpx/blob/0.28.1/docs/advanced/ssl.md#L12-L17",
        "s3734fbccdf40": "https://github.com/encode/httpx/blob/0.28.1/docs/advanced/ssl.md#L72-L86",
        "s30dd14bf172e": "https://github.com/encode/httpx/blob/0.28.1/httpx/_config.py#L23-L40",
        "s4a1f3b43f184": "https://github.com/encode/httpx/blob/0.28.1/httpx/_transports/default.py#L133-L154",
        "sc5a61a9b2f64": "https://github.com/encode/httpx/blob/0.28.1/httpx/_transports/default.py#L278-L298"
      }
    },
    "openssl": {
      "name": "OpenSSL documentation",
      "basis": "openssl-4.0.3",
      "sources": {
        "s592eb65718de": "https://github.com/openssl/openssl/blob/openssl-4.0.3/doc/man3/SSL_CTX_load_verify_locations.pod#L39-L49",
        "sfd19784d8a21": "https://github.com/openssl/openssl/blob/openssl-4.0.3/doc/man7/openssl-env.pod#L9-L13",
        "s42c9a65f2ad7": "https://github.com/openssl/openssl/blob/openssl-4.0.3/doc/man7/openssl-env.pod#L289-L298"
      }
    },
    "openssl-359": {
      "name": "OpenSSL documentation",
      "basis": "openssl-3.5.9",
      "sources": {
        "s5408e859b283": "https://github.com/openssl/openssl/blob/openssl-3.5.9/doc/man3/SSL_CTX_load_verify_locations.pod#L39-L49",
        "sa9824d577783": "https://github.com/openssl/openssl/blob/openssl-3.5.9/doc/man7/openssl-env.pod#L9-L12",
        "scfb918b988fe": "https://github.com/openssl/openssl/blob/openssl-3.5.9/doc/man7/openssl-env.pod#L168-L173"
      }
    },
    "argon-api": {
      "name": "argon2-cffi API example",
      "basis": "25.1.0",
      "sources": {
        "s193f86db0a79": "https://github.com/hynek/argon2-cffi/blob/25.1.0/README.md#L11-L28"
      }
    },
    "render": {
      "name": "Render documentation",
      "basis": "unknown",
      "sources": {
        "s1820ac471b6c": "https://render.com/docs/web-services"
      }
    },
    "heroku": {
      "name": "Heroku documentation",
      "basis": "unknown",
      "sources": {
        "s370d4beec29a": "https://devcenter.heroku.com/articles/runtime-principles",
        "s211f5fe76042": "https://devcenter.heroku.com/articles/generations",
        "s0c5bf300cef4": "https://devcenter.heroku.com/articles/http-routing",
        "s110a083f7129": "https://devcenter.heroku.com/articles/deploying-nodejs",
        "s41677c652b96": "https://devcenter.heroku.com/articles/dynos",
        "s9f4dec283014": "https://devcenter.heroku.com/articles/procfile",
        "s8a2465cbd6c2": "https://devcenter.heroku.com/articles/python-gunicorn",
        "sb941efbc6dd5": "https://devcenter.heroku.com/articles/getting-started-with-python",
        "sa2690945ce1c": "https://devcenter.heroku.com/articles/getting-started-with-nodejs",
        "s3563a06d3934": "https://devcenter.heroku.com/articles/node-best-practices"
      }
    },
    "fly-pinned": {
      "name": "Fly.io pinned documentation",
      "basis": "2f68a40e09bb6ef4c4ac6f90c15c1cf5a176d7e9",
      "sources": {
        "s62fec91543a1": "https://github.com/superfly/docs/blob/2f68a40e09bb6ef4c4ac6f90c15c1cf5a176d7e9/networking/app-services.mdx#L33-L42",
        "s61c1e50d2c11": "https://github.com/superfly/docs/blob/2f68a40e09bb6ef4c4ac6f90c15c1cf5a176d7e9/networking/app-services.mdx#L92-L92",
        "s254c8c8a5edd": "https://github.com/superfly/docs/blob/2f68a40e09bb6ef4c4ac6f90c15c1cf5a176d7e9/networking/services.mdx#L93-L97",
        "s32999aa4c58c": "https://github.com/superfly/docs/blob/2f68a40e09bb6ef4c4ac6f90c15c1cf5a176d7e9/networking/services.mdx#L174-L176"
      }
    },
    "railway": {
      "name": "Railway documentation",
      "basis": "72354493198302677fb6be6c692dd75c64cae2c6",
      "sources": {
        "sac1383056b65": "https://github.com/railwayapp/docs/blob/72354493198302677fb6be6c692dd75c64cae2c6/content/docs/networking/domains/working-with-domains.md#L126-L146",
        "s0462eef65b1b": "https://github.com/railwayapp/docs/blob/72354493198302677fb6be6c692dd75c64cae2c6/content/docs/networking/troubleshooting/application-failed-to-respond.md#L46-L51",
        "sa9d326046a7f": "https://github.com/railwayapp/docs/blob/72354493198302677fb6be6c692dd75c64cae2c6/content/docs/networking/edge-networking.md#L40-L43"
      }
    }
  },
  "claims": {
    "bind": {"text": "Guide advice: loopback behind same-host TLS proxies, no extra managed listeners, wildcard only for authenticated TLS ingress, direct or private; app auth required. Railway: 0.0.0.0 on injected PORT, edge TLS; Fly w/o handlers: TCP passthrough; Heroku web processes must bind PORT, IPv6/dual-stack advised for Fir Private Spaces; checked pages state no Cedar address (guide's view, not proof any address works).", "components": ["gunicorn", "uvicorn", "render", "heroku", "fly-pinned", "railway"], "sources": ["gunicorn:s72daf362300c", "uvicorn:s02429a4a09d9", "render:s1820ac471b6c", "heroku:s370d4beec29a", "heroku:s211f5fe76042", "heroku:s0c5bf300cef4", "heroku:s110a083f7129", "heroku:s41677c652b96", "heroku:s9f4dec283014", "heroku:s8a2465cbd6c2", "heroku:sb941efbc6dd5", "heroku:sa2690945ce1c", "heroku:s3563a06d3934", "fly-pinned:s62fec91543a1", "fly-pinned:s61c1e50d2c11", "fly-pinned:s254c8c8a5edd", "fly-pinned:s32999aa4c58c", "railway:sac1383056b65", "railway:s0462eef65b1b", "railway:sa9d326046a7f"], "status": "REASONED"},
    "flask-tls": {"text": "Flask development server binds 127.0.0.1:8443 with cert/key ssl_context; adhoc requires cryptography and remains development-only.", "components": ["werkzeug"], "sources": ["werkzeug:sd5066c63a3ca"], "status": "REASONED"},
    "gunicorn-tls": {"text": "Gunicorn binds 0.0.0.0:8443 with --certfile and --keyfile for direct TLS.", "components": ["gunicorn"], "sources": ["gunicorn:s72daf362300c"], "status": "REASONED"},
    "uvicorn-tls": {"text": "Uvicorn binds 0.0.0.0:8443 with --ssl-certfile and --ssl-keyfile for direct TLS.", "components": ["uvicorn"], "sources": ["uvicorn:s02429a4a09d9"], "status": "REASONED"},
    "django-redirect": {"text": "Set SECURE_SSL_REDIRECT=True.", "components": ["django"], "sources": ["django:s7289e1c111ae"], "status": "REASONED"},
    "django-proxy": {"text": "Guide advice: set SECURE_PROXY_SSL_HEADER only behind a trusted proxy that strips and replaces X-Forwarded-Proto; prevent direct bypass.", "components": ["django"], "sources": ["django:s7289e1c111ae"], "status": "REASONED"},
    "django-cookies": {"text": "Set SESSION_COOKIE_SECURE and CSRF_COOKIE_SECURE true.", "components": ["django"], "sources": ["django:s7289e1c111ae"], "status": "REASONED"},
    "django-hsts": {"text": "Guide advice: begin HSTS at 3600 seconds and include-subdomains false; raise duration and scope only after valid HTTPS is confirmed.", "components": ["django"], "sources": ["django:s7289e1c111ae"], "status": "REASONED"},
    "deploy-check": {"text": "The Django deployment checklist says to run manage.py check --deploy. Guide advice: fix its findings.", "components": ["django"], "sources": ["django:s7289e1c111ae"], "status": "REASONED"},
    "django-debug": {"text": "Set DEBUG = False in production; Django 6.1 says never to deploy with DEBUG on, as debug pages leak source excerpts, local variables and settings. check --deploy reports security.W018 when DEBUG is True.", "components": ["django"], "sources": ["django:s7289e1c111ae", "django:sdad568b908d4", "django:s2f10535d1755"], "status": "REASONED"},
    "django-hosts": {"text": "Set ALLOWED_HOSTS to the site's host names; it guards against HTTP Host header attacks, a wildcard leaves Host validation to you, and with DEBUG False an empty list returns 400 for every request. check --deploy reports security.W020 when it is empty.", "components": ["django"], "sources": ["django:s7289e1c111ae", "django:sb6ca09be0c98", "django:sdad568b908d4", "django:s2f10535d1755"], "status": "REASONED"},
    "verify-django-settings": {"text": "Guide advice: manage.py shell -c printing DEBUG, whether a wildcard is in ALLOWED_HOSTS and its length must print False False and 1 or more; anything else, including errors or no output, is not a pass. check --deploy naming W018 or W020 is exposed, but its silence alone is not a pass.", "components": ["django"], "sources": ["django:s70ca478a857d", "django:sb6ca09be0c98", "django:sdad568b908d4", "django:s2f10535d1755"], "status": "REASONED"},
    "password": {"text": "Keep Django's built-in hashing; do not replace it with custom code (guide advice). For Flask/FastAPI apps implementing local password accounts, this guide advises account storage and argon2-cffi or bcrypt under authentication.md's constraints; argon2-cffi 25.1.0's PasswordHasher.verify raises VerifyMismatchError on mismatch, and these APIs do not establish framework user-store capabilities.", "components": ["django", "argon", "argon-api", "bcrypt-api"], "sources": ["django:s7289e1c111ae", "argon:s685ac81e6157", "argon-api:s193f86db0a79", "bcrypt-api:s340a2923b6da"], "status": "REASONED"},
    "secrets": {"text": "Generate secrets.token_urlsafe(32) and load secrets from the environment (guide advice); 32 counts random input bytes and is this guide's example choice, not a universal size. CPython v3.14.10 uses DEFAULT_ENTROPY (32 bytes) when omitted or None, but that default may change, including in maintenance releases.", "components": ["django", "stdlib-docs", "cpython-secrets"], "sources": ["django:s7289e1c111ae", "stdlib-docs:s971d128efc65", "stdlib-docs:sdad376a711c3", "cpython-secrets:s416f4713b5f7", "cpython-secrets:sfb3ebebb7112", "cpython-secrets:sfd1f5e77a0e1"], "status": "REASONED"},
    "credential-extraction": {"text": "FastAPI security helpers extract credentials and declare schemes; presence/scheme checks do not verify signature, issuer, audience or expiry.", "components": ["fastapi"], "sources": ["fastapi:s077aff608a5c"], "status": "REASONED"},
    "oidc": {"text": "OpenIdConnect is a stub and does not use its discovery URL; validate extracted tokens with an OIDC library and authorize separately.", "components": ["fastapi", "oidc-stub"], "sources": ["fastapi:s077aff608a5c", "oidc-stub:s876e3d51e7ac"], "status": "REASONED"},
    "login-limit": {"text": "Rate-limiting login routes and a proxy-level limit are this guide's advice. slowapi v0.1.10 documents limits for Starlette/FastAPI HTTP endpoints; endpoints using its limit decorator must take an explicit request argument, and WebSocket endpoints are not supported.", "components": ["fastapi", "slowapi"], "sources": ["fastapi:s077aff608a5c", "slowapi:sf150aa58aa31", "slowapi:s4ca3e1e80817"], "status": "REASONED"},
    "mfa": {"text": "Use pyotp and qrcode, django-otp for Django, or linked MFA guidance.", "components": ["django", "pyotp", "qrcode", "django-otp"], "sources": ["django:s7289e1c111ae", "pyotp:sc118b8ed3bdd", "qrcode:s8247ddfed3d3", "django-otp:sa5c0f7097219"], "status": "REASONED"},
    "client-validation": {"text": "Never ship requests/httpx verify=False or ssl._create_unverified_context; HTTPX documents verify=False and CPython defines _create_unverified_context. The prohibition is this guide's advice.", "components": ["python", "requests", "httpx", "cpython-ssl"], "sources": ["python:s8fae94406709", "requests:s17c5a0a7ffb2", "httpx:s928d85a8d13e", "cpython-ssl:sf3f2da11f578"], "status": "REASONED"},
    "client-ca": {"text": "ssl gives OpenSSL default paths/env vars; verifying create_default_context w/o CA tries defaults (may fail silently), after _MSC_VER win32 CA/ROOT stores; ssl.py, _ssl.c, clinic header, 3 read _ssl/ includes lack macOS store code. 3.14.10: 8 listed eMudhra CA keys fail cert verification, any CA source. SSL_CERT_FILE/DIR use inferred per cited OpenSSL; linked OpenSSL, stores, deployment unverified.", "components": ["cpython-ssl", "cpython-ssl-3149", "openssl", "openssl-359"], "sources": ["cpython-ssl:s75d453b1f46c", "cpython-ssl:s3a116911a8c3", "cpython-ssl:se68659ffc532", "cpython-ssl:s991f2eca1452", "cpython-ssl:sb2149c4d150d", "cpython-ssl:s582b7959104d", "cpython-ssl:s698db797c917", "cpython-ssl:s4ce22e36a10d", "cpython-ssl:s2fb5328e9280", "cpython-ssl:sf4ca40d7d2c7", "cpython-ssl:s3090ebe73d48", "cpython-ssl:s5b3f1f7bb55a", "cpython-ssl:sa67df222bc40", "cpython-ssl:s403133e21b82", "cpython-ssl:s15a452345fdf", "cpython-ssl:s67ad0451c2e4", "cpython-ssl:s5c1119a02258", "cpython-ssl:s6321f4512a60", "cpython-ssl:s1c0c355f821f", "cpython-ssl:sa9ca6235a1a9", "cpython-ssl:s5e29fb3c3ce9", "cpython-ssl:s57ce05cdea81", "cpython-ssl:sf01a7ef966ec", "cpython-ssl:s53e0dbce9da5", "cpython-ssl:s69dc2acbb937", "cpython-ssl:s9ae41359aa34", "cpython-ssl:s5edff147f433", "cpython-ssl:s682c08f22389", "cpython-ssl:s6d08dc565fc8", "cpython-ssl:sadefae68ec7b", "cpython-ssl:s1d76d4454ec2", "cpython-ssl:s391cda9a0090", "cpython-ssl:sd1770e02b78d", "cpython-ssl:sc6f21a0db06f", "cpython-ssl-3149:s65ba2864e2d4", "cpython-ssl:s38ff06b93c8e", "cpython-ssl:s797ee692f3e3", "cpython-ssl:s4fa35850ded9", "cpython-ssl:s394797cf1988", "cpython-ssl:sa129690241f0", "cpython-ssl:s6ca732f7e53d", "openssl:s592eb65718de", "openssl:sfd19784d8a21", "openssl:s42c9a65f2ad7", "openssl-359:s5408e859b283", "openssl-359:sa9824d577783", "openssl-359:scfb918b988fe"], "status": "REASONED"},
    "client-ca-httpx": {"text": "HTTPX 0.28.1's transport passes verify and trust_env to create_ssl_context, which reads SSL_CERT_FILE when verify=True and trust_env=True; its SSL guide contradicts that source. Its environment guide says environment variables are used by default but does not list SSL_CERT_FILE.", "components": ["httpx"], "sources": ["httpx:s52608d6c5e47", "httpx:sd33b79237122", "httpx:s3734fbccdf40", "httpx:s30dd14bf172e", "httpx:s4a1f3b43f184", "httpx:sc5a61a9b2f64"], "status": "REASONED"},
    "client-ca-advice": {"text": "REQUESTS_CA_BUNDLE selects a requests CA. openssl-4.0.3 honours SSL_CERT_FILE/SSL_CERT_DIR for its default CA file/directory except in set-user-ID/set-group-ID executables (openssl-3.5.9 docs: whole environment usually not consulted). This guide's advice: use the exports for requests, the stated HTTPX path and CPython's qualified default-path call, or an explicit context for other configurations.", "components": ["requests", "httpx", "cpython-ssl", "openssl", "openssl-359"], "sources": ["requests:s21c6be6f6df4", "httpx:s3734fbccdf40", "httpx:s30dd14bf172e", "httpx:s4a1f3b43f184", "httpx:sc5a61a9b2f64", "cpython-ssl:s3a116911a8c3", "cpython-ssl:se68659ffc532", "cpython-ssl:s582b7959104d", "openssl:s592eb65718de", "openssl:sfd19784d8a21", "openssl:s42c9a65f2ad7", "openssl-359:s5408e859b283", "openssl-359:sa9824d577783"], "status": "REASONED"},
    "http-server-bind": {"text": "As of Python 3.14.10, http.server binds every interface by default; explicitly bind 127.0.0.1:8000.", "components": ["python-pin"], "sources": ["python-pin:s4f2ce0f2d249", "python-pin:sff1a6765fff4"], "status": "REASONED"},
    "http-server-files": {"text": "http.server serves the current directory and follows symlinks outside it; it is unsuitable for production. Share only a non-private directory through an SSH tunnel.", "components": ["python"], "sources": ["python:s8fae94406709"], "status": "REASONED"},
    "verify-tls": {"text": "Public HTTPS must succeed without -k; certificate, chain, hostname and trust failures need investigation.", "components": ["gunicorn", "uvicorn"], "sources": ["gunicorn:s72daf362300c", "uvicorn:s02429a4a09d9"], "status": "REASONED", "verify": [1]},
    "verify-auth": {"text": "A real protected route denies no credentials with 401/403 and accepts valid file-supplied credentials with 2xx; logs or direct probing distinguish app from proxy enforcement.", "components": ["django", "fastapi"], "sources": ["django:s7289e1c111ae", "fastapi:s077aff608a5c"], "status": "REASONED", "verify": [1]},
    "verify-bind": {"text": "Guide advice: inspect every listener for loopback behind a same-host proxy or the required managed-ingress address and port.", "components": ["gunicorn", "uvicorn"], "sources": ["gunicorn:s72daf362300c", "uvicorn:s02429a4a09d9"], "status": "REASONED", "verify": [1]}
  }
}