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

Commit 441d29b

Browse files
committed
Add compress/lzw taint tracking
1 parent 053496d commit 441d29b

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import semmle.go.frameworks.stdlib.Bytes
1010
import semmle.go.frameworks.stdlib.CompressBzip2
1111
import semmle.go.frameworks.stdlib.CompressFlate
1212
import semmle.go.frameworks.stdlib.CompressGzip
13+
import semmle.go.frameworks.stdlib.CompressLzw
1314

1415
/** A `String()` method. */
1516
class StringMethod extends TaintTracking::FunctionModel, Method {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Provides classes modeling security-relevant aspects of the `compress/lzw` package.
3+
*/
4+
5+
import go
6+
7+
/** Provides models of commonly used functions in the `compress/lzw` package. */
8+
module CompressLzw {
9+
private class FunctionModels extends TaintTracking::FunctionModel {
10+
FunctionInput inp;
11+
FunctionOutput outp;
12+
13+
FunctionModels() {
14+
// signature: func NewReader(r io.Reader, order Order, litWidth int) io.ReadCloser
15+
hasQualifiedName("compress/lzw", "NewReader") and
16+
(inp.isParameter(0) and outp.isResult())
17+
or
18+
// signature: func NewWriter(w io.Writer, order Order, litWidth int) io.WriteCloser
19+
hasQualifiedName("compress/lzw", "NewWriter") and
20+
(inp.isResult() and outp.isParameter(0))
21+
}
22+
23+
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
24+
input = inp and output = outp
25+
}
26+
}
27+
}

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

Lines changed: 35 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)