Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
# or Edge profile, a spawning schtasks.exe / powershell.exe, or a
# domain to talk to. This floor exists to stop coverage going *down*
# β€” raise it whenever it improves, never lower it to green a build.
min=42
min=43
if awk "BEGIN {exit !(${total} < ${min})}"; then
echo "::error::coverage ${total}% is below the ${min}% floor"
exit 1
Expand Down Expand Up @@ -88,11 +88,17 @@ jobs:
- name: unit tests (platform-neutral packages)
run: go test ./internal/token ./internal/audit ./internal/ui ./internal/server

# Fuzzing on every push/PR. The packages exercised here eat untrusted input β€”
# registry hives, KDC replies, payload envelopes β€” inside a process that holds
# an elevated token, so a panic is a real availability bug, not a test
# artefact. Runs are short and bounded: this is a smoke gate, not a soak. Any
# crasher is written to testdata/fuzz/ and fails the job.
# Fuzzing on every push/PR. Two groups of targets:
# * the module parsers β€” registry hives, KDC replies, payload envelopes β€”
# which read bytes this tool did not author;
# * the console's own guard: the Host allow-list (DNS rebinding), the
# WebSocket Origin parser and the route policy (never reaches a handler
# without the run token; its inputs cannot match the token by
# construction, so it only ever exercises refusals).
# A panic in the first group is an availability bug in a process holding an
# elevated token; a hole in the second exposes every module at once. Runs are
# short and bounded: this is a smoke gate, not a soak. Any crasher is written
# to testdata/fuzz/ and fails the job.
#
# One target per invocation: `go test -fuzz` matches a single target.
fuzz-smoke:
Expand All @@ -113,6 +119,16 @@ jobs:
run: go test -run='^$' -fuzz=FuzzMaskRoundTrip -fuzztime=30s ./internal/obfuscate
- name: fuzz persist name sanitizer
run: go test -run='^$' -fuzz=FuzzSanitizeName -fuzztime=30s ./internal/persist
# The console targets are cheaper per execution and carry hostile seeds,
# so they get a shorter budget than the parsers.
- name: fuzz host allow-list
run: go test -run='^$' -fuzz=FuzzValidHost -fuzztime=20s ./internal/server
- name: fuzz ws origin guard
run: go test -run='^$' -fuzz=FuzzAllowedOrigin -fuzztime=20s ./internal/server
- name: fuzz route policy
run: go test -run='^$' -fuzz=FuzzRoutesRejectBadToken -fuzztime=20s ./internal/server
- name: fuzz token comparison
run: go test -run='^$' -fuzz=FuzzEqual -fuzztime=20s ./internal/token

# Static analysis (gosec) of exactly the code that ships. GOOS is pinned to
# windows even though the runner is Linux, because the entire
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ build the project), run the underlying commands straight out of the `Makefile`.
Never lower it to make a build green. `make cover` prints the total.
- **Fuzzing** β€” the parsers that eat attacker-influenced input have fuzz targets
(`FuzzRegf`, `FuzzParseRep`, `FuzzUnpack`, `FuzzMaskRoundTrip`,
`FuzzSanitizeName`). Seeds run as ordinary tests; to actually fuzz one:
`FuzzSanitizeName`), as does the console's own guard (`FuzzValidHost`,
`FuzzAllowedOrigin`, `FuzzRoutesRejectBadToken`, `FuzzEqual`). Seeds run as
ordinary tests; to actually fuzz one:

```bash
go test -run='^$' -fuzz=FuzzRegf -fuzztime=60s ./internal/audit
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ fuzz-check:
go test -run='^$$' -fuzz=FuzzUnpack -fuzztime=20s ./internal/research
go test -run='^$$' -fuzz=FuzzMaskRoundTrip -fuzztime=20s ./internal/obfuscate
go test -run='^$$' -fuzz=FuzzSanitizeName -fuzztime=20s ./internal/persist
go test -run='^$$' -fuzz=FuzzValidHost -fuzztime=15s ./internal/server
go test -run='^$$' -fuzz=FuzzAllowedOrigin -fuzztime=15s ./internal/server
go test -run='^$$' -fuzz=FuzzRoutesRejectBadToken -fuzztime=15s ./internal/server
go test -run='^$$' -fuzz=FuzzEqual -fuzztime=15s ./internal/token

# Whole-tree statement coverage; CI fails below its ratcheting floor.
cover:
Expand Down
Loading
Loading