Skip to content

Commit f281ccb

Browse files
committed
don't use policy enforcer if file is not uploaded
1 parent d93b508 commit f281ccb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

policy/enforcer/policyenforcer.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ func (p *PolicyEnforcerViolationGenerator) WithOptions(options ...policy.PolicyH
8484
}
8585

8686
func (p *PolicyEnforcerViolationGenerator) GenerateViolations(cmdResults *results.SecurityCommandResults) (convertedViolations violationutils.Violations, err error) {
87+
if p.rtRepository == "" || p.artifactPath == "" {
88+
log.Debug("Repository or artifact path not provided, skipping violation generation from Xray")
89+
return
90+
}
8791
xrayManager, err := xray.CreateXrayServiceManager(p.serverDetails, xray.WithScopedProjectKey(p.projectKey))
8892
if err != nil {
8993
return

0 commit comments

Comments
 (0)