Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7c8db6e

Browse files
committed
Restore QL modelling for the built-in append function.
1 parent a796ddb commit 7c8db6e

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ import semmle.go.frameworks.stdlib.TextTabwriter
4444
import semmle.go.frameworks.stdlib.TextTemplate
4545
import semmle.go.frameworks.stdlib.Unsafe
4646

47+
// This is modelled using TaintTracking::FunctionModel because it doesn't have a real type signature,
48+
// and therefore currently has an InvalidType, not a SignatureType, which breaks Models as Data.
49+
/**
50+
* A model of the built-in `append` function, which propagates taint from its arguments to its
51+
* result.
52+
*/
53+
private class AppendFunction extends TaintTracking::FunctionModel {
54+
AppendFunction() { this = Builtin::append() }
55+
56+
override predicate hasTaintFlow(FunctionInput inp, FunctionOutput outp) {
57+
inp.isParameter(_) and outp.isResult()
58+
}
59+
}
60+
4761
/** Provides a class for modeling functions which convert strings into integers. */
4862
module IntegerParser {
4963
/**

0 commit comments

Comments
 (0)