From 5f197eb27cf2ea529c5d13cab6edb86876ce7890 Mon Sep 17 00:00:00 2001 From: David Wertenteil Date: Thu, 6 Jul 2023 09:25:34 +0300 Subject: [PATCH] submit file scanning Signed-off-by: David Wertenteil --- core/cautils/scaninfo.go | 21 +++++++++++++++------ core/core/initutils.go | 6 ------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/cautils/scaninfo.go b/core/cautils/scaninfo.go index dea94daa..def1ef1d 100644 --- a/core/cautils/scaninfo.go +++ b/core/cautils/scaninfo.go @@ -337,14 +337,23 @@ func setContextMetadata(ctx context.Context, contextMetadata *reporthandlingv2.C } contextMetadata.RepoContextMetadata = context case ContextDir: - contextMetadata.DirectoryContextMetadata = &reporthandlingv2.DirectoryContextMetadata{ - BasePath: getAbsPath(input), - HostName: getHostname(), + contextMetadata.RepoContextMetadata = &reporthandlingv2.RepoContextMetadata{ + Provider: "none", + Repo: fmt.Sprintf("path@%s", getAbsPath(input)), + Owner: getHostname(), + Branch: "none", + DefaultBranch: "none", + LocalRootPath: getAbsPath(input), } + case ContextFile: - contextMetadata.FileContextMetadata = &reporthandlingv2.FileContextMetadata{ - FilePath: getAbsPath(input), - HostName: getHostname(), + contextMetadata.RepoContextMetadata = &reporthandlingv2.RepoContextMetadata{ + Provider: "none", + Repo: fmt.Sprintf("file@%s", getAbsPath(input)), + Owner: getHostname(), + Branch: "none", + DefaultBranch: "none", + LocalRootPath: getAbsPath(input), } case ContextGitLocal: // local diff --git a/core/core/initutils.go b/core/core/initutils.go index 545e4c4e..52bf16a7 100644 --- a/core/core/initutils.go +++ b/core/core/initutils.go @@ -183,12 +183,6 @@ func setSubmitBehavior(scanInfo *cautils.ScanInfo, tenantConfig cautils.ITenantC return } - scanningContext := scanInfo.GetScanningContext() - if scanningContext == cautils.ContextFile || scanningContext == cautils.ContextDir { - scanInfo.Submit = false - return - } - if scanInfo.Local { scanInfo.Submit = false return