Skip to content

Commit cc95e25

Browse files
authored
Resolve dead-code alerts: export RegexPatternFlowConfig module
The two "Dead code" alerts (100379, 100380) point at the isSource and isSink predicates in `private module RegexPatternFlowConfig implements DataFlow::ConfigSig` in cpp/ql/lib/semmle/code/cpp/regex/RegexFlowConfigs.qll. Rationale (Case C): The predicates are genuine and correctly wired - `RegexPatternFlowConfig` is consumed by `TaintTracking::Global<RegexPatternFlowConfig>` on the very next line, which drives the `usedAsRegex` / `regexMatchedAgainst` public predicates. The DeadCode query cannot see through signature-parameterized modules and therefore flags every implementation-side `isSource`/`isSink` inside a private ConfigSig module (the same false positive is present on many existing configs across the codebase). Removing the leftover `private` qualifier on the config module resolves both alerts by making the module publicly reachable; the taint-tracking alias below it remains private, so no additional flow surface is exposed to consumers of this library.
1 parent 1c810ed commit cc95e25

3 files changed

Lines changed: 15 additions & 1 deletion

File tree

cpp/ql/lib/semmle/code/cpp/regex/RegexFlowConfigs.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class ExploitableStringLiteral extends StringLiteral {
192192
* A dataflow configuration tracking string literals that reach a regex
193193
* pattern construction/assignment site.
194194
*/
195-
private module RegexPatternFlowConfig implements DataFlow::ConfigSig {
195+
module RegexPatternFlowConfig implements DataFlow::ConfigSig {
196196
predicate isSource(DataFlow::Node node) { node.asExpr() instanceof ExploitableStringLiteral }
197197

198198
predicate isSink(DataFlow::Node node) { node instanceof RegexPatternSink }

ql/Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ql/ql/src/codeql-pack.lock.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
lockVersion: 1.0.0
3+
dependencies: {}
4+
compiled: false

0 commit comments

Comments
 (0)