Python: Modernise pyramid library

This commit is contained in:
Rasmus Wriedt Larsen
2019-09-30 15:33:24 +02:00
parent 59e09d6d5d
commit 66a0e153a5
3 changed files with 7 additions and 7 deletions

View File

@@ -8,8 +8,8 @@ import semmle.python.security.TaintTracking
import semmle.python.security.strings.Basic
import semmle.python.web.Http
private ClassObject redirectClass() {
exists(ModuleObject ex |
private ClassValue redirectClass() {
exists(ModuleValue ex |
ex.getName() = "pyramid.httpexceptions" |
ex.attr("HTTPFound") = result
or
@@ -28,7 +28,7 @@ class PyramidRedirect extends HttpRedirectTaintSink {
PyramidRedirect() {
exists(CallNode call |
call.getFunction().refersTo(redirectClass())
call.getFunction().pointsTo(redirectClass())
|
call.getArg(0) = this
or

View File

@@ -35,7 +35,7 @@ class PyramidCookieSet extends CookieSet, CallNode {
PyramidCookieSet() {
exists(ControlFlowNode f |
f = this.getFunction().(AttrNode).getObject("set_cookie") and
f.refersTo(_, ModuleObject::named("pyramid").attr("Response"), _)
f.pointsTo().getClass() = Value::named("pyramid.Response")
)
}

View File

@@ -1,14 +1,14 @@
import python
ModuleObject thePyramidViewModule() {
ModuleValue thePyramidViewModule() {
result.getName() = "pyramid.view"
}
Object thePyramidViewConfig() {
Value thePyramidViewConfig() {
result = thePyramidViewModule().attr("view_config")
}
predicate is_pyramid_view_function(Function func) {
func.getADecorator().refersTo(_, thePyramidViewConfig(), _)
func.getADecorator().pointsTo().getClass() = thePyramidViewConfig()
}