Hey,

On Tue, Oct 06, 2020 at 01:33:24PM -0400, Mikko Elomaa via code-quality wrote:
> I looked around for a tool to spot these vulnerabilities, but could not find
> anything available for free. So, I wrote a quick script at first and then
> made it more generic. The tool checks functions with the route decorator, it
> detects the request related input data and checks if the data is passed to a
> function without being checked by a known filter or validator.

FWIW I think GitHub's code scanning does some quite sophisticated
analysis via CodeQL:

https://github.blog/2020-09-30-code-scanning-is-now-available/
https://github.com/github/codeql/tree/main/python/ql/src/semmle/python/web/flask

> I call the tool Python API parser and input analyzer (Papaia). I have the
> sources available at https://gitlab.com/melomaa/papaia

Looks interesting! I don't do much with Flask, so I can't say much more
:)

From a quick look, you might want to consider using an ast
(abstract syntax tree) module for parsing the code, rather than using
regular expressions. Some examples:

https://docs.python.org/3/library/ast.html
https://github.com/davidhalter/parso
https://github.com/PyCQA/baron / https://github.com/PyCQA/redbaron

(I've not used any of those myself, though)

Florian

-- 
m...@the-compiler.org (Mail/XMPP) | https://www.qutebrowser.org 
       https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
       GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
             I love long mails! | https://email.is-not-s.ms/

Attachment: signature.asc
Description: PGP signature

_______________________________________________
code-quality mailing list -- code-quality@python.org
To unsubscribe send an email to code-quality-le...@python.org
https://mail.python.org/mailman3/lists/code-quality.python.org/
Member address: arch...@mail-archive.com

Reply via email to