Skip to content

Commit 5f6de79

Browse files
committed
Fix select query, Add httprouter library and update test files
1 parent a09505a commit 5f6de79

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

go/ql/src/experimental/CWE-525/WebCacheDeception.qhelp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
Vulnerable code example: The server is configured with strict cache controls and URL validation, preventing caching of dynamic or sensitive pages regardless of their URL pattern.
3737
</p>
3838
<sample src="examples/WebCacheDeceptionGoChi.go" />
39+
</example>
40+
<example>
41+
<p>
42+
Vulnerable code example: The server is configured with strict cache controls and URL validation, preventing caching of dynamic or sensitive pages regardless of their URL pattern.
43+
</p>
44+
<sample src="examples/WebCacheDeceptionHTTPRouter.go" />
3945
</example>
4046
<references>
4147
<li>

go/ql/src/experimental/CWE-525/WebCacheDeceptionLib.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,17 @@ module WebCacheDeception {
4747
)
4848
}
4949
}
50+
51+
private class GoHTTPRouter extends Sink {
52+
GoHTTPRouter() {
53+
exists(string pkg |
54+
pkg = "github.com/julienschmidt/httprouter"
55+
|
56+
exists(DataFlow::CallNode m |
57+
m.getCall().getArgument(0).toString().matches("%/*%") and
58+
this = m.getArgument(0)
59+
)
60+
)
61+
}
62+
}
5063
}

go/ql/test/experimental/CWE-525/WebCacheDeception.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
| WebCacheDeceptionFiber.go:15:10:15:17 | "/api/*" | "/api/*" is used as wildcard endpoint. |
33
| WebCacheDeceptionFiber.go:20:11:20:18 | "/api/*" | "/api/*" is used as wildcard endpoint. |
44
| WebCacheDeceptionGoChi.go:13:8:13:11 | "/*" | "/*" is used as wildcard endpoint. |
5+
| WebCacheDeceptionHTTPRouter.go:21:13:21:25 | "/test/*test" | "/test/*test" is used as wildcard endpoint. |

go/ql/test/experimental/CWE-525/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.21
55
require (
66
github.com/go-chi/chi/v5 v5.0.10
77
github.com/gofiber/fiber/v2 v2.51.0
8+
github.com/julienschmidt/httprouter v1.3.0
89
)
910

1011
require (

go/ql/test/experimental/CWE-525/vendor/modules.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ github.com/go-chi/chi/v5
44
# github.com/gofiber/fiber/v2 v2.51.0
55
## explicit
66
github.com/gofiber/fiber/v2
7+
# github.com/julienschmidt/httprouter v1.3.0
8+
## explicit
9+
github.com/julienschmidt/httprouter
710
# github.com/andybalholm/brotli v1.0.5
811
## explicit
912
github.com/andybalholm/brotli

0 commit comments

Comments
 (0)