Skip to content

Redact nested secrets and proxy credentials in debug logs - #1536

Open
giri-kondisetty wants to merge 1 commit into
CrowdStrike:devfrom
giri-kondisetty:fix/debug-log-redaction
Open

giri-kondisetty wants to merge 1 commit into
CrowdStrike:devfrom
giri-kondisetty:fix/debug-log-redaction

Conversation

@giri-kondisetty

@giri-kondisetty giri-kondisetty commented Nov 27, 2026 •

Copy link
Copy Markdown

Redact nested secrets and proxy credentials in debug logs

With log sanitization enabled, debug logs still showed secrets nested in request bodies (for example private_key) and the credentials in proxy URLs.

  • sanitize_dictionary() now also walks nested dictionaries and lists and redacts string values whose key is private_key or contains password or secret. The existing top-level behaviour is unchanged.

  • New sanitize_proxy() returns a copy of the proxy dictionary with the credentials removed from each URL. log_class_startup() uses it when sanitize_log is enabled. The proxy dictionary used for requests is not modified.

  • Bug fixes

  • Updated unit tests

Unit test coverage

I could not run the full suite: tests/test_api_request.py and most other modules need API credentials at import. I ran the TestSanitizeDictionary and new TestSanitizeProxy classes on their own (11 tests, all pass) and checked the log output by hand:

BODY: {'resources': [{'client_email': '[email protected]', 'private_key': 'REDACTED', 'project_id': 'p'}]}
CONFIG: Proxy dictionary: {'https': 'http://[email protected]:9'}

With sanitize_log=False the proxy URL is logged unchanged, as before.

Bandit analysis

$ bandit -r src/falconpy/_util
No issues identified.
Total lines of code: 1256
Total issues (by severity): Low: 0, Medium: 0, High: 0

flake8, pylint (10.00/10) and pydocstyle are clean for src/falconpy/_util.

Issues resolved

Other

  • Only string and bytes values are redacted, so flags such as reset_password: True stay readable. private_key_id is not redacted.
  • The key rule is name based. If you prefer an explicit list of key names, I can change it.

sanitize_dictionary() only redacted five key names at the top level and in
the body, so secrets under other names or nested in lists (for example
private_key or a nested client_secret) were logged in clear. The proxy
dictionary was logged with the credentials of its URLs.

Secret values are now redacted at any depth, and proxy URLs are logged
without their credentials when log sanitization is enabled.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant