From 8c27430a2f660f1c817f99d83e3aeca750a0c1cd Mon Sep 17 00:00:00 2001 From: Nikita Pivkin Date: Mon, 6 May 2024 21:18:41 +0600 Subject: [PATCH] fix(misconf): skip Rego errors with a nil location (#6638) --- pkg/iac/rego/load.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/iac/rego/load.go b/pkg/iac/rego/load.go index 4c37edb80f33..284fd2f653a2 100644 --- a/pkg/iac/rego/load.go +++ b/pkg/iac/rego/load.go @@ -149,6 +149,10 @@ func (s *Scanner) fallbackChecks(compiler *ast.Compiler) { var excludedFiles []string for _, e := range compiler.Errors { + if e.Location == nil { + continue + } + loc := e.Location.File if lo.Contains(excludedFiles, loc) {