Repository navigation
Conversation
…loader The daemon validated rule names on every UI path but not when loading rule files from disk, at startup or on live reload, so a root-written file named "" could pose as the synthetic default-action rule that the Snitchwatch bridge keys on (name "" + description "snitchwatch:default-action"). loadRule now refuses a name that fails ValidName, logs the file and leaves it on disk. The OpenSnitch patch grows to 50 files (new loader test). Found by Snitchwatch's security review of its #108 bridge mapping.
This was referenced Oct 8, 2026
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #90. Hardening found by Snitchwatch's security review of its #108 bridge mapping. The OpenSnitch patch grows from 49 to 50 files, sha256
b49df450….Problem
The daemon ran
ValidNameon every UI path (Add/Replace/delete/Deserialize), but not inloadRule, which reads rule files from/etc/opensnitchd/rulesat startup and on fsnotify live reload. A root-written file named""would load, and could pose as the #89 synthetic default-action rule that the bridge keys on (name""plus descriptionsnitchwatch:default-action).Change
loadRulerefuses a rule whose name failsValidName, before compile, insert or monitor start. It logs a warning with the file name (%q) and leaves the file on disk.rule/loader_name_validation_test.go:"",a/b, a newline,., a backslash and 201 bytes are refused at Load and on live reload, and valid files still load. Both tests fail with the check removed.Review
Code review: APPROVE. Its LOW follow-ups:
../ U+202E cases on the live path;loadRuleand by its callers.Test plan
just test-snitchwatch-daemon-patch: PASS. The first run hit an upstream flake in the non-race./uipass:TestClient*reloads the firewall config, andiptables.Initdereferences nil when nftables isn't permitted and iptables is missing. The re-run passed; theuipackage is untouched by this change.just check""rule file is refused