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

Commit 3abf0e8

Browse files
committed
Add taint-tracking for crypto/x509 package
1 parent 3acb7a5 commit 3abf0e8

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import semmle.go.frameworks.stdlib.Crypto
1717
import semmle.go.frameworks.stdlib.CryptoCipher
1818
import semmle.go.frameworks.stdlib.CryptoRsa
1919
import semmle.go.frameworks.stdlib.CryptoTls
20+
import semmle.go.frameworks.stdlib.CryptoX509
2021
import semmle.go.frameworks.stdlib.Mime
2122
import semmle.go.frameworks.stdlib.MimeMultipart
2223
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/x509` package.
3+
*/
4+
5+
import go
6+
7+
/** Provides models of commonly used functions in the `crypto/x509` package. */
8+
module CryptoX509 {
9+
private class FunctionModels extends TaintTracking::FunctionModel {
10+
FunctionInput inp;
11+
FunctionOutput outp;
12+
13+
FunctionModels() {
14+
// signature: func DecryptPEMBlock(b *encoding/pem.Block, password []byte) ([]byte, error)
15+
hasQualifiedName("crypto/x509", "DecryptPEMBlock") and
16+
(inp.isParameter(0) 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/CryptoX509.go

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