Skip to content

Add Flask - #18

Merged
oritromax merged 1 commit into
mainfrom
add-flask
Aug 22, 2026
Merged

oritromax merged 1 commit into
mainfrom
add-flask

Conversation

@oritromax

Copy link
Copy Markdown
Owner

Tier 2, item 1. universal → python → web → python.flask, 6 new checks.

The debug one deserves its own paragraph

python.flask.debug-off is the most dangerous default catalogued here so far.
Flask's debug mode serves an interactive debugger on any unhandled exception,
and that debugger executes Python typed into the page. Reachable from the
internet, it is remote code execution as the application user — behind a pin
derived from information the same page leaks.

It is also two characters to enable and easy to leave on, which is why the check
looks in the code, the environment, the Dockerfile and the compose files rather
than just one of them.

Next to it, secret-key-strong-and-external: a committed or placeholder key
lets anyone mint a session for any user, including an administrator, without
touching the database. Both critical, both one line.

The rest

Production server rather than the built-in one (single-threaded, documented as
unsuitable), session cookies restricted to HTTPS and to the server, forwarded
headers behind a proxy, request bodies bounded.

Verification

Run against an application that gets all six wrong — app.run(debug=True),
SECRET_KEY = "dev", FLASK_DEBUG=1, CMD ["flask", "run"], no cookie flags,
no ProxyFix, no size limit — and against one that gets them all right. Both
directions confirmed.

The production-server check uses the quote-tolerant pattern learned from the
FastAPI PR, so it catches CMD ["flask", "run"] as well as the shell form. That
trap would otherwise have repeated here verbatim.

Six checks, and the first one is the most dangerous default this repository has
catalogued. Flask's debug mode serves an interactive debugger on any unhandled
exception, and that debugger executes Python typed into the page. Reachable
from the internet it is remote code execution as the application user, behind a
pin derived from information the same page leaks.

Beside it, a committed or placeholder secret key lets anyone mint a session for
any user, including an administrator, without touching the database. Both are
critical and both are one line.

The rest: a production server rather than the built-in one, which is
single-threaded and documented as unsuitable, session cookies restricted to
HTTPS and to the server, forwarded headers handled behind a proxy, and a bound
on request bodies.

Each command was run against an application that gets all six wrong and one
that gets them right. The production-server check uses the quote-tolerant
pattern learned from FastAPI, so it catches the Dockerfile exec form as well as
the shell form.
@oritromax
oritromax merged commit f79ad47 into main Aug 22, 2026
1 check passed
@oritromax
oritromax deleted the add-flask branch August 22, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant