Skip to content

Potential fix for code scanning alert no. 1: Clear-text logging of sensitive information #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion public/cloudflare-one/static/authenticated-doh.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@

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

def sanitize_command(command):
sanitized_command = []
for part in command:
if part.startswith('Cf-Access-Client-Secret:'):
sanitized_command.append('Cf-Access-Client-Secret: [REDACTED]')
else:
sanitized_command.append(part)
return sanitized_command


def check_for_command(command):
try:
Expand Down Expand Up @@ -69,7 +78,8 @@ def request_doh_token(account_tag, user_id, client_id, client_secret):
'-H', f"Cf-Access-Client-Id: {client_id}",
'-H', f"Cf-Access-Client-Secret: {client_secret}"]
if verbose:
print(f"Issuing request {' '.join(command)}")
sanitized_command = sanitize_command(command)
print(f"Issuing request {' '.join(sanitized_command)}")
response = json.loads(subprocess.check_output(command))
if verbose:
print("Got response:")
Expand Down
Loading