mirror of
https://github.com/github/codeql.git
synced 2026-01-30 06:42:57 +01:00
Add taint-tracking for crypto package
This commit is contained in:
@@ -13,6 +13,7 @@ import semmle.go.frameworks.stdlib.CompressGzip
|
||||
import semmle.go.frameworks.stdlib.CompressLzw
|
||||
import semmle.go.frameworks.stdlib.CompressZlib
|
||||
import semmle.go.frameworks.stdlib.Fmt
|
||||
import semmle.go.frameworks.stdlib.Crypto
|
||||
import semmle.go.frameworks.stdlib.Mime
|
||||
import semmle.go.frameworks.stdlib.MimeMultipart
|
||||
import semmle.go.frameworks.stdlib.MimeQuotedprintable
|
||||
|
||||
23
ql/src/semmle/go/frameworks/stdlib/Crypto.qll
Normal file
23
ql/src/semmle/go/frameworks/stdlib/Crypto.qll
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Provides classes modeling security-relevant aspects of the `crypto` package.
|
||||
*/
|
||||
|
||||
import go
|
||||
|
||||
/** Provides models of commonly used functions in the `crypto` package. */
|
||||
module Crypto {
|
||||
private class MethodModels extends TaintTracking::FunctionModel, Method {
|
||||
FunctionInput inp;
|
||||
FunctionOutput outp;
|
||||
|
||||
MethodModels() {
|
||||
// signature: func (Decrypter).Decrypt(rand io.Reader, msg []byte, opts DecrypterOpts) (plaintext []byte, err error)
|
||||
this.implements("crypto", "Decrypter", "Decrypt") and
|
||||
(inp.isParameter(1) and outp.isResult(0))
|
||||
}
|
||||
|
||||
override predicate hasTaintFlow(FunctionInput input, FunctionOutput output) {
|
||||
input = inp and output = outp
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Code generated by https://github.com/gagliardetto/codebox. DO NOT EDIT.
|
||||
|
||||
package main
|
||||
|
||||
import "crypto"
|
||||
|
||||
func TaintStepTest_CryptoDecrypterDecrypt_B0I0O0(sourceCQL interface{}) interface{} {
|
||||
fromByte656 := sourceCQL.([]byte)
|
||||
var mediumObjCQL crypto.Decrypter
|
||||
intoByte414, _ := mediumObjCQL.Decrypt(nil, fromByte656, nil)
|
||||
return intoByte414
|
||||
}
|
||||
|
||||
func RunAllTaints_Crypto() {
|
||||
{
|
||||
source := newSource(0)
|
||||
out := TaintStepTest_CryptoDecrypterDecrypt_B0I0O0(source)
|
||||
sink(0, out)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user