Skip to content

Commit e6c8a0b

Browse files
committed
Use more descriptive names for merged path graphs
1 parent 6b4bf12 commit e6c8a0b

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

go/ql/src/experimental/CWE-1004/CookieWithoutHttpOnly.ql

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,29 @@
1616
import go
1717
import AuthCookie
1818

19-
module MergedFlow1 =
19+
module NetHttpCookieTrackingFlow =
2020
DataFlow::MergePathGraph<NameToNetHttpCookieTrackingFlow::PathNode,
2121
BoolToNetHttpCookieTrackingFlow::PathNode, NameToNetHttpCookieTrackingFlow::PathGraph,
2222
BoolToNetHttpCookieTrackingFlow::PathGraph>;
2323

24-
module MergedFlow2 =
24+
module GorillaTrackingFlow =
2525
DataFlow::MergePathGraph3<GorillaCookieStoreSaveTrackingFlow::PathNode,
2626
GorillaSessionOptionsTrackingFlow::PathNode, BoolToGorillaSessionOptionsTrackingFlow::PathNode,
2727
GorillaCookieStoreSaveTrackingFlow::PathGraph, GorillaSessionOptionsTrackingFlow::PathGraph,
2828
BoolToGorillaSessionOptionsTrackingFlow::PathGraph>;
2929

3030
module MergedFlow =
31-
DataFlow::MergePathGraph3<MergedFlow1::PathNode, BoolToGinSetCookieTrackingFlow::PathNode,
32-
MergedFlow2::PathNode, MergedFlow1::PathGraph, BoolToGinSetCookieTrackingFlow::PathGraph,
33-
MergedFlow2::PathGraph>;
31+
DataFlow::MergePathGraph3<NetHttpCookieTrackingFlow::PathNode,
32+
BoolToGinSetCookieTrackingFlow::PathNode, GorillaTrackingFlow::PathNode,
33+
NetHttpCookieTrackingFlow::PathGraph, BoolToGinSetCookieTrackingFlow::PathGraph,
34+
GorillaTrackingFlow::PathGraph>;
3435

3536
import MergedFlow::PathGraph
3637

3738
/** Holds if `HttpOnly` of `net/http.SetCookie` is set to `false` or not set (default value is used). */
38-
predicate isNetHttpCookieFlow(MergedFlow1::PathNode source, MergedFlow1::PathNode sink) {
39+
predicate isNetHttpCookieFlow(
40+
NetHttpCookieTrackingFlow::PathNode source, NetHttpCookieTrackingFlow::PathNode sink
41+
) {
3942
exists(
4043
NameToNetHttpCookieTrackingFlow::PathNode sensitiveName,
4144
NameToNetHttpCookieTrackingFlow::PathNode setCookieSink
@@ -57,7 +60,9 @@ predicate isNetHttpCookieFlow(MergedFlow1::PathNode source, MergedFlow1::PathNod
5760
* Holds if there is gorilla cookie store creation to `Save` path and
5861
* `HttpOnly` is set to `false` or not set (default value is used).
5962
*/
60-
predicate isGorillaSessionsCookieFlow(MergedFlow2::PathNode source, MergedFlow2::PathNode sink) {
63+
predicate isGorillaSessionsCookieFlow(
64+
GorillaTrackingFlow::PathNode source, GorillaTrackingFlow::PathNode sink
65+
) {
6166
exists(
6267
GorillaCookieStoreSaveTrackingFlow::PathNode cookieStoreCreate,
6368
GorillaCookieStoreSaveTrackingFlow::PathNode sessionSave
@@ -68,7 +73,7 @@ predicate isGorillaSessionsCookieFlow(MergedFlow2::PathNode source, MergedFlow2:
6873
source.asPathNode1() = cookieStoreCreate and
6974
sink.asPathNode1() = sessionSave
7075
or
71-
exists(MergedFlow2::PathNode options, MergedFlow2::PathNode sessionSave2 |
76+
exists(GorillaTrackingFlow::PathNode options, GorillaTrackingFlow::PathNode sessionSave2 |
7277
GorillaSessionOptionsTrackingFlow::flowPath(options.asPathNode2(),
7378
sessionSave2.asPathNode2()) and
7479
(

0 commit comments

Comments
 (0)