mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
Python: Modernise pyramid library
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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")
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user