#4776 @swamp/cfgmgmt firewall: no syntax check of a rule before it is applied
Opened by randybias · 11/15/2026· Shipped 11/15/2026
Versions: @swamp/cfgmgmt 2026.11.01.1, swamp 20261113.232530.0, target Ubuntu 24.04 (backend iptables, since ufw was inactive).
What happens: the firewall model applies each rule straight to the backend. It has no step that asks the
backend whether the rule is valid before changing the live rules (for nftables, nft -c; for iptables, a check of the
rule or a dry run of the restore). Our adoption test looked for a pre-check method and the model has none, so a rule
the backend rejects is found only when it is applied, in the middle of the change. We did not run a malformed rule
live; this issue is about the missing step, which the model's methods and README show.
What we expected: apply first checks the rule with the backend's own syntax check (or the closest the backend
offers, such as a dry run), and refuses before touching the live rules when the check fails. If the backend has no such
check, the report says so.
Shortest reproduction:
- Define a
firewallresource with a value the backend's grammar rejects (for example a malformed source). - Run
apply. - Look at what ran: the rule is sent to the live backend with no earlier check; any failure comes from the live change.
Why it matters: on a remote host, the difference between "refused before anything changed" and "failed half way" is the difference between a clean error and a locked-out operator. Together with the missing revert, a check before the change is the cheapest protection.
Other package: @adam/cfgmgmt has the same model, so the same gap; we did not run it.
Upstream repository: https://github.com/swamp-club/swamp-extensions
Environment
- Extension:
@swamp/cfgmgmt@2026.11.01.1 - swamp:
20261114.210101.0-sha.537e03d1 - OS:
linux(x86_64) - Deno:
2.9.8 - Shell:
/bin/bash
Shipped
Click a lifecycle step above to view its details.
system commented 11/15/2026, 3:29:09 PM
Classified automatically when this issue was filed.
- Source: Extensions
If you feel this classification is incorrect, add a ripple to tell us so.
stack72 commented 11/15/2026, 10:09:33 PM
Thanks @randybias for reporting this! We shipped: One cfgmgmt change for three issues. firewall apply validates addresses and runs each backend's own check (ufw --dry-run, iptables-restore --test or iptables -C, firewall-cmd --check-config before reload) before the live change, and reports which check ran (4776). It refuses to remove the inbound allow rule that admits the run's own SSH session unless allowRemovingOwnAccess is set, and the shared SSH master gains keepalives so a cut connection fails in about a minute instead of hanging (4774). systemd apply and restart check the unit actually ended up running and enabled after systemctl reports success, so a unit that fails right after start, or a static unit enable cannot enable, fails the step (4773).. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.
Sign in to post a ripple.