Skip to content

Commit

Permalink
Merge pull request #151 from cerberauth/add-bad-request-unauthorized-…
Browse files Browse the repository at this point in the history
…similar

fix: add bad request as unauthorized similar
  • Loading branch information
emmanuelgautier authored Aug 16, 2024
2 parents ecaa479 + b1342d7 commit b9cb39d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ vulnapi scan curl http://localhost:8080 -H "Authorization: Bearer eyJhbGciOiJub2
To perform a scan using OpenAPI contracts, execute the following command:

```bash
echo "[JWT_TOKEN]" | vulnapi scan openapi [PATH_TO_OPENAPI_FILE]
echo "[JWT_TOKEN]" | vulnapi scan openapi [PATH_OR_URL_TO_OPENAPI_FILE]
```

Replace [PATH_TO_OPENAPI_FILE] with the path to the OpenAPI contract JSON file and [JWT_TOKEN] with the JWT token to use for authentication.
Replace [PATH_OR_URL_TO_OPENAPI_FILE] with the path or the URL to the OpenAPI contract JSON file and [JWT_TOKEN] with the JWT token to use for authentication.

Example:

Expand Down
1 change: 1 addition & 0 deletions internal/scan/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
func IsUnauthorizedStatusCodeOrSimilar(resp *http.Response) bool {
return resp.StatusCode == http.StatusUnauthorized ||
resp.StatusCode == http.StatusForbidden ||
resp.StatusCode == http.StatusBadRequest ||
resp.StatusCode == http.StatusNotFound ||
resp.StatusCode == http.StatusInternalServerError
}
1 change: 1 addition & 0 deletions internal/scan/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func TestIsUnauthorizedStatusCodeOrSimilar(t *testing.T) {
}{
{http.StatusUnauthorized, true},
{http.StatusForbidden, true},
{http.StatusBadRequest, true},
{http.StatusNotFound, true},
{http.StatusInternalServerError, true},
{http.StatusOK, false},
Expand Down

0 comments on commit b9cb39d

Please sign in to comment.