File tree Expand file tree Collapse file tree
go/ql/lib/semmle/go/frameworks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,6 +44,30 @@ import semmle.go.frameworks.stdlib.TextTabwriter
4444import semmle.go.frameworks.stdlib.TextTemplate
4545import semmle.go.frameworks.stdlib.Unsafe
4646
47+ /**
48+ * A model of the built-in `append` function, which propagates taint from its arguments to its
49+ * result.
50+ */
51+ private class AppendFunction extends TaintTracking:: FunctionModel {
52+ AppendFunction ( ) { this = Builtin:: append ( ) }
53+
54+ override predicate hasTaintFlow ( FunctionInput inp , FunctionOutput outp ) {
55+ inp .isParameter ( _) and outp .isResult ( )
56+ }
57+ }
58+
59+ /**
60+ * A model of the built-in `copy` function, which propagates taint from its second argument
61+ * to its first.
62+ */
63+ private class CopyFunction extends TaintTracking:: FunctionModel {
64+ CopyFunction ( ) { this = Builtin:: copy ( ) }
65+
66+ override predicate hasTaintFlow ( FunctionInput inp , FunctionOutput outp ) {
67+ inp .isParameter ( 1 ) and outp .isParameter ( 0 )
68+ }
69+ }
70+
4771/** Provides a class for modeling functions which convert strings into integers. */
4872module IntegerParser {
4973 /**
You can’t perform that action at this time.
0 commit comments