Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit eb3a18f

Browse files
committed
Add taint-tracking for package sort
1 parent 362d210 commit eb3a18f

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

ql/src/semmle/go/frameworks/Stdlib.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import semmle.go.frameworks.stdlib.PathFilepath
2020
import semmle.go.frameworks.stdlib.Reflect
2121
import semmle.go.frameworks.stdlib.Strconv
2222
import semmle.go.frameworks.stdlib.Strings
23+
import semmle.go.frameworks.stdlib.Sort
2324
import semmle.go.frameworks.stdlib.TextScanner
2425
import semmle.go.frameworks.stdlib.TextTabwriter
2526
import semmle.go.frameworks.stdlib.TextTemplate
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Provides classes modeling security-relevant aspects of the `sort` package.
3+
*/
4+
5+
import go
6+
7+
/** Provides models of commonly used functions in the `sort` package. */
8+
module Sort {
9+
private class FunctionModels extends TaintTracking::FunctionModel {
10+
FunctionInput inp;
11+
FunctionOutput outp;
12+
13+
FunctionModels() {
14+
// signature: func Reverse(data Interface) Interface
15+
hasQualifiedName("sort", "Reverse") and
16+
(inp.isParameter(0) and outp.isResult())
17+
}
18+
19+
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
20+
input = inp and output = outp
21+
}
22+
}
23+
}

ql/test/library-tests/semmle/go/frameworks/StdlibTaintFlow/Sort.go

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

0 commit comments

Comments
 (0)