mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-10 18:56:53 +00:00
feat: stack glob patterns and route severity levels (#1651)
* feat: add stack glob patterns and route severity levels Operators can filter notification routes and mute rules with anchored * globs, and routes can target info, warning, or error. Matching is fail-closed for unsafe stored patterns; write paths keep partial-PUT semantics and ReDoS caps. * test: split mute and routing chip tests to avoid dialog race * fix: move stack pattern client validator out of PatternChips * fix: bound stack glob matching and atomic pattern chip saves
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
* cross-multiply with the fleet ack list on every render.
|
||||
*/
|
||||
import type { MisconfigAcknowledgement } from '../services/DatabaseService';
|
||||
import { stackPatternMatches } from '../helpers/stackPattern';
|
||||
|
||||
export interface MisconfigAcknowledgementDecision {
|
||||
acknowledged: boolean;
|
||||
@@ -31,8 +32,7 @@ function matchesStackPattern(pattern: string | null, stackContext: string | null
|
||||
if (!pattern) return true;
|
||||
// Stack-scoped acks against an image scan (no stack_context) cannot match.
|
||||
if (stackContext === null) return false;
|
||||
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*');
|
||||
return new RegExp(`^${escaped}$`).test(stackContext);
|
||||
return stackPatternMatches(stackContext, pattern);
|
||||
}
|
||||
|
||||
function isActive(ack: MisconfigAcknowledgement, now: number): boolean {
|
||||
|
||||
Reference in New Issue
Block a user