This repository was archived by the owner on Jan 5, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
ql/src/semmle/go/frameworks/stdlib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,38 @@ import go
66
77/** Provides models of commonly used functions in the `encoding/xml` package. */
88module EncodingXml {
9+ /** The `Marshal` or `MarshalIndent` function in the `encoding/xml` package. */
10+ class MarshalFunction extends TaintTracking:: FunctionModel , MarshalingFunction:: Range {
11+ MarshalFunction ( ) {
12+ this .hasQualifiedName ( "encoding/xml" , "Marshal" ) or
13+ this .hasQualifiedName ( "encoding/xml" , "MarshalIndent" )
14+ }
15+
16+ override predicate hasTaintFlow ( FunctionInput inp , FunctionOutput outp ) {
17+ inp = getAnInput ( ) and outp = getOutput ( )
18+ }
19+
20+ override FunctionInput getAnInput ( ) { result .isParameter ( 0 ) }
21+
22+ override FunctionOutput getOutput ( ) { result .isResult ( 0 ) }
23+
24+ override string getFormat ( ) { result = "XML" }
25+ }
26+
27+ private class UnmarshalFunction extends TaintTracking:: FunctionModel , UnmarshalingFunction:: Range {
28+ UnmarshalFunction ( ) { this .hasQualifiedName ( "encoding/xml" , "Unmarshal" ) }
29+
30+ override predicate hasTaintFlow ( FunctionInput inp , FunctionOutput outp ) {
31+ inp = getAnInput ( ) and outp = getOutput ( )
32+ }
33+
34+ override FunctionInput getAnInput ( ) { result .isParameter ( 0 ) }
35+
36+ override FunctionOutput getOutput ( ) { result .isParameter ( 1 ) }
37+
38+ override string getFormat ( ) { result = "XML" }
39+ }
40+
941 private class FunctionModels extends TaintTracking:: FunctionModel {
1042 FunctionInput inp ;
1143 FunctionOutput outp ;
You can’t perform that action at this time.
0 commit comments