Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Owen Mansel-Chan <[email protected]>
  • Loading branch information
Kwstubbs and owen-mc authored Nov 13, 2024
1 parent 460ed30 commit a94ba25
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go/ql/src/change-notes/2024-10-14-gopathsanitizer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
category: minorAnalysis
---
* Added [github.com/gorilla/mux.Vars](https://pkg.go.dev/github.com/gorilla/mux#Vars) to path sanitizers.
* 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).
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// GOOD: Sanitized by Gorilla's cleaner
package main

import (
Expand All @@ -9,6 +8,7 @@ import (
"github.com/gorilla/mux"
)

// GOOD: Sanitized by Gorilla's cleaner
func GorillaHandler(w http.ResponseWriter, r *http.Request) {
not_tainted_path := mux.Vars(r)["id"]
data, _ := ioutil.ReadFile(filepath.Join("/home/user/", not_tainted_path))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// GOOD: Sanitized by Gorilla's cleaner
package main

import (
Expand All @@ -9,6 +8,7 @@ import (
"github.com/gorilla/mux"
)

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

0 comments on commit a94ba25

Please sign in to comment.