get rid of AuthCookieNameConfiguration

This commit is contained in:
edvraa
2021-04-29 15:01:06 +03:00
committed by Owen Mansel-Chan
parent 9c0b83fd34
commit 253abc55d9
2 changed files with 5 additions and 23 deletions

View File

@@ -38,6 +38,10 @@ class HttpOnlyCookieTrackingConfiguration extends TaintTracking::Configuration {
exists(DataFlow::Node rhs |
rhs = getValueForFieldWrite(sl, "HttpOnly") and
rhs.getAPredecessor*().asExpr().getBoolValue() = false
) and
exists(DataFlow::Node rhs |
rhs = getValueForFieldWrite(sl, "Name") and
isAuthVariable(rhs.getAPredecessor*().asExpr())
)
)
)
@@ -72,26 +76,6 @@ predicate isAuthVariable(Expr expr) {
)
}
/**
* Tracks if a variable with a sensitive name is used as a cookie name.
*/
class AuthCookieNameConfiguration extends TaintTracking::Configuration {
AuthCookieNameConfiguration() { this = "AuthCookieNameConfiguration" }
override predicate isSource(DataFlow::Node source) {
exists(StructLit sl |
source.asExpr() = sl and
sl.getType().hasQualifiedName("net/http", "Cookie") and
exists(DataFlow::Node rhs |
rhs = getValueForFieldWrite(sl, "Name") and
isAuthVariable(rhs.getAPredecessor*().asExpr())
)
)
}
override predicate isSink(DataFlow::Node sink) { sink instanceof SetCookieSink }
}
/**
* Tracks from gorilla cookie store creation to session save.
*/

View File

@@ -17,11 +17,9 @@ import AuthCookie
predicate isNetHttpCookieFlow(Expr expr) {
exists(
HttpOnlyCookieTrackingConfiguration httpOnlyCfg, AuthCookieNameConfiguration cookieNameCfg,
SetCookieSink sink, DataFlow::Node source
HttpOnlyCookieTrackingConfiguration httpOnlyCfg, DataFlow::Node source, SetCookieSink sink
|
httpOnlyCfg.hasFlow(source, sink) and
cookieNameCfg.hasFlow(source, sink) and
sink.asExpr() = expr
)
}