Skip to content
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
44 changes: 44 additions & 0 deletions rules/javascript/security/jwt-simple-noverify-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
id: jwt-simple-noverify-javascript
language: JavaScript
severity: warning
message: >-
"Detected the decoding of a JWT token without a verify step. JWT tokens
must be verified before use, otherwise the token's integrity is unknown.
This means a malicious actor could forge a JWT token with any claims. Set
'verify' to `true` before using the token."
note: >-
[CWE-287] Improper Authentication
[CWE-345] Insufficient Verification of Data Authenticity
[CWE-347] Improper Verification of Cryptographic Signature
[REFERENCES]
- https://www.npmjs.com/package/jwt-simple
- https://cwe.mitre.org/data/definitions/287
- https://cwe.mitre.org/data/definitions/345
- https://cwe.mitre.org/data/definitions/347
rule:
kind: call_expression
any:
- pattern: $JWT.decode($TOKEN, $SECRET, true $$$)
- pattern: $JWT.decode($TOKEN, $SECRET, "$$$" $$$)
- pattern: $JWT.decode($TOKEN, $SECRET, '$$$' $$$)
- pattern: $JWT.decode($TOKEN, $SECRET, `$$$` $$$)
inside:
stopBy: end
follows:
stopBy: end
any:
- kind: lexical_declaration
all:
- has:
stopBy: end
kind: identifier
pattern: $JWT
- has:
stopBy: end
kind: call_expression
pattern: require('jwt-simple')
- kind: expression_statement
has:
stopBy: end
kind: assignment_expression
pattern: $JWT = require('jwt-simple')
Loading