Skip to content

Commit 83037b1

Browse files
committed
Adjust structure to avoid warnings about message
1 parent 8300aeb commit 83037b1

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

javascript/ql/src/Security/CWE-693/InsecureHelmet.ql

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
import semmle.javascript.frameworks.ExpressModules
1515

1616
class HelmetProperty extends Property {
17+
ExpressLibraries::HelmetRouteHandler helmet;
18+
1719
HelmetProperty() {
18-
exists(ExpressLibraries::HelmetRouteHandler helmet |
19-
helmet.(DataFlow::CallNode).getAnArgument().asExpr().(ObjectExpr).getAProperty() = this
20-
)
20+
helmet.(DataFlow::CallNode).getAnArgument().asExpr().(ObjectExpr).getAProperty() = this
2121
}
2222

23+
ExpressLibraries::HelmetRouteHandler getHelmet() { result = helmet }
24+
2325
predicate isFalse() { this.getInit().(BooleanLiteral).getBoolValue() = false }
2426

2527
predicate isImportantSecuritySetting() {
@@ -29,8 +31,10 @@ class HelmetProperty extends Property {
2931
}
3032
}
3133

32-
from HelmetProperty helmetSetting
34+
from HelmetProperty helmetSetting, ExpressLibraries::HelmetRouteHandler helmet
3335
where
3436
helmetSetting.isFalse() and
35-
helmetSetting.isImportantSecuritySetting()
36-
select helmetSetting, "Helmet route handler, called with $@ set to 'false'", helmetSetting, helmetSetting.getName()
37+
helmetSetting.isImportantSecuritySetting() and
38+
helmetSetting.getHelmet() = helmet
39+
select helmet, "Helmet route handler, called with $@ set to 'false'.", helmetSetting,
40+
helmetSetting.getName()

0 commit comments

Comments
 (0)