Skip to content

Commit d9f7d35

Browse files
committed
validate on store
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
1 parent b240862 commit d9f7d35

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

app/controlplane/internal/service/attestation.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,12 @@ func (s *AttestationService) storeAttestation(ctx context.Context, envelope []by
289289

290290
// If we have an external CAS backend, we will push there the attestation
291291
if !casBackend.Inline {
292+
if casBackend.ValidationStatus != biz.CASBackendValidationOK {
293+
// Try to re-validate the backend; if it still fails, return an error
294+
if err = s.casUC.PerformValidation(ctx, casBackend.ID.String()); err != nil {
295+
return nil, cpAPI.ErrorCasBackendErrorReasonInvalid("your CAS backend can't be reached")
296+
}
297+
}
292298
go func() {
293299
b := backoff.NewExponentialBackOff()
294300
b.MaxElapsedTime = 1 * time.Minute

0 commit comments

Comments
 (0)