Skip to content

Fix/windows integration harness - #69

Merged
tharindupr merged 2 commits into
mainfrom
fix/windows-integration-harness
Aug 2, 2026
Merged

Fix/windows integration harness#69
tharindupr merged 2 commits into
mainfrom
fix/windows-integration-harness

Conversation

@kavishkafer

@kavishkafer kavishkafer commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Fix Windows integration harness and close CI gaps

Discovered while attempting to reproduce detection numbers locally on Windows: the integration harness has historically been broken on Windows due to two silent runtime bugs that escape compilation and linting checks (go build/go vet).

This PR resolves both issues, brings Windows into the integration CI matrix, and adds a test verifying risk score provenance boundaries.

1. Fix Sidecar Execution Failure (Bug 1)

  • Issue: The harness compiled the sidecar binary without a .exe extension. While go build succeeds and writes the extensionless file to disk, Windows refuses to launch it. os/exec fails with a misleading executable file not found in %PATH% error because it strictly expects .exe, .com, .bat, or .cmd extensions on this platform.
  • Fix: Updated the harness build logic to correctly append the .exe suffix when running on Windows.

2. Fix Transport Communication Failure (Bug 2)

  • Issue: The harness hardcoded a standard filesystem path and attempted to dial it as a Unix socket. While the sidecar itself contains platform-specific transport logic (via pipe.go build tags and go-winio), the integration harness completely bypassed this abstraction, resulting in an Incorrect function error on Windows.
  • Fix: Ported the same unix/windows split found in the sidecar's transport package over to the harness, enabling proper Windows Named Pipe dialing.

3. CI Matrix Expansion

  • Issue: The integration suite was entirely missing from the CI pipeline, meaning these regressions went completely unnoticed.
  • Fix: Added windows-latest to the integration test matrix to ensure platform compatibility moving forward.

4. Added Security Boundary Test (aggregate.go)

  • Context: Investigated whether an attacker who compromises the SDK could manipulate the pipeline's final verdict by falsifying the provenance trust weight (which multiplies the overall risk score).
  • Result: Ran all 58 corpus payloads across every trust weight variance. Zero changes to the output. Detection pipeline decisions are strictly signal-driven (evaluated via OPA policy rules against fired categories rather than raw numerical score thresholds).
  • Action: Leaving this test permanently in the suite to ensure this security model remains invariant against future pipeline updates.

The harness built the sidecar with no .exe suffix and dialed a
filesystem-path Unix socket, so it never ran on Windows: exec.Command
can't launch an extensionless binary there, and the sidecar's own
Windows named-pipe transport (pipe.go, already build-tagged) never got
addressed correctly. Neither bug is visible to go build, go vet, or
GOOS=windows cross-compilation — only running the suite surfaces them.

Adds a build-tagged harnessSocketPath/dialSidecar pair mirroring how
internal/transport already splits uds.go/pipe.go, and wires the
integration suite into CI on both ubuntu-latest and windows-latest so
this can't regress silently again.

Detection numbers are unaffected — pipeline logic is pure text
processing with no platform dependency. Verified: full suite passes
identically to the pre-existing Linux run (33 baseline + 25 gap
probes, same 4 probes closed).
aggregate.go multiplies risk score by ProvenanceWeight(rc.Provenance),
a field set inside the agent process — the untrusted side of the trust
boundary. Since a compromised PEP could claim any trust weight, this
probe re-sends every corpus payload under each configured provenance
value and asserts the verdict never loosens.

Result: 0/58 downgraded. Detection is signal-driven in OPA (category
presence, not score threshold), so the score multiplier a forged
provenance controls doesn't change the outcome. Kept as a standing
regression test — if a future policy escalates on score instead of
signal count (e.g. the planned on_context multi-signal fix), this
probe is what would catch a forged-provenance bypass reappearing.
@kavishkafer
kavishkafer force-pushed the fix/windows-integration-harness branch from d50db7a to 898e0da Compare July 31, 2026 14:02

@VibhorGautam VibhorGautam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the %PATH% error not mentioning extensions is nasty, good find. pipe split matching the sidecar transport makes sense

one thing on the provenance probe, it only logs, never fails. if forged provenance ever starts downgrading verdicts ci stays green, so it doesn't actually guard anything. since it's staying in the suite id make it fail when downgrades > 0, passes today anyway since you measured zero

2 small ones, the job pins go 1.22 but go.mod wants 1.25 so every run downloads the toolchain, and go-winio is a direct import now but still marked indirect. neither blocks

I had this same ci job half written locally so good timing. will do opa test and -count=1 on the makefile separately

@tharindupr
tharindupr merged commit 9a6215d into main Aug 2, 2026
4 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.

3 participants