@@ -21,28 +21,26 @@ class AuthCodeURL extends Method {
21
21
}
22
22
23
23
/**
24
- * A flow of a constant string value to a call to AuthCodeURL as the
24
+ * A flow of a constant string value to a call to ` AuthCodeURL` as the
25
25
* `state` parameter.
26
26
*/
27
27
class ConstantStateFlowConf extends DataFlow:: Configuration {
28
28
ConstantStateFlowConf ( ) { this = "ConstantStateFlowConf" }
29
29
30
- predicate isSource ( DataFlow:: Node source , Literal state ) {
31
- state .isConst ( ) and source .asExpr ( ) = state and not DataFlow:: isReturnedWithError ( source )
32
- }
33
-
34
30
predicate isSink ( DataFlow:: Node sink , DataFlow:: CallNode call ) {
35
31
exists ( AuthCodeURL m | call = m .getACall ( ) | sink = call .getArgument ( 0 ) )
36
32
}
37
33
38
- override predicate isSource ( DataFlow:: Node source ) { isSource ( source , _) }
34
+ override predicate isSource ( DataFlow:: Node source ) {
35
+ source .isConst ( ) and not DataFlow:: isReturnedWithError ( source )
36
+ }
39
37
40
38
override predicate isSink ( DataFlow:: Node sink ) { isSink ( sink , _) }
41
39
}
42
40
43
41
/**
44
- * A flow of a URL indicating the OAuth redirect doesn't point to a publically
45
- * accessible address, to the receiver of an AuthCodeURL call.
42
+ * A flow of a URL indicating the OAuth redirect doesn't point to a publicly
43
+ * accessible address, to the receiver of an ` AuthCodeURL` call.
46
44
*
47
45
* Note we accept localhost and 127.0.0.1 on the assumption this is probably a transient
48
46
* listener; if it actually is a persistent server then that really is vulnerable to CSRF.
@@ -63,7 +61,9 @@ class PrivateUrlFlowsToAuthCodeUrlCall extends DataFlow::Configuration {
63
61
}
64
62
65
63
/**
66
- * Propagates a URL written to a RedirectURL field to the whole Config object.
64
+ * Holds if `pred` writes a URL to the `RedirectURL` field of the `succ` `Config` object.
65
+ *
66
+ * This propagates flow from the RedirectURL field to the whole Config object.
67
67
*/
68
68
predicate isUrlTaintingConfigStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
69
69
exists ( Write w , Field f | f .hasQualifiedName ( "golang.org/x/oauth2" , "Config" , "RedirectURL" ) |
@@ -94,8 +94,8 @@ class PrivateUrlFlowsToAuthCodeUrlCall extends DataFlow::Configuration {
94
94
}
95
95
96
96
/**
97
- * Holds if a URL indicating the OAuth redirect doesn't point to a publically
98
- * accessible address, to the receiver of an AuthCodeURL call.
97
+ * Holds if a URL indicating the OAuth redirect doesn't point to a publicly
98
+ * accessible address, to the receiver of an ` AuthCodeURL` call.
99
99
*
100
100
* Note we accept localhost and 127.0.0.1 on the assumption this is probably a transient
101
101
* listener; if it actually is a persistent server then that really is vulnerable to CSRF.
@@ -107,7 +107,7 @@ predicate privateUrlFlowsToAuthCodeUrlCall(DataFlow::CallNode call) {
107
107
)
108
108
}
109
109
110
- /** A flow to a printer function of the fmt package . */
110
+ /** A flow from `golang.org/x/oauth2.Config.AuthCodeURL`'s result to a logging function . */
111
111
class FlowToPrint extends DataFlow:: Configuration {
112
112
FlowToPrint ( ) { this = "FlowToPrint" }
113
113
@@ -126,22 +126,22 @@ class FlowToPrint extends DataFlow::Configuration {
126
126
override predicate isSink ( DataFlow:: Node sink ) { isSink ( sink , _) }
127
127
}
128
128
129
- /** Holds if the provided CallNode's result flows to a Printer call as argument . */
129
+ /** Holds if the provided ` CallNode` 's result flows to an argument of a printer call . */
130
130
predicate resultFlowsToPrinter ( DataFlow:: CallNode authCodeURLCall ) {
131
131
exists ( FlowToPrint cfg , DataFlow:: PathNode source , DataFlow:: PathNode sink |
132
132
cfg .hasFlowPath ( source , sink ) and
133
133
cfg .isSource ( source .getNode ( ) , authCodeURLCall )
134
134
)
135
135
}
136
136
137
- /** Gets dataflow nodes that read the value of os.Stdin */
137
+ /** Get a data-flow node that reads the value of ` os.Stdin`. */
138
138
DataFlow:: Node getAStdinNode ( ) {
139
139
result = any ( ValueEntity v | v .hasQualifiedName ( "os" , "Stdin" ) ) .getARead ( )
140
140
}
141
141
142
142
/**
143
- * Gets a call to a scanner function that reads from os.Stdin, or which creates a scanner
144
- * instance wrapping os.Stdin.
143
+ * Gets a call to a scanner function that reads from ` os.Stdin` , or which creates a scanner
144
+ * instance wrapping ` os.Stdin` .
145
145
*/
146
146
DataFlow:: CallNode getAScannerCall ( ) {
147
147
result instanceof Fmt:: ScannerCall or
@@ -150,17 +150,17 @@ DataFlow::CallNode getAScannerCall() {
150
150
}
151
151
152
152
/**
153
- * Holds if the provided CallNode is within the same root as a call
154
- * to a scanner that reads from os.Stdin.
153
+ * Holds if the provided ` CallNode` is within the same root as a call
154
+ * to a scanner that reads from ` os.Stdin` .
155
155
*/
156
156
predicate containsCallToStdinScanner ( FuncDef funcDef ) {
157
157
exists ( DataFlow:: CallNode call | call = getAScannerCall ( ) | call .getRoot ( ) = funcDef )
158
158
}
159
159
160
160
/**
161
- * Holds if the authCodeURLCall seems to be done within a terminal
162
- * because there are calls to a Printer ( fmt.Println and similar),
163
- * and a call to a Scanner ( fmt.Scan and similar),
161
+ * Holds if the ` authCodeURLCall` seems to be done within a terminal
162
+ * because there are calls to a printer (` fmt.Println` and similar),
163
+ * and a call to a scanner (` fmt.Scan` and similar),
164
164
* all of which are typically done within a terminal session.
165
165
*/
166
166
predicate seemsLikeDoneWithinATerminal ( DataFlow:: CallNode authCodeURLCall ) {
0 commit comments