Skip to content

Commit 72b0828

Browse files
committed
Go: Update html-template-escaping-passthrough
Modify this query to apply sanitizers only in the data flow between untrusted inputs and passthrough conversion types.
1 parent 1aa1153 commit 72b0828

File tree

2 files changed

+5
-183
lines changed

2 files changed

+5
-183
lines changed

go/ql/src/experimental/CWE-79/HTMLTemplateEscapingPassthrough.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ class FlowConfFromUntrustedToPassthroughTypeConversion extends TaintTracking::Co
6464
}
6565

6666
override predicate isSink(DataFlow::Node sink) { isSinkToPassthroughType(sink, dstTypeName) }
67+
68+
override predicate isSanitizer(DataFlow::Node sanitizer) {
69+
sanitizer instanceof SharedXss::Sanitizer or sanitizer.getType() instanceof NumericType
70+
}
6771
}
6872

6973
/**
@@ -100,7 +104,7 @@ class FlowConfPassthroughTypeConversionToTemplateExecutionCall extends TaintTrac
100104
PassthroughTypeName getDstTypeName() { result = dstTypeName }
101105

102106
override predicate isSource(DataFlow::Node source) {
103-
isSourceConversionToPassthroughType(source, _)
107+
isSourceConversionToPassthroughType(source, dstTypeName)
104108
}
105109

106110
private predicate isSourceConversionToPassthroughType(
@@ -141,10 +145,6 @@ class FlowConfFromUntrustedToTemplateExecutionCall extends TaintTracking::Config
141145
override predicate isSource(DataFlow::Node source) { source instanceof UntrustedFlowSource }
142146

143147
override predicate isSink(DataFlow::Node sink) { isSinkToTemplateExec(sink, _) }
144-
145-
override predicate isSanitizer(DataFlow::Node sanitizer) {
146-
sanitizer instanceof SharedXss::Sanitizer or sanitizer.getType() instanceof NumericType
147-
}
148148
}
149149

150150
/**

0 commit comments

Comments
 (0)