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

nodejs-insecure-url-parse: add inline require('url') #300

Merged
merged 3 commits into from
Aug 4, 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 @@ -6,7 +6,10 @@ rules:
assignees: |
thypon
fmarier
pattern: url.parse(...)
pattern-either:
- pattern: url.parse(...)
- pattern: require('url').parse(...)
message: Avoid using url.parse() as it may cause security issues. Consider using the URL class instead.
severity: ERROR
languages:
- javascript
15 changes: 15 additions & 0 deletions t3sts/semgrep_rules/nodejs-insecure-url-parse.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
// ruleid: nodejs-insecure-url-parse
url.parse("here lies dragons");
// ruleid: nodejs-insecure-url-parse
require('url').parse("here lies dragons");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] Avoid using url.parse() as it may cause security issues. Consider using the URL class instead.

Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/web/nodejs-insecure-url-parse.yaml


Cc @thypon @fmarier


var uparser = require('url');

// ruleid: nodejs-insecure-url-parse
uparser.parse("here lies dragons");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] Avoid using url.parse() as it may cause security issues. Consider using the URL class instead.

Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/web/nodejs-insecure-url-parse.yaml


Cc @thypon @fmarier


function() {
// ruleid: nodejs-insecure-url-parse
uparser.parse("here lies dragons");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] Avoid using url.parse() as it may cause security issues. Consider using the URL class instead.

Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/web/nodejs-insecure-url-parse.yaml


Cc @thypon @fmarier

}

// ruleid: nodejs-insecure-url-parse
setTimeout(()=> uparser.parse("here lies dragons"), 1000);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
[semgrep] Avoid using url.parse() as it may cause security issues. Consider using the URL class instead.

Source: https://github.com/brave/security-action/blob/main/assets/semgrep_rules/web/nodejs-insecure-url-parse.yaml


Cc @thypon @fmarier

Loading