@@ -25,7 +25,7 @@ private class GorillaSessionOptionsField extends Field {
2525 *
2626 * This should cover most typical patterns...
2727 */
28- DataFlow:: Node getValueForFieldWrite ( StructLit sl , string field ) {
28+ private DataFlow:: Node getValueForFieldWrite ( StructLit sl , string field ) {
2929 exists ( Write w , DataFlow:: Node base , Field f |
3030 f .getName ( ) = field and
3131 w .writesField ( base , f , result ) and
@@ -64,32 +64,10 @@ private class SetCookieSink extends DataFlow::Node {
6464 }
6565}
6666
67- /**
68- * Tracks `net/http.Cookie` creation to `net/http.SetCookie`.
69- */
70- class NetHttpCookieTrackingConfiguration extends TaintTracking:: Configuration {
71- NetHttpCookieTrackingConfiguration ( ) { this = "NetHttpCookieTrackingConfiguration" }
72-
73- override predicate isSource ( DataFlow:: Node source ) {
74- exists ( StructLit sl |
75- source .asExpr ( ) = sl and
76- sl .getType ( ) instanceof NetHttpCookieType
77- )
78- }
79-
80- override predicate isSink ( DataFlow:: Node sink ) {
81- sink instanceof SetCookieSink and
82- exists ( NameToNetHttpCookieTrackingConfiguration cfg , DataFlow:: Node nameArg |
83- cfg .hasFlowTo ( nameArg ) and
84- sink .asExpr ( ) = nameArg .asExpr ( )
85- )
86- }
87- }
88-
8967/**
9068 * Tracks sensitive name to `net/http.SetCookie`.
9169 */
92- private class NameToNetHttpCookieTrackingConfiguration extends TaintTracking2 :: Configuration {
70+ class NameToNetHttpCookieTrackingConfiguration extends TaintTracking :: Configuration {
9371 NameToNetHttpCookieTrackingConfiguration ( ) { this = "NameToNetHttpCookieTrackingConfiguration" }
9472
9573 override predicate isSource ( DataFlow:: Node source ) { isAuthVariable ( source .asExpr ( ) ) }
@@ -106,12 +84,14 @@ private class NameToNetHttpCookieTrackingConfiguration extends TaintTracking2::C
10684}
10785
10886/**
109- * Tracks `HttpOnly` set to `false` to `net/http.SetCookie`.
87+ * Tracks `bool` assigned to `HttpOnly` that flows into `net/http.SetCookie`.
11088 */
11189class BoolToNetHttpCookieTrackingConfiguration extends TaintTracking:: Configuration {
11290 BoolToNetHttpCookieTrackingConfiguration ( ) { this = "BoolToNetHttpCookieTrackingConfiguration" }
11391
114- override predicate isSource ( DataFlow:: Node source ) { source .asExpr ( ) .getBoolValue ( ) = false }
92+ override predicate isSource ( DataFlow:: Node source ) {
93+ source .asExpr ( ) .getType ( ) .getUnderlyingType ( ) instanceof BoolType
94+ }
11595
11696 override predicate isSink ( DataFlow:: Node sink ) { sink instanceof SetCookieSink }
11797
0 commit comments