File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
go/ql/queries/experimental Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * ExcludeZapEncoderSanitizer.ql
3+ *
4+ * Filter/suppress log-injection findings when the taint flow can be shown to
5+ * pass through a sanitizer (including zap custom encoders).
6+ *
7+ * NOTE: This is a conservative template. Integrate with your existing
8+ * taint-tracking / source/sink predicates used by your log-injection rules.
9+ */
10+
11+ import go
12+ import go.security.dataflow.TaintTracking as T
13+ // adjust imports above if your repo uses a different taint package
14+
15+ // Reuse the library predicates
16+ import LogSanitizer
17+
18+ /**
19+ * A wrapper sink used for demonstration. Replace with the actual log sink
20+ * definitions used by your log-injection query if you want precise suppression.
21+ */
22+ class LogSink extends T .Sink {
23+ LogSink ( ) { this = T .Sink ( "LogSink" ) }
24+ }
25+
26+ /**
27+ * Find flows from sources to log sinks but ignore flows that pass through a sanitizer.
28+ * This query demonstrates the pattern — adapt to concrete source/sink definitions.
29+ */
30+ from T .Source src, T .Sink sink, Function sanitizerFn
31+ where
32+ src .flowsTo ( sink ) and
33+ not exists ( sanitizerFn |
34+ isSanitizer ( sanitizerFn ) and
35+ // sanitizer function appears somewhere on the flow path
36+ src .flowsTo ( sanitizerFn ) and
37+ sanitizerFn .flowsTo ( sink )
38+ )
39+ select sink , "Possible unsanitized value logged (no sanitizer detected on flow)."
You can’t perform that action at this time.
0 commit comments