Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(js rule): enrich js axios rule #686

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ patterns:
- post
- patch
- delete
- pattern: |
axios($<INSECURE_CONFIG>)
filters:
- variable: INSECURE_CONFIG
detection: javascript_http_insecure_axios_object
- pattern: |
fetch($<INSECURE_URL>$<...>)
filters:
Expand All @@ -29,6 +34,14 @@ patterns:
- req
- request
- xhttp
auxiliary:
- id: javascript_http_insecure_axios_object
patterns:
- pattern: |
{ url: $<INSECURE_URL> }
filters:
- variable: INSECURE_URL
detection: insecure_url
languages:
- javascript
trigger: presence
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
low:
- rule:
cwe_ids:
- "319"
id: javascript_http_insecure
description: Connection with an unsecure HTTP communication detected.
documentation_url: https://docs.bearer.com/reference/rules/javascript_http_insecure
line_number: 7
filename: axios_with_config_insecure.js
parent_line_number: 7
parent_content: axios(config)


Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const insecure_url = "http://domain.com/api/movies";
const config = {
method: "GET",
headers: { "content-type": "application/json" },
url: insecure_url,
};
axios(config);