Skip to content

Redact passwords from runtime snapshots - #5542

Open
Xeicker wants to merge 1 commit into
masterfrom
redact-snapshot-secrets
Open

Xeicker wants to merge 1 commit into
masterfrom
redact-snapshot-secrets

Conversation

@Xeicker

@Xeicker Xeicker commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

When a hang is detected, terminate_hung_threads() logs a snapshot of all running processes with their full command lines. If any process was started with a password on its command line, that password ends up in the logs in plain text.

Redact the value of password flags in get_runtime_snapshot().

@Xeicker
Xeicker requested a review from IvanBM18 October 14, 2026 16:55
@Xeicker
Xeicker requested a review from a team as a code owner October 14, 2026 16:55

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces command-line password redaction in process_handler.py to prevent credentials from being logged in runtime snapshots, along with corresponding unit tests. The review feedback highlights a security vulnerability where passwords containing spaces may not be fully redacted when using the proposed regular expression on a space-joined string. To address this, the reviewer recommends refactoring the redaction logic to process argument lists directly, which would also allow removing the regex and the re module import, and suggests adding test coverage for arguments containing spaces.

Comment thread src/clusterfuzz/_internal/system/process_handler.py Outdated
Comment thread src/clusterfuzz/_internal/system/process_handler.py Outdated
Comment thread src/clusterfuzz/_internal/system/process_handler.py
Comment thread src/clusterfuzz/_internal/system/process_handler.py Outdated
Comment thread src/clusterfuzz/_internal/tests/core/system/process_handler_test.py Outdated
@Xeicker
Xeicker force-pushed the redact-snapshot-secrets branch from 831f09a to 0902932 Compare October 14, 2026 17:23
@Xeicker

Xeicker commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces password redaction for command-line arguments in process snapshots to prevent sensitive credentials from being logged. It defines a regular expression to identify password flags and implements a redact_command_line function, which is applied within get_runtime_snapshot. Comprehensive unit tests have also been added to verify various redaction scenarios. Feedback suggests adding a guard check in redact_command_line to robustly handle None or empty inputs.

Comment thread src/clusterfuzz/_internal/system/process_handler.py Outdated

@IvanBM18 IvanBM18 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/clusterfuzz/_internal/system/process_handler.py Outdated

# Matches a password flag whose value must be redacted before logging. The value
# is either passed as the next argument (e.g. `-password value`) or inline after
# `=` or `:` (e.g. `--password=value`, `/password:value`).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:
Can you also add an example where this regex will match a cli flag that has both a username and password?

When a hang is detected, terminate_hung_threads() logs a snapshot of all
running processes with their full command lines. If any process was
started with a password on its command line, that password ends up in
the logs in plain text.

Redact the value of password flags in get_runtime_snapshot().
@Xeicker
Xeicker force-pushed the redact-snapshot-secrets branch from 0902932 to 97a8e29 Compare October 14, 2026 22:28
@Xeicker
Xeicker requested a review from g-ortuno October 14, 2026 22:31

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.

3 participants