Skip to content

Commit f859159

Browse files
Merge pull request #66 from krishnprakash/alert-autofix-1
Potential fix for code scanning alert no. 1: Clear-text logging of sensitive information
2 parents fcadc18 + ebcef29 commit f859159

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

public/cloudflare-one/static/authenticated-doh.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88

99
verbose = os.environ.get('VERBOSE', False)
1010

11+
def sanitize_command(command):
12+
sanitized_command = []
13+
for part in command:
14+
if part.startswith('Cf-Access-Client-Secret:'):
15+
sanitized_command.append('Cf-Access-Client-Secret: [REDACTED]')
16+
else:
17+
sanitized_command.append(part)
18+
return sanitized_command
19+
1120

1221
def check_for_command(command):
1322
try:
@@ -69,7 +78,8 @@ def request_doh_token(account_tag, user_id, client_id, client_secret):
6978
'-H', f"Cf-Access-Client-Id: {client_id}",
7079
'-H', f"Cf-Access-Client-Secret: {client_secret}"]
7180
if verbose:
72-
print(f"Issuing request {' '.join(command)}")
81+
sanitized_command = sanitize_command(command)
82+
print(f"Issuing request {' '.join(sanitized_command)}")
7383
response = json.loads(subprocess.check_output(command))
7484
if verbose:
7585
print("Got response:")

0 commit comments

Comments
 (0)