Skip to content

feat: framework models for Flask, FastAPI and SQLAlchemy - #31

Merged
SizzleUnrlsd merged 2 commits into
mainfrom
feat/frameworks
Sep 3, 2026
Merged

SizzleUnrlsd merged 2 commits into
mainfrom
feat/frameworks

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

Summary

Opens Phase 7 of docs/architecture.md: framework model plugins (§15, §25, §36). Detectors stay generic; frameworks only enrich the model.

  • Acceptance tests first (test: define framework model behavior), implementation follows.
  • Three engine mechanisms, all framework-agnostic:
    • a module-level name = Symbol(...) binds name to that symbol in the symbol table, so app.route resolves to python.flask.Flask.route when app = Flask(__name__);
    • inside functions, call results and with contexts carry their callee's symbol (call-chain rule), so conn.cursor().execute resolves to python.sqlite3.connect.cursor.execute; the call graph exposes these derived symbols and the taint engine reads sources through them;
    • a new EntryPoint model taints every parameter of a function decorated by its symbol, which is how route handler arguments become HTTP input.
  • A source covers the symbols below it (flask.request.args also covers request.args.get), and a method called on a tainted object returns tainted data.
  • Shipped model plugins: models/flask (request sources, Flask.route / Blueprint.route entry points, HTML and path sinks, escape sanitizers), models/fastapi (FastAPI and APIRouter route entry points, response sinks), models/sqlalchemy (raw execution sinks on engines, connections and sessions), and sqlite3 execution sinks in the stdlib models.

End to end with --check: a Flask route building a sqlite3 query from request.args is a SQL injection, render_template_string with request data is XSS unless escaped, and a <host> route parameter reaching os.system is a command injection. Same for FastAPI route parameters.

Not in this PR: Django (views are undecorated, so their request parameter needs parameter typing), Requests/httpx models, PossibleTargets in the call graph.

Part of #30

@SizzleUnrlsd SizzleUnrlsd mentioned this pull request Sep 3, 2026
6 tasks done
@SizzleUnrlsd SizzleUnrlsd self-assigned this Sep 3, 2026
@SizzleUnrlsd
SizzleUnrlsd merged commit f55de81 into main Sep 3, 2026
6 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the feat/frameworks branch September 3, 2026 23:26
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