Skip to content

Commit 6979ce1

Browse files
committed
deps: @sigstore/sign@4.1.0
1 parent b4a6a41 commit 6979ce1

File tree

25 files changed

+342
-256
lines changed

25 files changed

+342
-256
lines changed

node_modules/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
!/@sigstore/core
3131
!/@sigstore/protobuf-specs
3232
!/@sigstore/sign
33-
!/@sigstore/sign/node_modules/
34-
/@sigstore/sign/node_modules/*
35-
!/@sigstore/sign/node_modules/proc-log
3633
!/@sigstore/tuf
3734
!/@sigstore/verify
3835
!/@tufjs/

node_modules/@sigstore/sign/dist/bundler/base.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ exports.BaseBundleBuilder = void 0;
66
// Subclasses must implement the `package` method to assemble a valid bundle
77
// with the generated signature and verification material.
88
class BaseBundleBuilder {
9+
signer;
10+
witnesses;
911
constructor(options) {
1012
this.signer = options.signer;
1113
this.witnesses = options.witnesses;

node_modules/@sigstore/sign/dist/bundler/dsse.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const base_1 = require("./base");
2121
const bundle_1 = require("./bundle");
2222
// BundleBuilder implementation for DSSE wrapped attestations
2323
class DSSEBundleBuilder extends base_1.BaseBundleBuilder {
24+
certificateChain;
2425
constructor(options) {
2526
super(options);
2627
this.certificateChain = options.certificateChain ?? false;
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.bundleBuilderFromSigningConfig = bundleBuilderFromSigningConfig;
4+
/*
5+
Copyright 2025 The Sigstore Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
*/
19+
const protobuf_specs_1 = require("@sigstore/protobuf-specs");
20+
const dsse_1 = require("./bundler/dsse");
21+
const message_1 = require("./bundler/message");
22+
const signer_1 = require("./signer");
23+
const witness_1 = require("./witness");
24+
const MAX_CA_API_VERSION = 1;
25+
const MAX_TLOG_API_VERSION = 2;
26+
const MAX_TSA_API_VERSION = 1;
27+
const DEFAULT_TIMEOUT = 5000;
28+
const DEFAULT_REKORV2_TIMEOUT = 20000;
29+
const DEFAULT_RETRY = { retries: 2 };
30+
// Creates a BundleBuilder based on the provided SigningConfig
31+
function bundleBuilderFromSigningConfig(options) {
32+
const { signingConfig, identityProvider, bundleType } = options;
33+
const fetchOptions = options.fetchOptions || {
34+
timeout: DEFAULT_TIMEOUT,
35+
retry: DEFAULT_RETRY,
36+
};
37+
const signer = fulcioSignerFromConfig(signingConfig, identityProvider, fetchOptions);
38+
const witnesses = witnessesFromConfig(signingConfig, fetchOptions);
39+
switch (bundleType) {
40+
case 'messageSignature':
41+
return new message_1.MessageSignatureBundleBuilder({ signer, witnesses });
42+
case 'dsseEnvelope':
43+
return new dsse_1.DSSEBundleBuilder({ signer, witnesses });
44+
}
45+
}
46+
function fulcioSignerFromConfig(signingConfig, identityProvider, fetchOptions) {
47+
const service = certAuthorityService(signingConfig);
48+
return new signer_1.FulcioSigner({
49+
fulcioBaseURL: service.url,
50+
identityProvider: identityProvider,
51+
timeout: fetchOptions.timeout,
52+
retry: fetchOptions.retry,
53+
});
54+
}
55+
function witnessesFromConfig(signingConfig, fetchOptions) {
56+
const witnesses = [];
57+
if (signingConfig.rekorTlogConfig) {
58+
if (signingConfig.rekorTlogConfig.selector !== protobuf_specs_1.ServiceSelector.ANY) {
59+
throw new Error('Unsupported Rekor TLog selector in signing configuration');
60+
}
61+
const tlog = tlogService(signingConfig);
62+
witnesses.push(new witness_1.RekorWitness({
63+
rekorBaseURL: tlog.url,
64+
majorApiVersion: tlog.majorApiVersion,
65+
retry: fetchOptions.retry,
66+
timeout:
67+
// Ensure Rekor V2 has at least a 20 second timeout
68+
tlog.majorApiVersion === 1
69+
? fetchOptions.timeout
70+
: Math.min(fetchOptions.timeout ||
71+
/* istanbul ignore next */ DEFAULT_TIMEOUT, DEFAULT_REKORV2_TIMEOUT),
72+
}));
73+
}
74+
if (signingConfig.tsaConfig) {
75+
if (signingConfig.tsaConfig.selector !== protobuf_specs_1.ServiceSelector.ANY) {
76+
throw new Error('Unsupported TSA selector in signing configuration');
77+
}
78+
const tsa = tsaService(signingConfig);
79+
witnesses.push(new witness_1.TSAWitness({
80+
tsaBaseURL: tsa.url,
81+
retry: fetchOptions.retry,
82+
timeout: fetchOptions.timeout,
83+
}));
84+
}
85+
return witnesses;
86+
}
87+
// Returns the first valid CA service from the signing configuration
88+
function certAuthorityService(signingConfig) {
89+
const compatibleCAs = filterServicesByMaxAPIVersion(signingConfig.caUrls, MAX_CA_API_VERSION);
90+
const sortedCAs = sortServicesByStartDate(compatibleCAs);
91+
if (sortedCAs.length === 0) {
92+
throw new Error('No valid CA services found in signing configuration');
93+
}
94+
return sortedCAs[0];
95+
}
96+
// Returns the first valid TLog service from the signing configuration
97+
function tlogService(signingConfig) {
98+
const compatibleTLogs = filterServicesByMaxAPIVersion(signingConfig.rekorTlogUrls, MAX_TLOG_API_VERSION);
99+
const sortedTLogs = sortServicesByStartDate(compatibleTLogs);
100+
if (sortedTLogs.length === 0) {
101+
throw new Error('No valid TLogs found in signing configuration');
102+
}
103+
return sortedTLogs[0];
104+
}
105+
// Returns the first valid TSA service from the signing configuration
106+
function tsaService(signingConfig) {
107+
const compatibleTSAs = filterServicesByMaxAPIVersion(signingConfig.tsaUrls, MAX_TSA_API_VERSION);
108+
const sortedTSAs = sortServicesByStartDate(compatibleTSAs);
109+
if (sortedTSAs.length === 0) {
110+
throw new Error('No valid TSAs found in signing configuration');
111+
}
112+
return sortedTSAs[0];
113+
}
114+
// Returns the services sorted by start date (most recent first), filtering out
115+
// any services that have an end date in the past
116+
function sortServicesByStartDate(services) {
117+
const now = new Date();
118+
// Filter out any services that have an end date in the past
119+
const validServices = services.filter((service) => {
120+
// If there's no end date, the service is still valid
121+
if (!service.validFor?.end) {
122+
return true;
123+
}
124+
// Keep services whose end date is in the future or present
125+
return service.validFor.end >= now;
126+
});
127+
return validServices.sort((a, b) => {
128+
/* istanbul ignore next */
129+
const aStart = a.validFor?.start?.getTime() ?? 0;
130+
/* istanbul ignore next */
131+
const bStart = b.validFor?.start?.getTime() ?? 0;
132+
// Sort descending (most recent first)
133+
return bStart - aStart;
134+
});
135+
}
136+
// Returns a filtered list of services whose major API version is less than or
137+
// equal to the specified version
138+
function filterServicesByMaxAPIVersion(services, apiVersion) {
139+
// Filter out any services with a major API version greater than the specified version
140+
return services.filter((service) => {
141+
return service.majorApiVersion <= apiVersion;
142+
});
143+
}

