Skip to content

Commit 1f9f6d7

Browse files
committed
Java: Report log-injection at the source rather than the sink
This should remove the problem of excessive grouping of different alerts that share a sink location, often due to wrapper functions that form the ultimate sink of all logging calls in a given codebase.
1 parent cc354ca commit 1f9f6d7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

java/ql/src/Security/CWE/CWE-117/LogInjection.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ import DataFlow::PathGraph
1717

1818
from LogInjectionConfiguration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
1919
where cfg.hasFlowPath(source, sink)
20-
select sink.getNode(), source, sink, "This $@ flows to a log entry.", source.getNode(),
21-
"user-provided value"
20+
select source.getNode(), source, sink, "This user-provided value flows to a $@.", sink.getNode(),
21+
"log entry"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The query `java/log-injection` now reports problems at the source (user-controlled data) instead of at the ultimate logging call. This was changed because user functions that wrap the ultimate logging call could result in most alerts being reported in an uninformative location.

0 commit comments

Comments
 (0)