Skip to content

fix: harden Windows window target discovery - #2246

Merged
richiemcilroy merged 3 commits into
mainfrom
fix/windows-window-target-discovery-2164
Sep 9, 2026
Merged

fix: harden Windows window target discovery#2246
richiemcilroy merged 3 commits into
mainfrom
fix/windows-window-target-discovery-2164

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Sep 8, 2026

Copy link
Copy Markdown
Member

Harden Windows window discovery around the empty CLI target-list report in #2164. Use the documented EnumWindows top-level API, log enumeration errors, and fix ignored-executable matching: the previous code compared names containing .exe against extensionless entries.

Adds native Windows coverage for visible foreign-process top-level and owned-popup windows, hidden/minimized/child/tool/current-process exclusions, metadata required by recording targets, and HWND/WindowId round-tripping. The test initializes per-monitor DPI awareness like the CLI. The CI workflow also runs the same fixture against the PR base implementation and uses pinned action revisions.

Validation on head 626d994969f516153ccf058662ff11c397e81398: the native Windows Server 2022 job passed all 3 unit tests, 2 integration test targets, and crate Clippy with -D warnings. The base implementation also passed the integration fixture. This does not reproduce #2164, and the enumeration call alone is not a proven root cause of the report. Native test and baseline logs.

Local checks also passed: cargo fmt --all --check, macOS cargo check --locked -p scap-targets, Windows-target checking/Clippy for the exact source and test targets with repository lints, actionlint, and isolated diff checks. Existing uncommitted v0.6 work is excluded from this PR.

Release gate for #2164: verify the exact Windows 11 24H2/Camoufox CLI discovery and recording workflow. Window-content isolation is separate: Windows recording currently captures a display region, so moved or occluded windows require separate validation. This PR does not automatically close the issue.

Greptile Summary

This PR restores Windows target discovery by enumerating top-level windows, fixes ignored-executable matching by comparing executable stems, and adds native Windows regression coverage and CI validation.

  • Uses EnumWindows while retaining visibility, minimized, child, tool-window, and current-process filtering.
  • Tests native HWND/WindowId round-tripping and eligible versus excluded windows.
  • Pins workflow actions and fetches sufficient history for comparison with the pull request base.

Confidence Score: 5/5

The PR appears safe to merge with no outstanding correctness or repository-rule issues.

The DPI-awareness and immutable-action findings were manually resolved, and the remaining base-commit finding is now fixed because the pull-request merge checkout retains two commits, including the exact base parent used by git show.

Important Files Changed

Filename Overview
crates/scap-targets/src/platform/win.rs Restores top-level Windows enumeration and correctly matches ignored executable stems.
crates/scap-targets/tests/windows_targets.rs Adds DPI-aware native regression coverage for eligible and excluded window types and WindowId round-tripping.
.github/workflows/windows-targets.yml Adds pinned native Windows validation and now retains the base parent required by the baseline comparison.

Reviews (3): Last reviewed commit: "ci: fetch the base revision for Windows ..." | Re-trigger Greptile

Context used:

@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

@superagent-security superagent-security 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.

Superagent found 1 security concern(s).

Comment thread .github/workflows/windows-targets.yml
@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

Comment thread crates/scap-targets/tests/windows_targets.rs
Comment thread .github/workflows/windows-targets.yml Outdated
Comment thread .github/workflows/windows-targets.yml
@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

@richiemcilroy richiemcilroy changed the title fix: restore Windows window target discovery fix: harden Windows window target discovery Sep 8, 2026
@richiemcilroy
richiemcilroy merged commit 3431b4b into main Sep 9, 2026
28 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.

1 participant