Skip to content

Commit 6eb1707

Browse files
Mattia Eleuterimattia-eleuteri
authored andcommitted
fix(monitoring-agents): add regex escaping and input validation for tenant log routing
- Escape namespace value with regexQuoteMeta in rewrite_tag rule to prevent regex metacharacters (e.g. dots) from matching unintended strings - Add validation that namespace is not empty before using it in tenantLogRouting configuration Signed-off-by: Mattia Eleuteri <[email protected]> Signed-off-by: mattia-eleuteri <[email protected]>
1 parent 9b044a3 commit 6eb1707

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎packages/system/monitoring-agents/values.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ fluent-bit:
380380
header AccountID 0
381381
header ProjectID 0
382382
{{- range .Values.tenantLogRouting }}
383+
{{- if not .namespace }}{{ fail "tenantLogRouting: namespace is required" }}{{- end }}
383384
[OUTPUT]
384385
Name http
385386
Match tenant.{{ .namespace }}.*
@@ -445,7 +446,7 @@ fluent-bit:
445446
[FILTER]
446447
Name rewrite_tag
447448
Match kube.*
448-
Rule $kubernetes_namespace_name ^({{ .namespace }})$ tenant.{{ .namespace }}.$TAG false
449+
Rule $kubernetes_namespace_name ^({{ .namespace | regexQuoteMeta }})$ tenant.{{ .namespace }}.$TAG false
449450
{{- end }}
450451
scrapeRules:
451452
etcd:

0 commit comments

Comments
 (0)