File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {Build} from '../../src/buildx/build';
2323import { Install as CosignInstall } from '../../src/cosign/install' ;
2424import { Docker } from '../../src/docker/docker' ;
2525import { Exec } from '../../src/exec' ;
26+ import { OCI } from '../../src/oci/oci' ;
2627import { Sigstore } from '../../src/sigstore/sigstore' ;
2728
2829const fixturesDir = path . join ( __dirname , '..' , '.fixtures' ) ;
@@ -114,6 +115,20 @@ maybe('verifyImageAttestations', () => {
114115 } ,
115116 60000
116117 ) ;
118+
119+ it ( 'default platform' , async ( ) => {
120+ const sigstore = new Sigstore ( ) ;
121+ const verifyResults = await sigstore . verifyImageAttestations ( 'moby/buildkit:master@sha256:84014da3581b2ff2c14cb4f60029cf9caa272b79e58f2e89c651ea6966d7a505' , {
122+ certificateIdentityRegexp : `^https://github.com/docker/github-builder-experimental/.github/workflows/bake.yml.*$` ,
123+ platform : OCI . defaultPlatform ( )
124+ } ) ;
125+ expect ( Object . keys ( verifyResults ) . length ) . toEqual ( 1 ) ;
126+ for ( const [ attestationRef , res ] of Object . entries ( verifyResults ) ) {
127+ expect ( attestationRef ) . toBeDefined ( ) ;
128+ expect ( res . cosignArgs ) . toBeDefined ( ) ;
129+ expect ( res . signatureManifestDigest ) . toBeDefined ( ) ;
130+ }
131+ } ) ;
117132} ) ;
118133
119134maybeIdToken ( 'signProvenanceBlobs' , ( ) => {
Original file line number Diff line number Diff line change @@ -133,8 +133,8 @@ export class Sigstore {
133133 for ( const [ attestationRef , signedRes ] of Object . entries ( signedManifestsResult ) ) {
134134 await core . group ( `Verifying signature of ${ attestationRef } ` , async ( ) => {
135135 const verifyResult = await this . verifyImageAttestation ( attestationRef , {
136- noTransparencyLog : opts . noTransparencyLog || ! signedRes . tlogID ,
137136 certificateIdentityRegexp : opts . certificateIdentityRegexp ,
137+ noTransparencyLog : opts . noTransparencyLog || ! signedRes . tlogID ,
138138 retryOnManifestUnknown : opts . retryOnManifestUnknown
139139 } ) ;
140140 core . info ( `Signature manifest verified: https://oci.dag.dev/?image=${ signedRes . imageName } @${ verifyResult . signatureManifestDigest } ` ) ;
@@ -147,7 +147,7 @@ export class Sigstore {
147147 public async verifyImageAttestations ( image : string , opts : VerifySignedManifestsOpts ) : Promise < Record < string , VerifySignedManifestsResult > > {
148148 const result : Record < string , VerifySignedManifestsResult > = { } ;
149149
150- const attestationDigests = await this . imageTools . attestationDigests ( image ) ;
150+ const attestationDigests = await this . imageTools . attestationDigests ( image , opts . platform ) ;
151151 if ( attestationDigests . length === 0 ) {
152152 throw new Error ( `No attestation manifests found for ${ image } ` ) ;
153153 }
Original file line number Diff line number Diff line change 1717import type { SerializedBundle } from '@sigstore/bundle' ;
1818
1919import { Subject } from '../intoto/intoto' ;
20+ import { Platform } from '../oci/descriptor' ;
2021
2122export const FULCIO_URL = 'https://fulcio.sigstore.dev' ;
2223export const REKOR_URL = 'https://rekor.sigstore.dev' ;
@@ -47,6 +48,7 @@ export interface SignAttestationManifestsResult extends ParsedBundle {
4748
4849export interface VerifySignedManifestsOpts {
4950 certificateIdentityRegexp : string ;
51+ platform ?: Platform ;
5052 noTransparencyLog ?: boolean ;
5153 retryOnManifestUnknown ?: boolean ;
5254}
You can’t perform that action at this time.
0 commit comments