File tree Expand file tree Collapse file tree
python/ql/src/semmle/python/web Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,4 +56,36 @@ class WsgiEnvironment extends TaintKind {
5656
5757}
5858
59+ /** A standard morsel object from a HTTP request, a value in a cookie,
60+ * typically an instance of `http.cookies.Morsel` */
61+ class UntrustedMorsel extends TaintKind {
62+
63+ UntrustedMorsel ( ) {
64+ this = "http.Morsel"
65+ }
66+
67+
68+ override TaintKind getTaintOfAttribute ( string name ) {
69+ result instanceof ExternalStringKind and
70+ (
71+ name = "value"
72+ )
73+ }
74+
75+ }
76+
77+ /** A standard cookie object from a HTTP request, typically an instance of `http.cookies.SimpleCookie` */
78+ class UntrustedCookie extends TaintKind {
79+
80+ UntrustedCookie ( ) {
81+ this = "http.Cookie"
82+ }
83+
84+ override TaintKind getTaintForFlowStep ( ControlFlowNode fromnode , ControlFlowNode tonode ) {
85+ tonode .( SubscriptNode ) .getValue ( ) = fromnode and
86+ result instanceof UntrustedMorsel
87+ }
88+
89+ }
90+
5991
You can’t perform that action at this time.
0 commit comments