diff --git a/.changeset/soft-kids-watch.md b/.changeset/soft-kids-watch.md new file mode 100644 index 0000000..3f34ccd --- /dev/null +++ b/.changeset/soft-kids-watch.md @@ -0,0 +1,5 @@ +--- +'grafana-zabbix': patch +--- + +Fix: Remove regex pattern length restriction diff --git a/pkg/zabbix/utils.go b/pkg/zabbix/utils.go index 6afa87e..e97657b 100644 --- a/pkg/zabbix/utils.go +++ b/pkg/zabbix/utils.go @@ -155,11 +155,6 @@ func parseFilter(filter string) (*regexp2.Regexp, error) { return nil, backend.DownstreamErrorf("error parsing regexp: potentially dangerous regex pattern detected") } - // Security: Limit regex pattern length - if len(regexPattern) > 1000 { - return nil, backend.DownstreamErrorf("error parsing regexp: pattern too long (max 1000 characters)") - } - pattern := "" if matches[2] != "" { if flagRE.MatchString(matches[2]) { diff --git a/pkg/zabbix/utils_test.go b/pkg/zabbix/utils_test.go index 02e6f37..697a39f 100644 --- a/pkg/zabbix/utils_test.go +++ b/pkg/zabbix/utils_test.go @@ -2,7 +2,6 @@ package zabbix import ( "reflect" - "strings" "testing" "github.com/dlclark/regexp2" @@ -124,13 +123,6 @@ func TestParseFilter(t *testing.T) { expectNoError: false, expectedError: "error parsing regexp: potentially dangerous regex pattern detected", }, - { - name: "Pattern too long", - filter: "/" + strings.Repeat("a", 1001) + "/", - want: nil, - expectNoError: false, - expectedError: "error parsing regexp: pattern too long (max 1000 characters)", - }, { name: "Safe complex regex", filter: "/^[a-zA-Z0-9_-]+\\.[a-zA-Z]{2,}$/",