Skip to content

fix: Windows binaries panicked on every scan; test on Windows in CI - #46

Merged
aksOps merged 5 commits into
mainfrom
ci/windows-tests
Aug 7, 2026
Merged

fix: Windows binaries panicked on every scan; test on Windows in CI#46
aksOps merged 5 commits into
mainfrom
ci/windows-tests

Conversation

@aksOps

@aksOps aksOps commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The new Windows CI job failed on its first run, and the failure is a shipped production defect, not a CI problem.

The defect

The repository had no .gitattributes, and git's autocrlf default on Windows converts text files to CRLF at checkout. The rule packs are embedded with include_str! and their rules list is located by the exact byte sequence \nrules:\n - which a CRLF checkout does not contain. Result: default_rules() panics, and every published Windows binary (v1.0.x through v1.5.0) panics on any scan that uses the default rules - which is every scan without --no-default-rules. Dead on arrival.

Reproduced on Linux by converting the two rule documents to CRLF: same panic, same line, both in the test suite and in a real scan.

The fix, both layers

  • .gitattributes with * text=auto eol=lf - every checkout on every platform now produces the bytes the code was tested against
  • default_pack.rs normalizes CRLF out of the embedded documents before assembling the pack - a converted checkout (or any future include path) still builds a working binary

Verified under CRLF simulation: the previously-panicking test passes and a real scan reports findings.

The CI job

windows-latest: cargo build, full cargo test (first time any test executes on Windows, including the cfg(windows) NTFS alternate-data-stream cache paths), and a smoke step running the compiled binary against a runtime-generated credential, asserting the finding.

This is the job that caught the defect. It should have existed at v1.0.

Follow-up after merge

Tag v1.5.1 so a working Windows binary actually ships.

aksOps added 2 commits August 7, 2026 03:45
A checkout with git's autocrlf default on Windows converted the committed
rule documents to CRLF, so the byte sequence locating the rules list in
the embedded pack never matched and every scan panicked. Every published
Windows binary was affected.

Force LF for all text files via .gitattributes, and normalize the
embedded documents before the pack is assembled so a converted checkout
still builds a working binary.
@aksOps aksOps changed the title ci: build, test and smoke-test on Windows fix: Windows binaries panicked on every scan; test on Windows in CI Aug 7, 2026
aksOps added 3 commits August 7, 2026 04:04
The escape-filename fixtures cannot exist on Windows - control characters
are illegal in file names there, which also means the attack they model
cannot arrive that way - so those tests are unix-only. The help test now
asserts the usage forms without the binary name, which clap renders as
siloscan.exe on Windows.
exclusion_under compared a canonicalized scan root against a raw
fallback spelling whenever the cache directory did not exist yet. On
Windows the two spellings (verbatim long form vs 8.3 short names) never
share a prefix, so the exclusion silently vanished and a scan with
--cache-dir inside the root walked its own cache. Paths that do not
exist now resolve through their nearest existing ancestor.

Silo and rule path globs are matched against forward-slash relative
paths on every platform, so their syntax is now pinned: backslash
escapes everywhere, instead of globset's Windows default of treating it
as a separator.

Test fixtures: the foreign-salt test copies the salt by read and write
because fs::copy cannot copy attributes onto an NTFS alternate data
stream, and the global-excludes fixture writes its gitconfig path with
forward slashes because git config treats backslash as an escape.
The ignore crate expands every tilde in a configured excludesFile path
to the home directory, not only a leading one. Windows temp paths carry
8.3 short names like RUNNER~1, which that expansion corrupts into a
path that opens nothing. The fixture now uses the canonical spelling,
which carries no tilde.
@aksOps
aksOps merged commit 84aa982 into main Aug 7, 2026
14 checks passed
@aksOps
aksOps deleted the ci/windows-tests branch August 7, 2026 04:23
@aksOps aksOps mentioned this pull request Aug 7, 2026
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