-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport of api: ensure ACL role upsert decode error returns a 400 st…
…atus code. into release/1.4.x (#15321) This pull request was automerged via backport-assistant
- Loading branch information
1 parent
bd38820
commit 7623043
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
rules: | ||
- id: "http-endpoint-request-decode-error-code" | ||
patterns: | ||
- pattern: | | ||
if err := decodeBody(...); err != nil { | ||
return nil, CodedError(...) | ||
} | ||
- pattern-not-inside: | | ||
if err := decodeBody(...); err != nil { | ||
return nil, CodedError(400, ...) | ||
} | ||
- pattern-not-inside: | | ||
if err := decodeBody(...); err != nil { | ||
return nil, CodedError(http.StatusBadRequest, ...) | ||
} | ||
message: "HTTP endpoint request decode should return http.StatusBadRequest" | ||
languages: | ||
- "go" | ||
severity: "ERROR" | ||
paths: | ||
include: | ||
- "command/agent/*_endpoint.go" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters