Skip to content

fix: reject reused PIDs during tree walks and WTS lookups - #29

Merged
cursor[bot] merged 1 commit into
mainfrom
cursor/process-identity-query-edges-df63
Oct 20, 2026
Merged

cursor[bot] merged 1 commit into
mainfrom
cursor/process-identity-query-edges-df63

Conversation

@JamesLinYJ

Copy link
Copy Markdown
Owner

Summary

End Process Tree and the process-list account fallback could treat a reused PID as the process that was just snapshotted.

  • Process-tree termination now samples the decision time before CreateToolhelp32Snapshot. A process created while Toolhelp is running, including one that reused a frozen PID, fails the creation-time bound and is not terminated.
  • A WTS account row is keyed only by PID. It is copied onto a row only when a live open still returns that row's creation time. Access-denied identities are not opened again. A process that has already exited is not given the replacement's account.
  • query_process_identity_for_pid no longer returns Ok for PID 0 or a zero creation time. Those values are the unverified sentinel.

No new columns, pages, or dependencies. This does not touch the process-name filter or Startup page branches.

Tests

Unit tests cover a replacement born after the decision instant, a reused or exited PID on the WTS path, access-denied (still allowed, because the process cannot be opened), and a zero creation time. Windows CI runs the full suite; this host can only cross-check the MSVC target.

Open in Web Open in Cursor 

Sample the process-tree decision time before Toolhelp so a PID reused
while the snapshot runs cannot pass the creation-time bound. Apply a
WTS account only when a live open still names the same process, and
treat a zero creation time as a failed identity query.

Co-authored-by: jameslincn <jameslincn@outlook.sg>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T02:35:53.394687Z 81b7d42 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cursor
cursor Bot merged commit e3c6698 into main Oct 20, 2026
3 checks passed
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.

2 participants