diff --git a/pkg/types/alpine/v0.0.1/entry.go b/pkg/types/alpine/v0.0.1/entry.go index 43ec183f007b1fbb932c4db6fe7a2d7f67f47c09..c27a3ae49f0ca76de42579a8aaec7059a94776c8 100644 --- a/pkg/types/alpine/v0.0.1/entry.go +++ b/pkg/types/alpine/v0.0.1/entry.go @@ -52,10 +52,9 @@ func init() { } type V001Entry struct { - AlpineModel models.AlpineV001Schema - fetchedExternalEntities bool - keyObj pki.PublicKey - apkObj *alpine.Package + AlpineModel models.AlpineV001Schema + keyObj pki.PublicKey + apkObj *alpine.Package } func (v V001Entry) APIVersion() string { @@ -113,10 +112,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error { } func (v V001Entry) hasExternalEntities() bool { - if v.fetchedExternalEntities { - return false - } - if v.AlpineModel.Package != nil && v.AlpineModel.Package.URL.String() != "" { return true } @@ -127,10 +122,6 @@ func (v V001Entry) hasExternalEntities() bool { } func (v *V001Entry) fetchExternalEntities(ctx context.Context) error { - if v.fetchedExternalEntities { - return nil - } - if err := v.validate(); err != nil { return types.ValidationError(err) } @@ -268,7 +259,6 @@ func (v *V001Entry) fetchExternalEntities(ctx context.Context) error { v.AlpineModel.Package.Hash.Value = swag.String(computedSHA) } - v.fetchedExternalEntities = true return nil } diff --git a/pkg/types/helm/v0.0.1/entry.go b/pkg/types/helm/v0.0.1/entry.go index 74de7f0a409d81f30b0b5a0800c34cf6a23dd352..627ecd62ff8dd9d49782671d9c2ba63ef3a69d20 100644 --- a/pkg/types/helm/v0.0.1/entry.go +++ b/pkg/types/helm/v0.0.1/entry.go @@ -52,11 +52,10 @@ func init() { } type V001Entry struct { - HelmObj models.HelmV001Schema - fetchedExternalEntities bool - keyObj pki.PublicKey - sigObj pki.Signature - provenanceObj *helm.Provenance + HelmObj models.HelmV001Schema + keyObj pki.PublicKey + sigObj pki.Signature + provenanceObj *helm.Provenance } func (v V001Entry) APIVersion() string { @@ -120,10 +119,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error { } func (v V001Entry) hasExternalEntities() bool { - if v.fetchedExternalEntities { - return false - } - if v.HelmObj.PublicKey != nil && v.HelmObj.PublicKey.URL.String() != "" { return true } @@ -135,10 +130,6 @@ func (v V001Entry) hasExternalEntities() bool { } func (v *V001Entry) fetchExternalEntities(ctx context.Context) error { - if v.fetchedExternalEntities { - return nil - } - if err := v.validate(); err != nil { return types.ValidationError(err) } @@ -246,7 +237,6 @@ func (v *V001Entry) fetchExternalEntities(ctx context.Context) error { return err } - v.fetchedExternalEntities = true return nil } diff --git a/pkg/types/jar/v0.0.1/entry.go b/pkg/types/jar/v0.0.1/entry.go index c7932f121d80bfbaae48ef3b9372b2117f832a81..e033d07a8ec5de45ac225a7368e74b38c700a649 100644 --- a/pkg/types/jar/v0.0.1/entry.go +++ b/pkg/types/jar/v0.0.1/entry.go @@ -56,11 +56,10 @@ func init() { } type V001Entry struct { - JARModel models.JarV001Schema - fetchedExternalEntities bool - jarObj *jarutils.JarSignature - keyObj pki.PublicKey - sigObj pki.Signature + JARModel models.JarV001Schema + jarObj *jarutils.JarSignature + keyObj pki.PublicKey + sigObj pki.Signature } func (v V001Entry) APIVersion() string { @@ -116,10 +115,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error { } func (v V001Entry) hasExternalEntities() bool { - if v.fetchedExternalEntities { - return false - } - if v.JARModel.Archive != nil && v.JARModel.Archive.URL.String() != "" { return true } @@ -127,10 +122,6 @@ func (v V001Entry) hasExternalEntities() bool { } func (v *V001Entry) fetchExternalEntities(ctx context.Context) error { - if v.fetchedExternalEntities { - return nil - } - if err := v.validate(); err != nil { return types.ValidationError(err) } @@ -206,7 +197,6 @@ func (v *V001Entry) fetchExternalEntities(ctx context.Context) error { v.JARModel.Archive.Hash.Value = swag.String(computedSHA) } - v.fetchedExternalEntities = true return nil } diff --git a/pkg/types/rekord/v0.0.1/entry.go b/pkg/types/rekord/v0.0.1/entry.go index 5377987b4e2ef28a723ddc255d7cfdc00494f643..24f89970928f0ff7199c8df0f0f9c8083e425a7d 100644 --- a/pkg/types/rekord/v0.0.1/entry.go +++ b/pkg/types/rekord/v0.0.1/entry.go @@ -51,10 +51,9 @@ func init() { } type V001Entry struct { - RekordObj models.RekordV001Schema - fetchedExternalEntities bool - keyObj pki.PublicKey - sigObj pki.Signature + RekordObj models.RekordV001Schema + keyObj pki.PublicKey + sigObj pki.Signature } func (v V001Entry) APIVersion() string { @@ -68,13 +67,6 @@ func NewEntry() types.EntryImpl { func (v V001Entry) IndexKeys() []string { var result []string - if v.HasExternalEntities() { - if err := v.FetchExternalEntities(context.Background()); err != nil { - log.Logger.Error(err) - return result - } - } - key, err := v.keyObj.CanonicalValue() if err != nil { log.Logger.Error(err) @@ -113,10 +105,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error { } func (v V001Entry) HasExternalEntities() bool { - if v.fetchedExternalEntities { - return false - } - if v.RekordObj.Data != nil && v.RekordObj.Data.URL.String() != "" { return true } @@ -130,10 +118,6 @@ func (v V001Entry) HasExternalEntities() bool { } func (v *V001Entry) FetchExternalEntities(ctx context.Context) error { - if v.fetchedExternalEntities { - return nil - } - if err := v.validate(); err != nil { return types.ValidationError(err) } @@ -291,7 +275,6 @@ func (v *V001Entry) FetchExternalEntities(ctx context.Context) error { v.RekordObj.Data.Hash.Value = swag.String(computedSHA) } - v.fetchedExternalEntities = true return nil } diff --git a/pkg/types/rpm/v0.0.1/entry.go b/pkg/types/rpm/v0.0.1/entry.go index 449cfa3fd8363e17400355902a5c75f53022ce7f..5e915f1ab3357365c035d9df1625fabab40cb329 100644 --- a/pkg/types/rpm/v0.0.1/entry.go +++ b/pkg/types/rpm/v0.0.1/entry.go @@ -54,10 +54,9 @@ func init() { } type V001Entry struct { - RPMModel models.RpmV001Schema - fetchedExternalEntities bool - keyObj pki.PublicKey - rpmObj *rpmutils.PackageFile + RPMModel models.RpmV001Schema + keyObj pki.PublicKey + rpmObj *rpmutils.PackageFile } func (v V001Entry) APIVersion() string { @@ -115,9 +114,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error { } func (v V001Entry) HasExternalEntities() bool { - if v.fetchedExternalEntities { - return false - } if v.RPMModel.Package != nil && v.RPMModel.Package.URL.String() != "" { return true @@ -129,9 +125,6 @@ func (v V001Entry) HasExternalEntities() bool { } func (v *V001Entry) FetchExternalEntities(ctx context.Context) error { - if v.fetchedExternalEntities { - return nil - } if err := v.validate(); err != nil { return types.ValidationError(err) @@ -273,7 +266,6 @@ func (v *V001Entry) FetchExternalEntities(ctx context.Context) error { v.RPMModel.Package.Hash.Value = swag.String(computedSHA) } - v.fetchedExternalEntities = true return nil } diff --git a/pkg/types/tuf/v0.0.1/entry.go b/pkg/types/tuf/v0.0.1/entry.go index 012f41b14f9ff87b5cae37665ca5a403ae78ff10..2af629161f52098c15790aa8fa341675aa8f0e29 100644 --- a/pkg/types/tuf/v0.0.1/entry.go +++ b/pkg/types/tuf/v0.0.1/entry.go @@ -63,10 +63,9 @@ type BaseSigned struct { } type V001Entry struct { - TufObj models.TUFV001Schema - fetchedExternalEntities bool - keyObj pki.PublicKey - sigObj pki.Signature + TufObj models.TUFV001Schema + keyObj pki.PublicKey + sigObj pki.Signature } func (v V001Entry) APIVersion() string { @@ -138,9 +137,6 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error { } func (v V001Entry) hasExternalEntities() bool { - if v.fetchedExternalEntities { - return false - } if v.TufObj.Metadata != nil && v.TufObj.Metadata.URL.String() != "" { return true @@ -278,7 +274,6 @@ func (v *V001Entry) fetchExternalEntities(ctx context.Context) error { return err } - v.fetchedExternalEntities = true return nil }