Skip to content

Commit 974564c

Browse files
committed
simplify sensitive var scanner
1 parent 4da6aa8 commit 974564c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

tests/ci/s3_helper.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
S3_URL,
2121
)
2222

23-
sensitive_var_pattern = re.compile(
24-
r"\b[A-Z_]*(?<!WRONG_)(SECRET|PASSWORD|ACCESS_KEY|TOKEN)[A-Z_]*\b(?!%)(?!=clickhouse$)(?!=minio)(?!: \*{3}$)(?! '\[HIDDEN\]')"
25-
)
23+
sensitive_var_pattern = re.compile(r"[A-Z_]*(SECRET|PASSWORD|KEY|TOKEN|AZURE)[A-Z_]*")
2624
sensitive_strings = {
2725
var: value for var, value in os.environ.items() if sensitive_var_pattern.match(var)
2826
}
@@ -41,8 +39,6 @@ def clean_line(line):
4139

4240
matches = []
4341
for line_number, line in enumerate(file_content.splitlines(), start=1):
44-
for match in sensitive_var_pattern.finditer(line):
45-
matches.append((file_name, line_number, clean_line(line)))
4642
for name, value in sensitive_strings.items():
4743
if value in line:
4844
matches.append((file_name, line_number, clean_line(line)))

0 commit comments

Comments
 (0)