Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanvacareanu7 committed Jun 20, 2024
1 parent b26f859 commit 4e3599f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 41 deletions.
80 changes: 41 additions & 39 deletions docs/codacy-rules.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
rules:
- id: codacy.csharp.security.hard-coded-password
severity: ERROR
languages:
- csharp
pattern: var $PASSWORD = "$VALUE";
regex: "(?i).*(password|motdepasse|heslo|adgangskode|wachtwoord|salasana|passwort|passord|senha|geslo|clave|losenord|clave|parola|secret|pwd).*"
message: Hardcoded passwords are a security risk. They can be easily found by attackers and used to gain unauthorized access to the system.
metadata:
owasp:
- A3:2017 Sensitive Data Exposure
description: Hardcoded passwords are a security risk.
category: security
technology:
- .net
impact: HIGH
- id: codacy.generic.plsql.empty-strings
severity: WARNING
languages:
- generic
pattern: var $STRING = '';
regex: "(?i).*''.*"
message: Empty strings can lead to unexpected behavior and should be handled carefully.
metadata:
description: Detects empty strings in the code which might cause issues or bugs.
category: security
impact: MEDIUM
- id: codacy.generic.plsql.find-all-passwords
severity: ERROR
languages:
- generic
pattern: var $PASSWORD = "$VALUE";
regex: "(?i).*(password|psw|pwd|pass|adgangskode|benutzerkennwort|chiffre|clave|codewort|contrasena|contrasenya|geheimcode|geslo|heslo|jelszo|kennwort|losenord|losung|losungswort|lozinka|modpas|motdepasse|parol|parola|parole|pasahitza|pasfhocal|passe|passord|passwort|pasvorto|paswoord|salasana|schluessel|schluesselwort|senha|sifre|wachtwoord|wagwoord|watchword|zugangswort|PAROLACHIAVE|PAROLA CHIAVE|PAROLECHIAVI|PAROLE CHIAVI|paroladordine|verschluesselt|sisma).*(?<!pass|passable|passage|passenger|passer|passing|passion|passive|passover|passport|passed|compass|bypass).*"
message: Hardcoded or exposed passwords are a security risk. They can be easily found by attackers and used to gain unauthorized access to the system.
metadata:
owasp:
- A3:2017 Sensitive Data Exposure
description: Finding all occurrences of passwords in different languages and formats, while avoiding common false positives.
category: security
impact: HIGH
- id: codacy.csharp.security.hard-coded-password
severity: ERROR
languages:
- csharp
pattern: var $PASSWORD = "$VALUE";
regex: "(?i).*(password|motdepasse|heslo|adgangskode|wachtwoord|salasana|passwort|passord|senha|geslo|clave|losenord|clave|parola|secret|pwd).*"
message: Hardcoded passwords are a security risk. They can be easily found by attackers and used to gain unauthorized access to the system.
metadata:
owasp:
- A3:2017 Sensitive Data Exposure
description: Hardcoded passwords are a security risk.
category: security
technology:
- .net
impact: HIGH
- id: codacy.generic.plsql.empty-strings
severity: WARNING
languages:
- generic
pattern: var $STRING = '';
message: Empty strings can lead to unexpected behavior and should be handled carefully.
metadata:
description: Detects empty strings in the code which might cause issues or bugs.
category: security
impact: MEDIUM
- id: codacy.generic.plsql.find-all-passwords
severity: ERROR
languages:
- generic
pattern: |
var $PASSWORD = $...VALUE;
options:
generic_ellipsis_max_span: 0
message: >
Hardcoded or exposed passwords are a security risk. They can be easily found by attackers and used to gain unauthorized access to the system.
metadata:
owasp:
- A3:2017 Sensitive Data Exposure
description: Finding all occurrences of passwords in different languages and formats, while avoiding common false positives.
category: security
impact: HIGH
4 changes: 2 additions & 2 deletions docs/multiple-tests/codacy-rules/patterns.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module name="root">
<module name="codacy.csharp.security.hard-coded-password" />
<module name="codacy.generic.empty-strings"/>
<module name="codacy.generic.find_all_passwords"/>
<module name="codacy.generic.plsql.empty-strings"/>
<module name="codacy.generic.plsql.find-all-passwords"/>
</module>
4 changes: 4 additions & 0 deletions docs/multiple-tests/codacy-rules/results.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
<file name="codacy-csharp-security-hard-coded-password.cs">
<error source="codacy.csharp.security.hard-coded-password" line="9" message="Hardcoded passwords are a security risk." severity="error" />
</file>
<file name="test_find_all_passwords_and_empty_string.pls">
<error source="codacy.generic.plsql.empty-strings" line="29" message="Empty strings can lead to unexpected behavior and should be handled carefully." severity="warning" />
<error source="codacy.generic.plsql.find-all-passwords" line="6" message="Hardcoded or exposed passwords are a security risk." severity="error" />
</file>
</checkstyle>

0 comments on commit 4e3599f

Please sign in to comment.