Skip to content

Commit fb1a65c

Browse files
authored
SONARPY-2152 Lower entropy threshold for S6418 (#1949)
1 parent 673eb19 commit fb1a65c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

python-checks/src/main/java/org/sonar/python/checks/hotspots/HardCodedCredentialsEntropyCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class HardCodedCredentialsEntropyCheck extends PythonSubscriptionCheck {
4545

4646
private static final String DEFAULT_SECRET_KEYWORDS = "api[_.-]?key,auth,credential,secret,token";
4747

48-
private static final String DEFAULT_RANDOMNESS_SENSIBILITY = "5.0";
48+
private static final String DEFAULT_RANDOMNESS_SENSIBILITY = "3.0";
4949

5050
private static final Pattern POSTVALIDATION_PATTERN = Pattern.compile("[a-zA-Z0-9_.+/~$-]([a-zA-Z0-9_.+/=~$-]|\\\\\\\\(?![ntr\"])){14,1022}[a-zA-Z0-9_.+/=~$-]");
5151

python-checks/src/test/resources/checks/hotspots/hardcodedCredentialsEntropy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def func():
55
api_key = "rf6acB24J//1FZLRrKpjmBUYSnUX5CHlt/iD5vVVcgVuAIOB6hzcWjDnv16V6hDLevW0Qs4hKPbP1M4YfuDI16sZna1/VGRLkAbTk6xMPs4epH6A3ZqSyyI-H92y" # Noncompliant
66

77
def entropy_too_low():
8-
token = "rf6acB24J//1FZLRrKpjmBUYSnUX5CHlt/iD5vVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
8+
token = "rf6acB24J//1FZLRrKpjmBUYSnUX5CHlt/iD5vVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
99

1010
class MyClass:
1111
secret = "1IfHMPanImzX8ZxC-Ud6+YhXiLwlXq$f_-3v~.=" # Noncompliant {{"secret" detected here, make sure this is not a hard-coded secret.}}

0 commit comments

Comments
 (0)