Fix rule filename not updating when action changes#1572
Merged
gustavo-iniguez-goya merged 1 commit intoevilsocket:masterfrom Apr 12, 2026
Merged
Conversation
When editing a rule and changing its action (e.g. deny → allow), the JSON content updates correctly but the rule name (used as filename) retains the old action prefix, causing a mismatch between the filename and the actual rule action. Update save_rule() to detect auto-generated rule names and replace the action prefix when the action has changed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
|
thanks @marcpinolpique ! tested and it seems to work as expected. |
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
Fixes #1571
When editing a rule and changing its action (e.g. deny → allow), the JSON content updates correctly but the rule name (used as filename) retains the old action prefix, causing a mismatch.
Example: file
deny-always-firefox-esr.jsonwith content{"action": "allow", ...}Changes
In
ui/opensnitch/dialogs/ruleseditor/dialog.py, added a check insave_rule(): when the rule name was auto-generated (starts with an action prefix likeallow-,deny-, orreject-) and the action has changed, the prefix is updated to match the new action.action-prefix)How to test
deny-always-firefox-esr)deny-always-firefox-esr.jsonallow-always-firefox-esr.json