fix(db): harden freedom outbounds that carry no final rules at all - #6184
Open
n0ctal wants to merge 1 commit into
Open
fix(db): harden freedom outbounds that carry no final rules at all#6184n0ctal wants to merge 1 commit into
n0ctal wants to merge 1 commit into
Conversation
n0ctal
force-pushed
the
upstream-harden-unrestricted-freedom
branch
from
August 8, 2026 02:17
76a3dd9 to
711b389
Compare
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.
Summary
Let the
FreedomFinalRulesPrivateEgressBlockseeder also hardenfreedomoutbounds that carry nofinalRuleskey at all, or an empty one.Why
rewriteFreedomFinalRulesPrivateEgressonly rewrites an outbound when its existingfinalRulesare recognised as one of two shapes: allow-only (isAllowOnlyFinalRules) or the legacy private-only rule (isLegacyPrivateOnlyFinalRules). Anything else is left untouched, on the reasonable principle of not overwriting a deliberate configuration.The gap is what falls outside both shapes at the permissive end. A
freedomoutbound with nofinalRuleskey, or with"finalRules": [], is the least restricted configuration there is — nothing constrains its egress, including into private ranges reachable from the host. That case matched neither recogniser, so the seeder skipped it.The result inverts the intent: the hardening pass fixed outbounds that already had some restriction expressed and walked past the ones that had none.
Scope
isUnrestrictedFreedomFinalRules(v, present)returns true when the key is absent, nil, or an empty array — the shapes that express "no restriction" rather than a deliberate policy.rewriteFreedomFinalRulesPrivateEgressreadsfinalRuleswith the two-value form so it can distinguish "absent" from "present but empty", and treats both as eligible alongside the two existing shapes.finalRulesthat matches neither recogniser is still left alone, unchanged.Validation
go build ./internal/...clean.go test ./internal/database/green onmainatece16559with this applied, including new cases for the absent and empty-array shapes.mainwithout conflict.Risk
Low. The seeder runs once and is recorded in
HistoryOfSeeders, so behaviour for already-seeded installs is unchanged. The widening is strictly toward configurations that expressed no policy; anything with rules the recognisers do not understand keeps being skipped exactly as before.