node_modules/@sigstore/sign/dist/error.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ exports.InternalError = void 0;
1919
exports.internalError = internalError;
2020
const error_1 = require("./external/error");
2121
class InternalError extends Error {
22+
code;
23+
cause;
2224
constructor({ code, message, cause, }) {
2325
super(message);
2426
this.name = this.constructor.name;

node_modules/@sigstore/sign/dist/external/error.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
Object.defineProperty(exports, "__esModule", { value: true });
1818
exports.HTTPError = void 0;
1919
class HTTPError extends Error {
20+
statusCode;
21+
location;
2022
constructor({ status, message, location, }) {
2123
super(`(${status}) ${message}`);
2224
this.statusCode = status;

node_modules/@sigstore/sign/dist/external/fulcio.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const fetch_1 = require("./fetch");
2121
* Fulcio API client.
2222
*/
2323
class Fulcio {
24+
options;
2425
constructor(options) {
2526
this.options = options;
2627
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.RekorV2 = void 0;
4+
/*
5+
Copyright 2025 The Sigstore Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
*/
19+
const fetch_1 = require("./fetch");
20+
const protobuf_specs_1 = require("@sigstore/protobuf-specs");
21+
const v2_1 = require("@sigstore/protobuf-specs/rekor/v2");
22+
/**
23+
* Rekor API client.
24+
*/
25+
class RekorV2 {
26+
options;
27+
constructor(options) {
28+
this.options = options;
29+
}
30+
async createEntry(proposedEntry) {
31+
const { baseURL, timeout, retry } = this.options;
32+
const url = `${baseURL}/api/v2/log/entries`;
33+
const response = await (0, fetch_1.fetchWithRetry)(url, {
34+
headers: {
35+
'Content-Type': 'application/json',
36+
Accept: 'application/json',
37+
},
38+
body: JSON.stringify(v2_1.CreateEntryRequest.toJSON(proposedEntry)),
39+
timeout,
40+
retry,
41+
});
42+
return response.json().then((data) => protobuf_specs_1.TransparencyLogEntry.fromJSON(data));
43+
}
44+
}
45+
exports.RekorV2 = RekorV2;

node_modules/@sigstore/sign/dist/external/rekor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const fetch_1 = require("./fetch");
2121
* Rekor API client.
2222
*/
2323
class Rekor {
24+
options;
2425
constructor(options) {
2526
this.options = options;
2627
}

node_modules/@sigstore/sign/dist/external/tsa.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ limitations under the License.
1818
*/
1919
const fetch_1 = require("./fetch");
2020
class TimestampAuthority {
21+
options;
2122
constructor(options) {
2223
this.options = options;
2324
}
2425
async createTimestamp(request) {
2526
const { baseURL, timeout, retry } = this.options;
26-
const url = `${baseURL}/api/v1/timestamp`;
27+
// Account for the fact that the TSA URL may already include the full
28+
// path if the client was initalized from a `SigningConfig` service entry
29+
// (which always uses the full URL).
30+
const url = new URL(baseURL).pathname === '/'
31+
? `${baseURL}/api/v1/timestamp`
32+
: baseURL;
2733
const response = await (0, fetch_1.fetchWithRetry)(url, {
2834
headers: {
2935
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)