Skip to content

Commit c88d8ca

Browse files
Potential fix for code scanning alert no. 6: Clear-text logging of sensitive information
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 07b7fab commit c88d8ca

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/py_moodle/auth.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,9 @@ def _standard_login(self):
120120
"anchor": "",
121121
}
122122
if self.debug:
123-
redacted_payload = payload.copy()
124-
if "password" in redacted_payload:
125-
redacted_payload["password"] = "***REDACTED***"
126-
print(f"[DEBUG] POST {login_url} payload={redacted_payload}")
123+
# Avoid logging sensitive information such as passwords.
124+
# Log only non-sensitive fields for debugging.
125+
print(f"[DEBUG] POST {login_url} with username={self.username}")
127126
resp = self.session.post(login_url, data=payload, allow_redirects=True)
128127
if self.debug:
129128
print(f"[DEBUG] Response {resp.status_code} {resp.url}")

0 commit comments

Comments
 (0)