Skip to content

network.tor_egress_firewall=false never disables the #270 firewall (jq // false-coercion) #294

Description

@VijitSingh97

Bug

The documented #270 opt-out (network.tor_egress_firewall=false, per the comment in pithead and docs/privacy.md) has never worked — the firewall is always installed regardless of the config value.

Root cause

parse_and_validate_config() read the toggle as:

jq -r '.network.tor_egress_firewall // true'

jq's // (alternative) operator treats false as empty, not just null. So false // true evaluates to true:

$ echo '{"network":{"tor_egress_firewall":false}}' | jq -r '.network.tor_egress_firewall // true'
true

The rendered .env therefore always got TOR_EGRESS_FIREWALL=true, and apply_tor_egress_firewall always installed the rules.

The same latent bug existed on .xvb.tor // true (line ~1883): xvb.tor=false (route XvB donation over clearnet) was silently coerced back to Tor.

Impact

Fix

Null-check explicitly so a configured false is honoured (absent still defaults on / fail-closed):

jq -r 'if .network.tor_egress_firewall == null then true else .network.tor_egress_firewall end'

Fixed in commit d4b5df3 on feat/256-benchmark-harness (reaches develop via the #256 benchmark PR). Filing for tracking + so it's not lost if that PR is slow to merge. Surfaced while validating the #256 benchmark's clearnet arm (firewall stayed up → p2pool got 0 sidechain peers).

Follow-up

  • Add a regression test asserting tor_egress_firewall=falseTOR_EGRESS_FIREWALL=false in the rendered .env (and =true when absent/true).
  • Audit for any other <falsifiable-bool> // true jq reads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsecuritySecurity-sensitive issue or hardeningsetuppithead, config.json, first-run setupwave-2-privacyv1.1 Wave 2 — privacy defaults (the long pole; benchmark-gated)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions