Skip to content

Commit a186b77

Browse files
committed
Refactor JxBrowserWithoutCertValidation
1 parent ccdd9bc commit a186b77

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

java/ql/src/experimental/Security/CWE/CWE-295/JxBrowserWithoutCertValidation.ql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,26 @@ private class JxBrowserSafeLoadHandler extends RefType {
6666
* Models flow from the source `new Browser()` to a sink `browser.setLoadHandler(loadHandler)` where `loadHandler`
6767
* has been determined to be safe.
6868
*/
69-
private class JxBrowserFlowConfiguration extends DataFlow::Configuration {
70-
JxBrowserFlowConfiguration() { this = "JxBrowserFlowConfiguration" }
71-
72-
override predicate isSource(DataFlow::Node src) {
69+
private module JxBrowserFlowConfig implements DataFlow::ConfigSig {
70+
predicate isSource(DataFlow::Node src) {
7371
exists(ClassInstanceExpr newJxBrowser | newJxBrowser.getConstructedType() instanceof JxBrowser |
7472
newJxBrowser = src.asExpr()
7573
)
7674
}
7775

78-
override predicate isSink(DataFlow::Node sink) {
76+
predicate isSink(DataFlow::Node sink) {
7977
exists(MethodAccess ma | ma.getMethod() instanceof JxBrowserSetLoadHandler |
8078
ma.getArgument(0).getType() instanceof JxBrowserSafeLoadHandler and
8179
ma.getQualifier() = sink.asExpr()
8280
)
8381
}
8482
}
8583

86-
from JxBrowserFlowConfiguration cfg, DataFlow::Node src
84+
private module JxBrowserFlow = DataFlow::Global<JxBrowserFlowConfig>;
85+
86+
from DataFlow::Node src
8787
where
88-
cfg.isSource(src) and
89-
not cfg.hasFlow(src, _) and
88+
JxBrowserFlowConfig::isSource(src) and
89+
not JxBrowserFlow::flow(src, _) and
9090
not isSafeJxBrowserVersion()
9191
select src, "This JxBrowser instance may not check HTTPS certificates."

0 commit comments

Comments
 (0)