fix(08): clean up 3 executor-resolvable warnings from plan-check pass 2
- 08-01 D-08-27 doc header copy-edit: THREE -> FOUR existing source files (header was 1-off from the actual enumeration of 4 src files: manager.go, runtime.go, engine.go, dispatcher_counter.go) - 08-02 Task 3 Step F: drop the invalid Go file-level statement '_ = syscall.AF_INET'. Replace with NOTE that this form is invalid at file scope; if linter flags unused import, drop the import entirely. - 08-02 Task 2 acceptance criteria: add grep gates for XrayTunInbound() + XrayTunOutbound() in wintun_session.go and ResolveAdapterLUID() in wintun_adapter.go (these are forward-referenced by Task 3 lifecycle_windows.go; Task 2 must declare them so Task 3 can compile). Plans now ship clean for execute-phase dispatch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -313,7 +313,7 @@ class ProwlerEventsWindows {
|
|||||||
- References: 08-CONTEXT.md D-08-18, 08-RESEARCH.md §Pattern 4 (WFP killswitch), upstream repo `github.com/WireGuard/wireguard-windows/tree/master/tunnel/firewall`.
|
- References: 08-CONTEXT.md D-08-18, 08-RESEARCH.md §Pattern 4 (WFP killswitch), upstream repo `github.com/WireGuard/wireguard-windows/tree/master/tunnel/firewall`.
|
||||||
|
|
||||||
**Doc 4: `AP4-EXCEPTION-D-08-27-WINDOWS-CONNECT-PATH.md` (NEW PER PLAN-REVISION-1 BLOCKER FIX)**
|
**Doc 4: `AP4-EXCEPTION-D-08-27-WINDOWS-CONNECT-PATH.md` (NEW PER PLAN-REVISION-1 BLOCKER FIX)**
|
||||||
- Header: `# AP-4 byte-freeze exception — D-08-27 Windows-Connect-path build-tag splits` + Date `<today's date>` + Granted by `Plan-revision-1 plan-checker BLOCKER fix, ratified by orchestrator's Path-B verdict on 2026-05-18 after empirical read of prowler-server/core/src/connection/manager.go (164 lines, NO PlatformLifecycle interface — Path A structurally impossible)` + Scope `Surgical build-tag-controlled lift across THREE existing source files under AP-4 protection — connection/manager.go (Connect/Disconnect get Windows-only platform-hook insertion points via //go:build windows variant), xray/runtime.go (line 138 RegisterXrayLogcatSink redirect to Windows-specific RegisterXraySink via //go:build), and platform/android/*.go (×4 files: bridge.go + protect_callback_bridge.go + xray_logcat_sink.go + the Phase 5 dispatcher_counter binding) get //go:build !windows header prepend so they stop compiling on GOOS=windows. NO other lift authorised by this exception.`
|
- Header: `# AP-4 byte-freeze exception — D-08-27 Windows-Connect-path build-tag splits` + Date `<today's date>` + Granted by `Plan-revision-1 plan-checker BLOCKER fix, ratified by orchestrator's Path-B verdict on 2026-05-18 after empirical read of prowler-server/core/src/connection/manager.go (164 lines, NO PlatformLifecycle interface — Path A structurally impossible)` + Scope `Surgical build-tag-controlled lift across FOUR existing source files under AP-4 protection — connection/manager.go (Connect/Disconnect get Windows-only platform-hook insertion points via //go:build windows variant), xray/runtime.go (line 138 RegisterXrayLogcatSink redirect to Windows-specific RegisterXraySink via //go:build), proxy/engine.go (4 hardcoded androidbridge call sites at lines 16/74/116/163 get build-tagged sibling files), and xray/dispatcher_counter.go (4 androidbridge call sites at lines 9/61/69/71 get build-tagged sibling) — PLUS platform/android/*.go (×3 production files: bridge.go + protect_callback_bridge.go + xray_logcat_sink.go) get //go:build !windows header prepend so they stop compiling on GOOS=windows. NO other lift authorised by this exception.`
|
||||||
- Precedent: cite 5 prior AP-4 exceptions per 06-LEARNINGS.md lines 124-156 (Bug-B structural is the closest analog — it touched multiple files surgically) + D-07-16 lift (2-line edit precedent for single-file surgical scope); state "structurally identical except scope is multi-file build-tag stickers + 2 surgical insertion points; total visible diff: ~30-50 LOC + 4 build-tag-header prepends".
|
- Precedent: cite 5 prior AP-4 exceptions per 06-LEARNINGS.md lines 124-156 (Bug-B structural is the closest analog — it touched multiple files surgically) + D-07-16 lift (2-line edit precedent for single-file surgical scope); state "structurally identical except scope is multi-file build-tag stickers + 2 surgical insertion points; total visible diff: ~30-50 LOC + 4 build-tag-header prepends".
|
||||||
- Files unfrozen — EXPLICIT path list with bounded scope:
|
- Files unfrozen — EXPLICIT path list with bounded scope:
|
||||||
1. `prowler-server/core/src/connection/manager.go` — Connect/Disconnect functions only. ALLOWED CHANGE SHAPE: add `platformLifecycle PlatformLifecycle` field on `Manager` struct + `SetPlatformLifecycle(p PlatformLifecycle)` setter + (NEW) interface declaration `type PlatformLifecycle interface { OnConnectPre(mode Mode) error; OnConnectPost(mode Mode) error; OnDisconnectPre() error; OnDisconnectPost() error }` + 4 hook-call sites in `Connect()` (lines 63-68) and `Disconnect()` (lines 70-75) bracketing the existing `engine.Stop()` / `connectWithRetry()` calls. ALL existing code paths byte-identical when `platformLifecycle == nil` (the Android-default path); the hooks short-circuit to nil-check fall-through.
|
1. `prowler-server/core/src/connection/manager.go` — Connect/Disconnect functions only. ALLOWED CHANGE SHAPE: add `platformLifecycle PlatformLifecycle` field on `Manager` struct + `SetPlatformLifecycle(p PlatformLifecycle)` setter + (NEW) interface declaration `type PlatformLifecycle interface { OnConnectPre(mode Mode) error; OnConnectPost(mode Mode) error; OnDisconnectPre() error; OnDisconnectPost() error }` + 4 hook-call sites in `Connect()` (lines 63-68) and `Disconnect()` (lines 70-75) bracketing the existing `engine.Stop()` / `connectWithRetry()` calls. ALL existing code paths byte-identical when `platformLifecycle == nil` (the Android-default path); the hooks short-circuit to nil-check fall-through.
|
||||||
|
|||||||
@@ -710,7 +710,7 @@ func RestoreDNS() error {
|
|||||||
</action>
|
</action>
|
||||||
<acceptance_criteria>
|
<acceptance_criteria>
|
||||||
- File `prowler-server/core/src/platform/windows/wintun_adapter.go` exists with literals: `AP-4 EXCEPTION (D-08-23`, `Prowler Network` (D-08-05), `Wintun` TunnelType, `golang.zx2c4.com/wintun` import, `CreateAdapter` AND `OpenAdapter` (startup sweep for Pitfall 4)
|
- File `prowler-server/core/src/platform/windows/wintun_adapter.go` exists with literals: `AP-4 EXCEPTION (D-08-23`, `Prowler Network` (D-08-05), `Wintun` TunnelType, `golang.zx2c4.com/wintun` import, `CreateAdapter` AND `OpenAdapter` (startup sweep for Pitfall 4)
|
||||||
- File `prowler-server/core/src/platform/windows/wintun_session.go` exists with literals: `runtime.LockOSThread()` (MANDATORY per OS-thread handle rule), `0x400000` OR `SessionRingCap` (4 MiB ring), `ReceivePacket`, AND ring copy-out-before-release pattern (regex `copy\(buf, packet\)` OR `make\(\[\]byte, len\(packet\)\)`)
|
- File `prowler-server/core/src/platform/windows/wintun_session.go` exists with literals: `runtime.LockOSThread()` (MANDATORY per OS-thread handle rule), `0x400000` OR `SessionRingCap` (4 MiB ring), `ReceivePacket`, AND ring copy-out-before-release pattern (regex `copy\(buf, packet\)` OR `make\(\[\]byte, len\(packet\)\)`), AND `func XrayTunInbound() chan []byte` + `func XrayTunOutbound() chan []byte` accessors (consumed by Task 3 lifecycle_windows.go::OnConnectPost). Also: `wintun_adapter.go` exports `func ResolveAdapterLUID(name string) (uint64, error)` (consumed by Task 3 for WFP `EnableBlocking(adapterLUID)` call).
|
||||||
- File `prowler-server/core/src/platform/windows/dns_manager.go` exists with literals: `1.1.1.1` (D-08-02), `dns-restore.json`, `LOCALAPPDATA`, `metric=1` OR `InterfaceMetric` (D-08-02 Pitfall 5 mitigation), `GetAdaptersAddresses` (typed Win32 — NOT netsh-stdout-scrape per Anti-Pattern), `validate=no`, `os.IsNotExist` (RestoreDNS idempotent guard)
|
- File `prowler-server/core/src/platform/windows/dns_manager.go` exists with literals: `1.1.1.1` (D-08-02), `dns-restore.json`, `LOCALAPPDATA`, `metric=1` OR `InterfaceMetric` (D-08-02 Pitfall 5 mitigation), `GetAdaptersAddresses` (typed Win32 — NOT netsh-stdout-scrape per Anti-Pattern), `validate=no`, `os.IsNotExist` (RestoreDNS idempotent guard)
|
||||||
- File `prowler-server/core/src/platform/windows/network_change_watcher.go` exists with literals: `NotifyIpInterfaceChange`. The `//export prowler_net_change_callback` function body MUST NOT contain `CancelMibChangeNotify2` (anti-pattern guard — calling Cancel from inside the callback deadlocks per MSDN)
|
- File `prowler-server/core/src/platform/windows/network_change_watcher.go` exists with literals: `NotifyIpInterfaceChange`. The `//export prowler_net_change_callback` function body MUST NOT contain `CancelMibChangeNotify2` (anti-pattern guard — calling Cancel from inside the callback deadlocks per MSDN)
|
||||||
- File `prowler-server/core/src/platform/windows/xray_log_sink.go` exists with literals: `sync.Once`, `RegisterXraySink` OR `RegisterXrayLogSink`, `RegisterHandlerCreator` (xapplog dual registration), `RegisterHandler` (bare defensive), `Severity_Info` (D-07-14 floor), `PushLog`
|
- File `prowler-server/core/src/platform/windows/xray_log_sink.go` exists with literals: `sync.Once`, `RegisterXraySink` OR `RegisterXrayLogSink`, `RegisterHandlerCreator` (xapplog dual registration), `RegisterHandler` (bare defensive), `Severity_Info` (D-07-14 floor), `PushLog`
|
||||||
@@ -740,6 +740,11 @@ func RestoreDNS() error {
|
|||||||
grep -q "ReceivePacket" prowler-server/core/src/platform/windows/wintun_session.go || { echo "ReceivePacket MISSING"; exit 1; }
|
grep -q "ReceivePacket" prowler-server/core/src/platform/windows/wintun_session.go || { echo "ReceivePacket MISSING"; exit 1; }
|
||||||
# Must copy out of ring before ReleasePacket:
|
# Must copy out of ring before ReleasePacket:
|
||||||
grep -qE "copy\(buf, packet\)|make\(\[\]byte, len\(packet\)\)" prowler-server/core/src/platform/windows/wintun_session.go || { echo "ring copy-out-before-release MISSING (Pitfall: wintun.sys reuses slots)"; exit 1; }
|
grep -qE "copy\(buf, packet\)|make\(\[\]byte, len\(packet\)\)" prowler-server/core/src/platform/windows/wintun_session.go || { echo "ring copy-out-before-release MISSING (Pitfall: wintun.sys reuses slots)"; exit 1; }
|
||||||
|
# Channel accessors consumed by Task 3 lifecycle_windows.go — must be defined here:
|
||||||
|
grep -qE "func XrayTunInbound\(\)" prowler-server/core/src/platform/windows/wintun_session.go || { echo "XrayTunInbound() accessor MISSING (consumed by lifecycle_windows.go::OnConnectPost)"; exit 1; }
|
||||||
|
grep -qE "func XrayTunOutbound\(\)" prowler-server/core/src/platform/windows/wintun_session.go || { echo "XrayTunOutbound() accessor MISSING (consumed by lifecycle_windows.go::OnConnectPost)"; exit 1; }
|
||||||
|
# Adapter LUID resolver consumed by Task 3:
|
||||||
|
grep -qE "func ResolveAdapterLUID\(" prowler-server/core/src/platform/windows/wintun_adapter.go || { echo "ResolveAdapterLUID() helper MISSING (consumed by lifecycle_windows.go for WFP EnableBlocking call)"; exit 1; }
|
||||||
|
|
||||||
# DNS manager file:
|
# DNS manager file:
|
||||||
[[ -f prowler-server/core/src/platform/windows/dns_manager.go ]] || { echo "dns_manager.go MISSING"; exit 1; }
|
[[ -f prowler-server/core/src/platform/windows/dns_manager.go ]] || { echo "dns_manager.go MISSING"; exit 1; }
|
||||||
@@ -1062,9 +1067,10 @@ func RestoreDNS() error {
|
|||||||
|
|
||||||
// platformProtectSocket is the Android VpnService.protect() FD-protector.
|
// platformProtectSocket is the Android VpnService.protect() FD-protector.
|
||||||
var platformProtectSocket = androidbridge.ProtectSocket
|
var platformProtectSocket = androidbridge.ProtectSocket
|
||||||
_ = syscall.AF_INET // silence unused-import (keep parity with original runtime.go line 11 import set)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
NOTE: Do NOT add a `syscall` import — `androidbridge.ProtectSocket` has its own type signature and does not require `syscall` constants at this file-level. The original `runtime.go` line 11 `syscall` import (if present) stays inside its file unchanged via the `//go:build !windows` sticker. If `go vet` or the linter flags an unused import in `protect_hook_android.go`, drop it; do NOT use the `_ = syscall.AF_INET` form (invalid Go at file-level scope — needs `var _ = ...` instead).
|
||||||
|
|
||||||
`protect_hook_windows.go`:
|
`protect_hook_windows.go`:
|
||||||
```go
|
```go
|
||||||
//go:build windows
|
//go:build windows
|
||||||
|
|||||||
Reference in New Issue
Block a user