Skip to content

Commit 79edc5c

Browse files
committed
add sanitizer to all Read methods, add Inline tests, improve tests
1 parent a72bd7e commit 79edc5c

File tree

8 files changed

+1640
-1264
lines changed

8 files changed

+1640
-1264
lines changed

go/ql/src/experimental/CWE-522-DecompressionBombs/DecompressionBombs.ql

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,47 +12,10 @@
1212
*/
1313

1414
import go
15-
import MultipartAndFormRemoteSource
1615
import experimental.frameworks.DecompressionBombs
16+
import DecompressionBomb::Flow::PathGraph
1717

18-
module DecompressionBombsConfig implements DataFlow::StateConfigSig {
19-
class FlowState = DecompressionBombs::FlowState;
20-
21-
predicate isSource(DataFlow::Node source, FlowState state) {
22-
source instanceof UntrustedFlowSource and
23-
state = ""
24-
}
25-
26-
predicate isSink(DataFlow::Node sink, FlowState state) {
27-
sink instanceof DecompressionBombs::Sink and
28-
state =
29-
[
30-
"ZstdNewReader", "XzNewReader", "GzipNewReader", "PgzipNewReader", "S2NewReader",
31-
"SnappyNewReader", "ZlibNewReader", "FlateNewReader", "Bzip2NewReader", "ZipOpenReader",
32-
"ZipKlauspost"
33-
]
34-
}
35-
36-
predicate isAdditionalFlowStep(DataFlow::Node fromNode, DataFlow::Node toNode) {
37-
exists(DecompressionBombs::AdditionalTaintStep addStep |
38-
addStep.isAdditionalFlowStep(fromNode, toNode)
39-
)
40-
}
41-
42-
predicate isAdditionalFlowStep(
43-
DataFlow::Node fromNode, FlowState fromState, DataFlow::Node toNode, FlowState toState
44-
) {
45-
exists(DecompressionBombs::AdditionalTaintStep addStep |
46-
addStep.isAdditionalFlowStep(fromNode, fromState, toNode, toState)
47-
)
48-
}
49-
}
50-
51-
module DecompressionBombsFlow = TaintTracking::GlobalWithState<DecompressionBombsConfig>;
52-
53-
import DecompressionBombsFlow::PathGraph
54-
55-
from DecompressionBombsFlow::PathNode source, DecompressionBombsFlow::PathNode sink
56-
where DecompressionBombsFlow::flowPath(source, sink)
18+
from DecompressionBomb::Flow::PathNode source, DecompressionBomb::Flow::PathNode sink
19+
where DecompressionBomb::Flow::flowPath(source, sink)
5720
select sink.getNode(), source, sink, "This decompression is $@.", source.getNode(),
5821
"decompressing compressed data without managing output size"

go/ql/src/experimental/CWE-522-DecompressionBombs/MultipartAndFormRemoteSource.qll

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)