mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
feat: Return more 404s vs 403s (#2194)
* feat: Return more 404s vs 403s * Return vague 404 in all cases
This commit is contained in:
@@ -150,3 +150,14 @@ func HttpAPIErrorMessage(m dsl.Matcher) {
|
||||
At(m["m"]).
|
||||
Report("Field \"Message\" should be a proper sentence with a capitalized first letter and ending in punctuation. $m")
|
||||
}
|
||||
|
||||
// ProperRBACReturn ensures we always write to the response writer after a
|
||||
// call to Authorize. If we just do a return, the client will get a status code
|
||||
// 200, which is incorrect.
|
||||
func ProperRBACReturn(m dsl.Matcher) {
|
||||
m.Match(`
|
||||
if !$_.Authorize($*_) {
|
||||
return
|
||||
}
|
||||
`).Report("Must write to 'ResponseWriter' before returning'")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user