fix(config): pin PID identity probes to trusted binaries - #1359
Conversation
📝 WalkthroughWalkthroughThe process command-line probe now supports injectable execution and platform selection. It validates PIDs, uses Linux ChangesProcess identity probing
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant readProcessCommandLine
participant ProcessCommandExec
participant TrustedExecutableResolver
participant WMIC
participant PowerShell
readProcessCommandLine->>ProcessCommandExec: probe process command line
ProcessCommandExec->>TrustedExecutableResolver: resolve trusted Windows path
TrustedExecutableResolver-->>ProcessCommandExec: WMIC or PowerShell path
ProcessCommandExec->>WMIC: query process command line
WMIC-->>ProcessCommandExec: command output or failure
ProcessCommandExec->>PowerShell: run fallback query when WMIC fails
PowerShell-->>readProcessCommandLine: command output or undefined
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
2/4 boxes ticked. This PR stays in draft until every box above is ticked. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/config.test.ts`:
- Around line 1839-1862: Update the pid validation test around
setOcxStartProcessCacheForTests to force the Unix ps fallback by setting
setProcessCommandLinePlatformForTests("darwin") and injecting
setProcessCommandLineExecForTests. Record each probe and assert that only
/bin/ps and /usr/bin/ps are attempted, while preserving the existing PATH
poisoning and marker assertions. Reset both process-command-line hooks in the
finally block.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: dc36183c-e03d-47f3-aa0c-3129eb5a83f3
📒 Files selected for processing (2)
src/config.tstests/config.test.ts
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/config.test.ts`:
- Around line 1841-1846: Update the fake ps script setup near markerPath and
fakePs to place the marker beside fakePs and reference it as "$0.executed"
instead of embedding markerPath in a single-quoted shell string. Keep the
script’s existing marker-writing and output behavior unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 744ebcd9-dbad-4ea5-a88f-eb5bed776b40
📒 Files selected for processing (1)
tests/config.test.ts
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
psorpowershell.exethrough caller-controlledPATH./proc/<pid>/cmdlinefirst, then fall back only to/bin/psor/usr/bin/ps.This keeps the existing PID identity and timeout behavior while removing environment-controlled executable lookup from lifecycle checks.
Verification
bun test tests/config.test.ts -t 'pid validation'— 2 passed, 0 failed on Windows.bun run typecheckbun run privacy:scangit diff --checkdevcontrol.Checklist
Review readiness checklist
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit