Skip to content

Commit 82e1eb4

Browse files
committed
Convert one zip slip barrier to MaD
1 parent 2d9b21d commit 82e1eb4

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

go/ql/lib/ext/archive.zip.model.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
extensions:
2+
- addsTo:
3+
pack: codeql/go-all
4+
extensible: barrierModel
5+
data:
6+
- ["archive/zip", "File", True, "Open", "", "", "ReturnValue[0]", "zipslip", "manual"]
27
- addsTo:
38
pack: codeql/go-all
49
extensible: summaryModel

go/ql/lib/semmle/go/security/ZipSlipCustomizations.qll

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import go
7+
private import semmle.go.dataflow.ExternalFlow
78

89
/**
910
* Provides extension points for customizing the taint tracking configuration for reasoning about
@@ -53,16 +54,8 @@ module ZipSlip {
5354
}
5455
}
5556

56-
/**
57-
* A zipped file, excluded from for zip slip.
58-
*/
59-
class ZipFileOpen extends Sanitizer {
60-
ZipFileOpen() {
61-
this =
62-
any(DataFlow::MethodCallNode mcn |
63-
mcn.getTarget().hasQualifiedName("archive/zip", "File", "Open")
64-
).getResult(0)
65-
}
57+
private class ExternalSanitizer extends Sanitizer {
58+
ExternalSanitizer() { barrierNode(this, "zipslip") }
6659
}
6760

6861
/** A path-traversal sink, considered as a taint sink for zip slip. */

0 commit comments

Comments
 (0)