-
-
Notifications
You must be signed in to change notification settings - Fork 391
Open
Labels
aggressiveA set of checks that is more prone to false positives but is helpful during code reviewA set of checks that is more prone to false positives but is helpful during code reviewneeds-decisionWe have to decide if this check is feasible and desirableWe have to decide if this check is feasible and desirablenew-check
Milestone
Description
Using strings.HasSuffix
with http.Request.RequestURI
probably doesn't do what the programmer thinks it does and can be
unsafe. For example, this code:
if strings.HasSuffix(r.RequestURI, "/admin") {
http.Error(w, "forbidden", http.StatusForbidden)
return
}
Will do nothing, if the user makes a request
for /admin?unsafe=1
.
There is some potential here for false positives,
but I don't think it's that high, and the code
in question should probably be rewritten
either way. At the very least, looking for pathlike
patterns in the RequestURI
field is very likely
an error.
Metadata
Metadata
Assignees
Labels
aggressiveA set of checks that is more prone to false positives but is helpful during code reviewA set of checks that is more prone to false positives but is helpful during code reviewneeds-decisionWe have to decide if this check is feasible and desirableWe have to decide if this check is feasible and desirablenew-check