(self, context)
| 87 | return |
| 88 | |
| 89 | def __mark_sources(self, context): |
| 90 | if isinstance( |
| 91 | context.node, FunctionDef |
| 92 | ): # Mark arguments as sources for flask routes |
| 93 | if "flask_route" in context.node.tags and isinstance( |
| 94 | context.node.args, Arguments |
| 95 | ): |
| 96 | urls = list(context.node.get_flask_routes()) |
| 97 | |
| 98 | for url in urls: |
| 99 | for arg in context.node.args.args: |
| 100 | parsed_url = parse_werkzeug_url(url) |
| 101 | if arg in parsed_url and parsed_url[arg] in ("int",): |
| 102 | continue |
| 103 | else: |
| 104 | log = TaintLog( |
| 105 | path = self.path, |
| 106 | node = arg, |
| 107 | line_no = context.node.line_no, |
| 108 | message = "AST node has been marked as Taint because a variable is propagated via werkzeug URL parameter", |
| 109 | taint_level=Taints.TAINTED |
| 110 | ) |
| 111 | context.node.set_taint(name=arg, taint_level=Taints.TAINTED, taint_log=log, context=context) |
| 112 | |
| 113 | def __propagate_taint(self, context): |
| 114 | if isinstance(context.node, Attribute) and isinstance( |
no test coverage detected