v12 - refactor(plugins/rule-flood-guard): reuse existing endpoints instead of a dedicated internal one#2359
Merged
yllada merged 4 commits intoJul 20, 2026
Conversation
… authoritative changed flag
…ion and notification-loss bugs, auto-create config
🛑 AI review — Sensitive area, extra care recommendedThis PR touches critical paths or introduces changes the model cannot judge with sufficient confidence. Review carefully before merging.
|
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.
What
Removes the dedicated internal-key-gated endpoint (
/internal/correlation-rule/deactivate) thatplugins/rule-flood-guardwas calling, and switches the plugin to reuse the two endpoints that already existed and already power the manual UI flow:GET /correlation-rule/search-by-filters?ruleName=<name>— resolve a rule by namePUT /correlation-rule/activate-deactivate?relPath=<relPath>&active=false— disable itAlso fixes two bugs found during review of this change, and adds a small usability improvement.
Why
The dedicated internal endpoint was unnecessary:
X-Internal-Keyalready bypasses permission checks on the existing endpoints (authz.HasPermissionhasif a.Internal { return true }), so the plugin could reach them directly all along. Reusing the existing endpoint also means the guard's automated disables now go through the same code path as a manual disable — including its audit log entry, which the dedicated endpoint never had.Changes
refactor(backend/eventprocessing)fix(backend/eventprocessing)activate-deactivatenow returns{"changed": bool}(was204with no body) — an authoritative, server-derived signal instead of the caller guessing from a stale read. This matters with 2 event-processor instances (worker + manager) both running the guard: only the instance whose call actually flipped the rule seeschanged:true, closing a duplicate-notification racefix(plugins/rule-flood-guard)system_plugins_rule-flood-guard.yamlwith default values on first run if it doesn't exist yet (never overwrites an existing one)