Skip to content

Commit e9b8755

Browse files
authored
chore(policies): remove fallback to file:// when ChainloopLoader fails (#1383)
Signed-off-by: Jose I. Paris <[email protected]>
1 parent d14e4b9 commit e9b8755

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

pkg/policies/policies.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,7 @@ func (pv *PolicyVerifier) loadPolicySpec(ctx context.Context, attachment *v1.Pol
200200

201201
spec, ref, err := loader.Load(ctx, attachment)
202202
if err != nil {
203-
// fallback from ChainloopLoader to FileLoader if no scheme is used, to maintain backwards compatibility
204-
_, ok := loader.(*ChainloopLoader)
205-
scheme, id := refParts(attachment.GetRef())
206-
if ok && scheme == "" {
207-
// prepend file:// to the ref
208-
pv.logger.Debug().Msgf("falling back to FileLoader for %s", attachment.GetRef())
209-
attachment.Policy = &v1.PolicyAttachment_Ref{Ref: fmt.Sprintf("%s://%s", fileScheme, id)}
210-
spec, ref, err = new(FileLoader).Load(ctx, attachment)
211-
}
212-
}
213-
if err != nil {
214-
return nil, nil, err
203+
return nil, nil, fmt.Errorf("failed to load policy spec: %w", err)
215204
}
216205

217206
// Validate just in case

0 commit comments

Comments
 (0)