Skip to content

Commit

Permalink
rules: add some tests to Java and JavaScript rules (#677)
Browse files Browse the repository at this point in the history
Add tests to HS-JAVA-1, HS-JAVASCRIPT-1, HS-JAVASCRIPT-2 and
HS-JAVASCRIPT-2 rules.
This commit also make a improvement on HS-JAVASCRIPT-2 to match the
correct way to set NODE_TLS_REJECT_UNAUTHORIZED env on Nodejs.
Previously the rule was just match with the following code
`"NODE_TLS_REJECT_UNAUTHORIZED" = "0";` with the change the rule will
match `process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";`

Update #630

Signed-off-by: Matheus Alcantara <[email protected]>
  • Loading branch information
matheusalcantarazup authored Oct 19, 2021
1 parent 5a4be7b commit 6434b57
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 54 deletions.
2 changes: 1 addition & 1 deletion internal/services/engines/nodejs/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func NewNoDisableTlsRejectUnauthorized() text.TextRule {
},
Type: text.Regular,
Expressions: []*regexp.Regexp{
regexp.MustCompile(`(?:\[|)(?:'|\")NODE_TLS_REJECT_UNAUTHORIZED(?:'|\")(?:\]|)\s*=\s*(?:'|\")*0(?:'|\")`),
regexp.MustCompile(`NODE_TLS_REJECT_UNAUTHORIZED\s*=\s*(?:'|\")*0(?:'|\")`),
},
}
}
Expand Down
Loading

0 comments on commit 6434b57

Please sign in to comment.