So I couldn't sleep. This patch should solve the problem by bypassing the checks that cause it. Because of the way the rulesets get rebuilt anyway I can't see this causing any problems down the road, but you never know.
I looked at writing a test but couldn't quite figure out how to do it. I did install the modified version into a prefix and test the following possible bug-trigger.
$ PYTHONPATH=$PYTHONPATH:/tmp/ufw/lib/python /tmp/ufw/usr/sbin/ufw insert 1 allow from any to any
and it functioned correctly. The backend changes seem the least invasive way to solve the problem, but I'm not entirely happy with the frontend changes; they may benefit from a more experienced tweak.
So I couldn't sleep. This patch should solve the problem by bypassing the checks that cause it. Because of the way the rulesets get rebuilt anyway I can't see this causing any problems down the road, but you never know.
I looked at writing a test but couldn't quite figure out how to do it. I did install the modified version into a prefix and test the following possible bug-trigger.
$ PYTHONPATH= $PYTHONPATH: /tmp/ufw/ lib/python /tmp/ufw/ usr/sbin/ ufw insert 1 allow from any to any
and it functioned correctly. The backend changes seem the least invasive way to solve the problem, but I'm not entirely happy with the frontend changes; they may benefit from a more experienced tweak.