formacao
This commit is contained in:
+6
-2
@@ -229,7 +229,7 @@ class RegistryFetcher extends Fetcher {
|
||||
if (this.opts.verifyAttestations) {
|
||||
// Always fetch attestations from the current registry host
|
||||
const attestationsPath = new URL(dist.attestations.url).pathname
|
||||
const attestationsUrl = removeTrailingSlashes(this.registry) + attestationsPath
|
||||
const attestationsUrl = new URL(attestationsPath, this.registry).href
|
||||
const res = await fetch(attestationsUrl, {
|
||||
...this.opts,
|
||||
// disable integrity check for attestations json payload, we check the
|
||||
@@ -256,7 +256,10 @@ class RegistryFetcher extends Fetcher {
|
||||
const attestationKeyIds = bundles.map((b) => b.keyid).filter((k) => !!k)
|
||||
const attestationRegistryKeys = (this.registryKeys || [])
|
||||
.filter(key => attestationKeyIds.includes(key.keyid))
|
||||
if (!attestationRegistryKeys.length) {
|
||||
// Only require registry keys when there are keyed attestations.
|
||||
// Keyless (Sigstore/Fulcio) attestations embed their signing
|
||||
// certificate in the bundle and don't need registry keys.
|
||||
if (attestationKeyIds.length > 0 && !attestationRegistryKeys.length) {
|
||||
throw Object.assign(new Error(
|
||||
`${mani._id} has attestations but no corresponding public key(s) can be found`
|
||||
), { code: 'EMISSINGSIGNATUREKEY' })
|
||||
@@ -339,6 +342,7 @@ class RegistryFetcher extends Fetcher {
|
||||
}
|
||||
}
|
||||
mani._attestations = dist.attestations
|
||||
mani._attestationBundles = attestations
|
||||
} else {
|
||||
mani._attestations = dist.attestations
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user