Skip to content

Commit 96091e4

Browse files
authored
Merge pull request #9947 from github/smowton/fix/golang-path-injection-numeric-sanitizer
Go: note that numeric-typed nodes can't cause path traversal
2 parents af27435 + e04c77c commit 96091e4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ module TaintedPath {
7070
PathAsSink() { this = any(FileSystemAccess fsa).getAPathArgument() }
7171
}
7272

73+
/**
74+
* A numeric- or boolean-typed node, considered a sanitizer for path traversal.
75+
*/
76+
class NumericOrBooleanSanitizer extends Sanitizer {
77+
NumericOrBooleanSanitizer() {
78+
this.getType() instanceof NumericType or this.getType() instanceof BoolType
79+
}
80+
}
81+
7382
/**
7483
* A call to `filepath.Rel`, considered as a sanitizer for path traversal.
7584
*/
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 `go/path-injection` no longer considers user-controlled numeric or boolean-typed data as potentially dangerous.

0 commit comments

Comments
 (0)