diff --git a/pkg/iac-providers/docker/v1/load-dir.go b/pkg/iac-providers/docker/v1/load-dir.go index 606875162..17bb3503a 100644 --- a/pkg/iac-providers/docker/v1/load-dir.go +++ b/pkg/iac-providers/docker/v1/load-dir.go @@ -55,17 +55,23 @@ func (dc *DockerV1) LoadIacDir(absRootDir string, nonRecursive bool) (output.All continue } minSeverity, maxSeverity := utils.GetMinMaxSeverity(comments) + sourcePath := file + sourcePath, err = filepath.Rel(absRootDir, file) + if err != nil { + zap.S().Debug("error while getting the relative path for", zap.String("IAC file", file), zap.Error(err)) + } config := output.ResourceConfig{ Name: *files[i], Type: resourceTypeDockerfile, Line: 1, ID: dockerDirectory + "." + GetresourceIdforDockerfile(file), - Source: file, + Source: sourcePath, Config: data, SkipRules: utils.GetSkipRules(comments), MinSeverity: minSeverity, MaxSeverity: maxSeverity, } + allResourcesConfig[dockerDirectory] = append(allResourcesConfig[dockerDirectory], config) } } diff --git a/pkg/iac-providers/docker/v1/load-file.go b/pkg/iac-providers/docker/v1/load-file.go index ca0a97237..25a67d443 100644 --- a/pkg/iac-providers/docker/v1/load-file.go +++ b/pkg/iac-providers/docker/v1/load-file.go @@ -41,7 +41,7 @@ func (dc *DockerV1) LoadIacFile(absFilePath string) (allResourcesConfig output.A Type: resourceTypeDockerfile, Line: 1, ID: dockerDirectory + "." + GetresourceIdforDockerfile(absFilePath), - Source: absFilePath, + Source: filepath.Base(absFilePath), Config: data, SkipRules: utils.GetSkipRules(comments), MinSeverity: minSeverity,