Skip to content

Commit a94ba25

Browse files
Kwstubbsowen-mc
andauthored
Apply suggestions from code review
Co-authored-by: Owen Mansel-Chan <[email protected]>
1 parent 460ed30 commit a94ba25

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
category: minorAnalysis
33
---
4-
* Added [github.com/gorilla/mux.Vars](https://pkg.go.dev/github.com/gorilla/mux#Vars) to path sanitizers.
4+
* Added [github.com/gorilla/mux.Vars](https://pkg.go.dev/github.com/gorilla/mux#Vars) to path sanitizers (disabled if [github.com/gorilla/mix.Router.SkipClean](https://pkg.go.dev/github.com/gorilla/mux#Router.SkipClean) has been called).

go/ql/test/query-tests/Security/CWE-022/GorillaMuxDefault/MuxClean.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// GOOD: Sanitized by Gorilla's cleaner
21
package main
32

43
import (
@@ -9,6 +8,7 @@ import (
98
"github.com/gorilla/mux"
109
)
1110

11+
// GOOD: Sanitized by Gorilla's cleaner
1212
func GorillaHandler(w http.ResponseWriter, r *http.Request) {
1313
not_tainted_path := mux.Vars(r)["id"]
1414
data, _ := ioutil.ReadFile(filepath.Join("/home/user/", not_tainted_path))

go/ql/test/query-tests/Security/CWE-022/GorillaMuxSkipClean/MuxClean.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// GOOD: Sanitized by Gorilla's cleaner
21
package main
32

43
import (
@@ -9,6 +8,7 @@ import (
98
"github.com/gorilla/mux"
109
)
1110

11+
// BAD: Gorilla's `Vars` is not a sanitizer as `Router.SkipClean` has been called
1212
func GorillaHandler(w http.ResponseWriter, r *http.Request) {
1313
not_tainted_path := mux.Vars(r)["id"]
1414
data, _ := ioutil.ReadFile(filepath.Join("/home/user/", not_tainted_path))

0 commit comments

Comments
 (0)