-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: gitlab improvements part 2 (#46)
- Loading branch information
Showing
80 changed files
with
1,640 additions
and
82 deletions.
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
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
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
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
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
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
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
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
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
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
2 changes: 2 additions & 0 deletions
2
javascript/lang/hardcoded_secret/testdata/unsecure_assigment.js
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
const config = {}; | ||
config.clientSecret = "secretHardcodedString"; | ||
|
||
const apiKey = "oops" |
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
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
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
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
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,71 @@ | ||
languages: | ||
- javascript | ||
patterns: | ||
- pattern: $<STRING> | ||
filters: | ||
- variable: STRING | ||
string_regex: <\w+(\s[^>]*)?> | ||
- variable: STRING | ||
detection: javascript_lang_raw_html_using_user_input_user_input | ||
- not: | ||
variable: STRING | ||
detection: javascript_lang_raw_html_using_user_input_sanitized | ||
auxiliary: | ||
- id: javascript_lang_raw_html_using_user_input_user_input_source | ||
patterns: | ||
# Express | ||
- req.params | ||
- req.query | ||
- req.body | ||
- req.cookies | ||
- req.headers | ||
# AWS | ||
- async function ($<!>event, $<_>) {} | ||
- async ($<!>event, $<_>) => {} | ||
- id: javascript_lang_raw_html_using_user_input_user_input | ||
patterns: | ||
- pattern: $<USER_INPUT> | ||
filters: | ||
- variable: USER_INPUT | ||
detection: javascript_lang_raw_html_using_user_input_user_input_source | ||
contains: false | ||
- id: javascript_lang_raw_html_using_user_input_sanitized | ||
patterns: | ||
- pattern: sanitizeHtml($<SANITIZED_USER_INPUT>$<...>) | ||
filters: | ||
- variable: SANITIZED_USER_INPUT | ||
detection: javascript_lang_raw_html_using_user_input_user_input | ||
severity: high | ||
metadata: | ||
description: "Unsanitized user input detected in raw HTML string." | ||
remediation_message: | | ||
## Description | ||
Applications should not include unsanitized user input in HTML. This | ||
can allow cross-site scripting (XSS) attacks. | ||
## Remediations | ||
❌ Avoid including user input directly in HTML strings: | ||
```javascript | ||
const html = `<h1>${req.params.title}</h1>` | ||
``` | ||
✅ Use a framework or templating language to construct the HTML. | ||
✅ When HTML strings must be used, sanitize user input: | ||
```javascript | ||
import sanitizeHtml from 'sanitize-html' | ||
const sanitizedTitle = sanitizeHtml(req.params.title) | ||
const html = `<h1>${sanitizedTitle}</h1>` | ||
``` | ||
## Resources | ||
- [OWASP Cross-Site Scripting (XSS) Cheatsheet](https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html) | ||
cwe_id: | ||
- 79 | ||
id: javascript_lang_raw_html_using_user_input | ||
documentation_url: https://docs.bearer.com/reference/rules/javascript_lang_raw_html_using_user_input |
Oops, something went wrong.