Skip to content

feat(xtcp2): debug writers as build-time opt-ins (FP-1) - #293

Merged
randomizedcoder merged 2 commits into
mainfrom
sec/fp1-debug-writer-tags
Nov 12, 2026
Merged

randomizedcoder merged 2 commits into
mainfrom
sec/fp1-debug-writer-tags

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner

Phase F1, FP-1 of the focused container hardening plan (#291). Stack: FP-1 → FP-2 → FP-3; FP-4 is separate.

  • The netlink capture writer is behind -tags capture and the file: destination behind -tags dest_file; the default build has neither.
  • Asking for one on a build without it (-writeFiles > 0, -dest file:) exits 64 with a rebuild hint; ConfigService.Set refuses write_files > 0 the same way.
  • With capture compiled in and armed: a startup warning naming the path and xtcp2_debug_capture_enabled 1. The version string says +capture whenever the tag is compiled in.
  • dest_file is in the full flavor only; capture is in no shipped flavor or image, only .#xtcp2-capture.
  • New checks.flavor-tags: no slim flavor carries a debug tag; the full flavor has dest_file; xtcp2-capture has capture. New capture and file legs in the Go test flavor matrix.
  • Exit code 64 for usage errors (cmd/xtcp2/exit.go), reused by FP-2 and FP-3.

Tests: table-driven exit_test.go (capture_not_compiled, file_not_compiled, writefiles_zero_default, ...), Set guard rows, tagged capture tests.

🤖 Generated with Claude Code

randomizedcoder and others added 2 commits November 11, 2026 17:53
The netlink capture writer (-writeFiles / -capturePath) writes raw
inet_diag replies, every socket's addresses, to disk; the file:
destination writes records wherever configuration points it. Both were
compiled into every binary, including the production slim flavors.

- capture writer behind //go:build capture, with a no-op stub; no flavor
  or image carries the tag, only the new xtcp2-capture attr
- file: destination behind //go:build dest_file, compiled into the full
  (development) flavor only; stderr split into its own untagged file
- xtcp.CheckBuildSupport: -writeFiles > 0 or -dest file: on a build
  without the tag exits 64 before anything binds, naming the tag;
  ConfigService.Set refuses it with FailedPrecondition
- armed capture logs a warning and sets xtcp2_debug_capture_enabled;
  a capture build reports +capture in its version line
- nix: debugDestinations / optInOnlyTags in versions.nix, extraTags in
  mkGoBinary, test-go-flavor-{file,capture} legs, and a flavor-tags
  check that no slim flavor carries either tag (go version -m)

Focused container hardening FP-1 (A5).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The debug writers moved behind -tags capture and -tags dest_file, so no
lint tier type-checked them. All three tiers now set both tags, matching
the `all` leg of the Go test flavor matrix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@randomizedcoder

Copy link
Copy Markdown
Owner Author
  • Addressed in 251c484: capture/dest_file added to all three lint tiers; misspelling fixed.

@randomizedcoder
randomizedcoder merged commit 251c484 into main Nov 12, 2026
1 check passed
randomizedcoder added a commit that referenced this pull request Nov 12, 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