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

Commit 434c4bc

Browse files
committed
Add taint-tracking for crypto package
1 parent c61881a commit 434c4bc

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import semmle.go.frameworks.stdlib.CompressGzip
1313
import semmle.go.frameworks.stdlib.CompressLzw
1414
import semmle.go.frameworks.stdlib.CompressZlib
1515
import semmle.go.frameworks.stdlib.Fmt
16+
import semmle.go.frameworks.stdlib.Crypto
1617
import semmle.go.frameworks.stdlib.Mime
1718
import semmle.go.frameworks.stdlib.MimeMultipart
1819
import semmle.go.frameworks.stdlib.MimeQuotedprintable
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 `crypto` package.
3+
*/
4+
5+
import go
6+
7+
/** Provides models of commonly used functions in the `crypto` package. */
8+
module Crypto {
9+
private class MethodModels extends TaintTracking::FunctionModel, Method {
10+
FunctionInput inp;
11+
FunctionOutput outp;
12+
13+
MethodModels() {
14+
// signature: func (Decrypter).Decrypt(rand io.Reader, msg []byte, opts DecrypterOpts) (plaintext []byte, err error)
15+
this.implements("crypto", "Decrypter", "Decrypt") and
16+
(inp.isParameter(1) and outp.isResult(0))
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/Crypto.go

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