Skip to content

t1402: Sanitize process names in log output to prevent log injection#2908

Merged
marcusquinn merged 1 commit intomainfrom
fix/pulse-wrapper-log-sanitization
Mar 5, 2026
Merged

t1402: Sanitize process names in log output to prevent log injection#2908
marcusquinn merged 1 commit intomainfrom
fix/pulse-wrapper-log-sanitization

Conversation

@alex-solovyev
Copy link
Collaborator

Summary

  • Adds _sanitize_log_field() helper that strips control characters (ASCII 0x00-0x1F, 0x7F) from untrusted strings before writing to log files
  • Applies sanitization to cmd_base in guard_child_processes() where process names from ps output are logged during termination
  • Prevents log injection attacks where a crafted process name could insert fake log entries or mislead administrators

Issue Analysis

Issue #2892 reported 4 findings from Gemini review on PR #2881:

# Severity Finding Status
1 CRITICAL grep -v "$$" self-exclusion bypass (~line 2232) Already fixedguard_child_processes now uses awk descendant-tree walk
2 CRITICAL grep -v "$$" self-exclusion bypass (~line 2272) Already fixed — old shellcheck reaper consolidated into guard_child_processes
3 MEDIUM Log injection via unsanitized cmd in process guard Fixed in this PR
4 MEDIUM Log injection via unsanitized cmd in shellcheck reaper Already resolved — function consolidated; cleanup_orphans only logs counts, not process names

The two critical findings were resolved by PRs #2879, #2881, #2885, and #2886 which rewrote the process guard to use proper descendant-tree walking. This PR addresses the remaining medium-severity log injection finding.

Testing

  • ShellCheck: zero violations
  • Unit tests for _sanitize_log_field(): normal input, newline injection, tab stripping, CR stripping, empty input, path-like input — all pass

Closes #2892

@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

Warning

Rate limit exceeded

@marcusquinn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 35 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1445cef6-dd56-4a06-80ee-6263013c0193

📥 Commits

Reviewing files that changed from the base of the PR and between 8f8d51f and 45cb57b.

📒 Files selected for processing (1)
  • .agents/scripts/pulse-wrapper.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/pulse-wrapper-log-sanitization

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 107 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Thu Mar 5 06:17:32 UTC 2026: Code review monitoring started
Thu Mar 5 06:17:32 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 107

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 107
  • VULNERABILITIES: 0

Generated on: Thu Mar 5 06:17:35 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2026

@marcusquinn
Copy link
Owner

PR has been open 8.5+ hours with green CI but zero formal reviews. Waiting for a review before merge can proceed. CodeRabbit shows 'pass' in the CI gate but has not posted a formal review comment on this PR.

@robstiles
Copy link

Permission check failed for this PR (HTTP 403 from collaborator permission API). Unable to determine if @alex-solovyev is a maintainer or external contributor. A maintainer must review and merge this PR manually. This is a fail-closed safety measure — the pulse will not auto-merge until the permission API succeeds.

…1402)

Add _sanitize_log_field() helper that strips control characters (ASCII
0x00-0x1F and 0x7F) from untrusted strings before writing to log files.
Applied to cmd_base in guard_child_processes() where process names from
ps output are logged during termination.

Addresses the medium-severity log injection findings from Gemini review
on PR #2881. The two critical findings (grep -v $$ self-exclusion
bypass) were already fixed by prior PRs that rewrote the process guard
to use awk descendant-tree walking.

Closes #2892
@marcusquinn marcusquinn force-pushed the fix/pulse-wrapper-log-sanitization branch from 0601ec8 to 45cb57b Compare March 5, 2026 16:33
@marcusquinn marcusquinn merged commit b47d1fc into main Mar 5, 2026
4 of 6 checks passed
@marcusquinn marcusquinn deleted the fix/pulse-wrapper-log-sanitization branch March 5, 2026 16:33
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.

quality-debt: .agents/scripts/pulse-wrapper.sh — PR #2881 review feedback (critical)

3 participants