Skip to content

Fix rule filename not updating when action changes#1572

Merged
gustavo-iniguez-goya merged 1 commit intoevilsocket:masterfrom
marcpinolpique:fix/rule-name-action-mismatch
Apr 12, 2026
Merged

Fix rule filename not updating when action changes#1572
gustavo-iniguez-goya merged 1 commit intoevilsocket:masterfrom
marcpinolpique:fix/rule-name-action-mismatch

Conversation

@marcpinolpique
Copy link
Copy Markdown
Contributor

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.json with content {"action": "allow", ...}

Changes

In ui/opensnitch/dialogs/ruleseditor/dialog.py, added a check in save_rule(): when the rule name was auto-generated (starts with an action prefix like allow-, deny-, or reject-) and the action has changed, the prefix is updated to match the new action.

  • Only affects auto-generated names (detected by action- prefix)
  • Manually named rules are never modified
  • Minimal change: 8 lines added

How to test

  1. Create a rule with auto-generated name (e.g. deny-always-firefox-esr)
  2. Edit the rule, change action from Deny to Allow
  3. Save
  4. Before fix: filename stays deny-always-firefox-esr.json
  5. After fix: filename updates to allow-always-firefox-esr.json

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>
@gustavo-iniguez-goya gustavo-iniguez-goya merged commit 0328a25 into evilsocket:master Apr 12, 2026
@gustavo-iniguez-goya
Copy link
Copy Markdown
Collaborator

thanks @marcpinolpique ! tested and it seems to work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] Rule filename keeps old action prefix when action is changed

2 participants