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
7 changes: 7 additions & 0 deletions .golangci-comprehensive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ linters:
linters:
- gosec
text: "G404|G301|G302"
# gosec G404 (math/rand) in the ipfeed fixture generator: the random24
# shape must be reproducible from -seed; test data, not secrets.
# nix/checks/go-sec.nix carries the same scoped rule.
- path: "tools/ipfeed-fixture/main\\.go"
linters:
- gosec
text: "G404"
# G705 (XSS taint) in goiphttp's response writer: the `ip` command-line
# paths answer with `ip`'s own bytes, which can quote a path token back
# (`Device "x" does not exist`), and escaping them would break
Expand Down
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,13 @@ linters:
linters:
- gosec
text: "G404"
# gosec G404 (math/rand) in the ipfeed fixture generator: the random24
# shape must be reproducible from -seed; test data, not secrets.
# nix/checks/go-sec.nix carries the same scoped rule.
- path: "tools/ipfeed-fixture/main\\.go"
linters:
- gosec
text: "G404"
# G705 (XSS taint) in goiphttp's response writer: the `ip` command-line
# paths answer with `ip`'s own bytes, which can quote a path token back
# (`Device "x" does not exist`), and escaping them would break
Expand Down
2 changes: 1 addition & 1 deletion nix/checks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ in
ernic-run-many = import ./ernic-run-many.nix { inherit pkgs lib; };
# nix/ernic/oracle.nix: the emulator's fault counts against the guest's
# NIC counters, on fixture logs.
ernic-oracle = import ./ernic-oracle.nix { inherit pkgs lib; };
ernic-oracle = import ./ernic-oracle.nix { inherit pkgs; };
# The self-test's stream_until (nix/microvms/self-test-stream-until.nix),
# driven against sh stand-ins for a streaming xtcp2client.
self-test-stream-until = import ./self-test-stream-until.nix { inherit pkgs; };
Expand Down
4 changes: 2 additions & 2 deletions nix/checks/ernic-oracle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
# row builds a console log and server logs, runs the oracle, and prints
# ROW <name> <category> PASS|FAIL <description>: <detail>
# and any FAIL fails the check.
{ pkgs, lib }:
{ pkgs }:

let
oracle = import ../ernic/oracle.nix { inherit pkgs lib; };
oracle = import ../ernic/oracle.nix { inherit pkgs; };
in
pkgs.runCommand "xtcp2-ernic-oracle"
{
Expand Down
6 changes: 5 additions & 1 deletion nix/checks/go-sec.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
# X-Content-Type-Options: nosniff (TestHandler checks every row).
# .golangci.yml and .golangci-comprehensive.yml carry the same
# scoped rule.
# G404 in tools/ipfeed-fixture/main.go — math/rand: the fixture generator's
# random24 shape must be reproducible from its -seed; the numbers
# are test data, not secrets or nonces. The golangci configs carry
# the same scoped rule, as does nix/quality-report/default.nix.
#
# NOT excluded — these would block the build if found:
# G104 (unhandled errors), G112 (HTTP timeouts), G401 (weak crypto), etc.
Expand Down Expand Up @@ -48,7 +52,7 @@ pkgs.runCommand "xtcp2-gosec"
export CGO_ENABLED=0
export GOFLAGS=-mod=vendor
gosec -exclude=G103,G115,G204,G304 \
-exclude-rules='internal/goip/goiphttp/handler\.go:G705' \
-exclude-rules='internal/goip/goiphttp/handler\.go:G705;tools/ipfeed-fixture/main\.go:G404' \
-fmt=text ./... > $out 2>&1 || {
rc=$?
cat $out
Expand Down
2 changes: 1 addition & 1 deletion nix/ernic/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ in
profiles = "${rocmErnic}/profiles";
ownProfiles = ./profiles;
nics = import ./nics.nix { inherit lib; };
oracle = import ./oracle.nix { inherit pkgs lib; };
oracle = import ./oracle.nix { inherit pkgs; };
runMany = import ./run-many.nix {
inherit pkgs lib;
server = packages.rocm-ernic;
Expand Down
2 changes: 1 addition & 1 deletion nix/ernic/oracle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# A site that saw no frames fails: a vacuous match proves nothing.
# Prints ROW lines like the guest's checks; exits 1 if any fails.
# Counts are compared with bc, so any u64 is exact.
{ pkgs, lib }:
{ pkgs }:

pkgs.writeShellApplication {
name = "ernic-oracle";
Expand Down
2 changes: 1 addition & 1 deletion nix/ernic/run-many.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ let
''}
${lib.concatStrings (
lib.mapAttrsToList (
br: brTaps:
br: _brTaps:
let
f = fabric.${br} or { };
in
Expand Down
2 changes: 1 addition & 1 deletion nix/quality-report/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pkgs.runCommand "xtcp2-quality-report"
# `nix flake check` was green), and nothing mechanically enforces it.
runtool gosec "$RAW/gosec.json" -- \
gosec -exclude=G103,G115,G204,G304,G702 \
-exclude-rules='internal/goip/goiphttp/handler\.go:G705' \
-exclude-rules='internal/goip/goiphttp/handler\.go:G705;tools/ipfeed-fixture/main\.go:G404' \
-fmt=json ./...

# ── nix-fmt ────────────────────────────────────────────────────────
Expand Down
5 changes: 3 additions & 2 deletions tools/ipfeed-fixture/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ func writeRows(out string, n int, shape string, asn uint32, owner string, invali
return fmt.Errorf("-prefix %q: %w", prefix, perr)
}
rows := make([]rowSchema, 0, n)
//nolint:gosec // G404: deterministic-by-design — a fixture artifact must
// be reproducible from its seed; this is not a secret or a nonce.
// math/rand by design: a fixture artifact must be reproducible from its
// seed; this is not a secret or a nonce (gosec G404 is path-scoped off
// for this file in nix/checks/go-sec.nix and the golangci configs).
rng := rand.New(rand.NewSource(seed))
for i := 0; i < n; i++ {
if invalidEvery > 0 && i%invalidEvery == invalidEvery-1 {
Expand Down