@@ -18,18 +18,21 @@ import {X509Certificate} from 'crypto';
1818import fs from 'fs' ;
1919import path from 'path' ;
2020
21- import { signingEndpoints , SigstoreInstance } from '@actions/attest/lib/endpoints' ;
21+ import { Endpoints } from '@actions/attest/lib/endpoints' ;
2222import * as core from '@actions/core' ;
2323import { signPayload } from '@actions/attest/lib/sign' ;
2424import { bundleToJSON } from '@sigstore/bundle' ;
2525import { Attestation } from '@actions/attest' ;
2626import { Bundle } from '@sigstore/sign' ;
2727
28+ import { GitHub } from '../github' ;
29+
2830import { Subject } from '../types/intoto/intoto' ;
2931
3032export interface SignProvenanceBlobsOpts {
3133 localExportDir : string ;
3234 name ?: string ;
35+ noTransparencyLog ?: boolean ;
3336}
3437
3538export interface SignProvenanceBlobsResult extends Attestation {
@@ -39,6 +42,9 @@ export interface SignProvenanceBlobsResult extends Attestation {
3942
4043export class Sigstore {
4144 private intotoPayloadType = 'application/vnd.in-toto+json' ;
45+ private fulcioURL = 'https://fulcio.sigstore.dev' ;
46+ private rekorURL = 'https://rekor.sigstore.dev' ;
47+ private tsaServerURL = 'https://timestamp.sigstore.dev' ;
4248 private searchSigstoreURL = 'https://search.sigstore.dev' ;
4349
4450 public async signProvenanceBlobs ( opts : SignProvenanceBlobsOpts ) : Promise < Record < string , SignProvenanceBlobsResult > > {
@@ -48,8 +54,7 @@ export class Sigstore {
4854 throw new Error ( 'missing "id-token" permission. Please add "permissions: id-token: write" to your workflow.' ) ;
4955 }
5056
51- const sigstoreInstance : SigstoreInstance = 'public-good' ;
52- const endpoints = signingEndpoints ( sigstoreInstance ) ;
57+ const endpoints = this . signingEndpoints ( opts ) ;
5358 core . info ( `Using Sigstore signing endpoint: ${ endpoints . fulcioURL } ` ) ;
5459
5560 const provenanceBlobs = Sigstore . getProvenanceBlobs ( opts ) ;
@@ -153,4 +158,18 @@ export class Sigstore {
153158 tlogID : tlogID
154159 } ;
155160 }
161+
162+ private signingEndpoints ( opts : SignProvenanceBlobsOpts ) : Endpoints {
163+ if ( opts . noTransparencyLog ?? GitHub . context . payload . repository ?. private ) {
164+ return {
165+ fulcioURL : this . fulcioURL ,
166+ tsaServerURL : this . tsaServerURL
167+ } ;
168+ }
169+ return {
170+ fulcioURL : this . fulcioURL ,
171+ rekorURL : this . rekorURL ,
172+ tsaServerURL : this . tsaServerURL
173+ } ;
174+ }
156175}
0 commit comments