Skip to content

Commit ba40ba4

Browse files
committed
sigstore: always set TSA server endpoint to provide trusted timestamping
Signed-off-by: CrazyMax <[email protected]>
1 parent 6f2a25d commit ba40ba4

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/sigstore/sigstore.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,21 @@ import {X509Certificate} from 'crypto';
1818
import fs from 'fs';
1919
import path from 'path';
2020

21-
import {signingEndpoints, SigstoreInstance} from '@actions/attest/lib/endpoints';
21+
import {Endpoints} from '@actions/attest/lib/endpoints';
2222
import * as core from '@actions/core';
2323
import {signPayload} from '@actions/attest/lib/sign';
2424
import {bundleToJSON} from '@sigstore/bundle';
2525
import {Attestation} from '@actions/attest';
2626
import {Bundle} from '@sigstore/sign';
2727

28+
import {GitHub} from '../github';
29+
2830
import {Subject} from '../types/intoto/intoto';
2931

3032
export interface SignProvenanceBlobsOpts {
3133
localExportDir: string;
3234
name?: string;
35+
noTransparencyLog?: boolean;
3336
}
3437

3538
export interface SignProvenanceBlobsResult extends Attestation {
@@ -39,6 +42,9 @@ export interface SignProvenanceBlobsResult extends Attestation {
3942

4043
export 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

Comments
 (0)