Repository navigation
feat: framework models for Flask, FastAPI and SQLAlchemy - #31
Merged
Merged
Conversation
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opens Phase 7 of
docs/architecture.md: framework model plugins (§15, §25, §36). Detectors stay generic; frameworks only enrich the model.test: define framework model behavior), implementation follows.name = Symbol(...)bindsnameto that symbol in the symbol table, soapp.routeresolves topython.flask.Flask.routewhenapp = Flask(__name__);withcontexts carry their callee's symbol (call-chain rule), soconn.cursor().executeresolves topython.sqlite3.connect.cursor.execute; the call graph exposes these derived symbols and the taint engine reads sources through them;EntryPointmodel taints every parameter of a function decorated by its symbol, which is how route handler arguments become HTTP input.flask.request.argsalso coversrequest.args.get), and a method called on a tainted object returns tainted data.models/flask(request sources,Flask.route/Blueprint.routeentry points, HTML and path sinks,escapesanitizers),models/fastapi(FastAPIandAPIRouterroute 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 fromrequest.argsis a SQL injection,render_template_stringwith request data is XSS unless escaped, and a<host>route parameter reachingos.systemis a command injection. Same for FastAPI route parameters.Not in this PR: Django (views are undecorated, so their
requestparameter needs parameter typing), Requests/httpx models,PossibleTargetsin the call graph.Part of #30