fix(filter): use unique rule ids to prevent silent overwrite #267

Merged
KofTwentyTwo merged 1 commits from story/m6-rule-id-unique into dev 2026-07-31 16:32:10 +00:00
1 Commits
Author SHA1 Message Date
James Maes 45d8f69d33 fix(filter): use unique rule ids to prevent silent overwrite
CreateRule derived a rule's id deterministically from
sha256(name + nsql), so two rules with identical name and NSQL text
produced the same id. save_filter_rule persists via INSERT OR REPLACE
with no existence check, so the second create silently overwrote the
first rule with no warning.

Generate each rule's id from a CSPRNG (the same OsRng nuncio-store
already uses to source key material) instead of deriving it from the
rule's content, so identical name+NSQL always yields distinct ids.
UpdateRule and list_filter_rules already reassign the id from the
persisted row after parsing, so they are unaffected.

Refs #249
2026-07-31 11:29:46 -05:00