Skip to content

Commit 812aa6d

Browse files
committed
deps: sigstore@2.1.0
1 parent 7fab9d3 commit 812aa6d

File tree

21 files changed

+124
-77
lines changed

21 files changed

+124
-77
lines changed

node_modules/@sigstore/bundle/dist/build.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const bundle_1 = require("./bundle");
2121
// Message signature bundle - $case: 'messageSignature'
2222
function toMessageSignatureBundle(options) {
2323
return {
24-
mediaType: bundle_1.BUNDLE_V01_MEDIA_TYPE,
24+
mediaType: bundle_1.BUNDLE_V02_MEDIA_TYPE,
2525
content: {
2626
$case: 'messageSignature',
2727
messageSignature: {
@@ -39,7 +39,7 @@ exports.toMessageSignatureBundle = toMessageSignatureBundle;
3939
// DSSE envelope bundle - $case: 'dsseEnvelope'
4040
function toDSSEBundle(options) {
4141
return {
42-
mediaType: bundle_1.BUNDLE_V01_MEDIA_TYPE,
42+
mediaType: bundle_1.BUNDLE_V02_MEDIA_TYPE,
4343
content: {
4444
$case: 'dsseEnvelope',
4545
dsseEnvelope: toEnvelope(options),

node_modules/@sigstore/bundle/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sigstore/bundle",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"description": "Sigstore bundle type",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

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

+28-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
"use strict";
2+
/*
3+
Copyright 2023 The Sigstore Authors.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
217
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.InternalError = void 0;
18+
exports.internalError = exports.InternalError = void 0;
19+
const error_1 = require("./external/error");
420
class InternalError extends Error {
521
constructor({ code, message, cause, }) {
622
super(message);
@@ -10,3 +26,14 @@ class InternalError extends Error {
1026
}
1127
}
1228
exports.InternalError = InternalError;
29+
function internalError(err, code, message) {
30+
if (err instanceof error_1.HTTPError) {
31+
message += ` - ${err.message}`;
32+
}
33+
throw new InternalError({
34+
code: code,
35+
message: message,
36+
cause: err,
37+
});
38+
}
39+
exports.internalError = internalError;

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

+24-7
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,37 @@
22
Object.defineProperty(exports, "__esModule", { value: true });
33
exports.checkStatus = exports.HTTPError = void 0;
44
class HTTPError extends Error {
5-
constructor(response) {
6-
super(`HTTP Error: ${response.status} ${response.statusText}`);
7-
this.response = response;
8-
this.statusCode = response.status;
9-
this.location = response.headers?.get('Location') || undefined;
5+
constructor({ status, message, location, }) {
6+
super(`(${status}) ${message}`);
7+
this.statusCode = status;
8+
this.location = location;
109
}
1110
}
1211
exports.HTTPError = HTTPError;
13-
const checkStatus = (response) => {
12+
const checkStatus = async (response) => {
1413
if (response.ok) {
1514
return response;
1615
}
1716
else {
18-
throw new HTTPError(response);
17+
let message = response.statusText;
18+
const location = response.headers?.get('Location') || undefined;
19+
const contentType = response.headers?.get('Content-Type');
20+
// If response type is JSON, try to parse the body for a message
21+
if (contentType?.includes('application/json')) {
22+
try {
23+
await response.json().then((body) => {
24+
message = body.message;
25+
});
26+
}
27+
catch (e) {
28+
// ignore
29+
}
30+
}
31+
throw new HTTPError({
32+
status: response.status,
33+
message: message,
34+
location: location,
35+
});
1936
}
2037
};
2138
exports.checkStatus = checkStatus;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Fulcio {
4343
method: 'POST',
4444
body: JSON.stringify(request),
4545
});
46-
(0, error_1.checkStatus)(response);
46+
await (0, error_1.checkStatus)(response);
4747
const data = await response.json();
4848
return data;
4949
}

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Rekor {
4949
headers: { 'Content-Type': 'application/json' },
5050
body: JSON.stringify(propsedEntry),
5151
});
52-
(0, error_1.checkStatus)(response);
52+
await (0, error_1.checkStatus)(response);
5353
const data = await response.json();
5454
return entryFromResponse(data);
5555
}
@@ -61,7 +61,7 @@ class Rekor {
6161
async getEntry(uuid) {
6262
const url = `${this.baseUrl}/api/v1/log/entries/${uuid}`;
6363
const response = await this.fetch(url);
64-
(0, error_1.checkStatus)(response);
64+
await (0, error_1.checkStatus)(response);
6565
const data = await response.json();
6666
return entryFromResponse(data);
6767
}
@@ -77,7 +77,7 @@ class Rekor {
7777
body: JSON.stringify(opts),
7878
headers: { 'Content-Type': 'application/json' },
7979
});
80-
(0, error_1.checkStatus)(response);
80+
await (0, error_1.checkStatus)(response);
8181
const data = await response.json();
8282
return data;
8383
}
@@ -93,7 +93,7 @@ class Rekor {
9393
body: JSON.stringify(opts),
9494
headers: { 'Content-Type': 'application/json' },
9595
});
96-
(0, error_1.checkStatus)(response);
96+
await (0, error_1.checkStatus)(response);
9797
const rawData = await response.json();
9898
const data = rawData.map((d) => entryFromResponse(d));
9999
return data;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class TimestampAuthority {
4040
method: 'POST',
4141
body: JSON.stringify(request),
4242
});
43-
(0, error_1.checkStatus)(response);
43+
await (0, error_1.checkStatus)(response);
4444
return response.buffer();
4545
}
4646
}
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.TSAWitness = exports.RekorWitness = exports.FulcioSigner = exports.CIContextProvider = exports.InternalError = exports.MessageSignatureBundleBuilder = exports.DSSEBundleBuilder = void 0;
3+
exports.TSAWitness = exports.RekorWitness = exports.DEFAULT_REKOR_URL = exports.FulcioSigner = exports.DEFAULT_FULCIO_URL = exports.CIContextProvider = exports.InternalError = exports.MessageSignatureBundleBuilder = exports.DSSEBundleBuilder = void 0;
44
var bundler_1 = require("./bundler");
55
Object.defineProperty(exports, "DSSEBundleBuilder", { enumerable: true, get: function () { return bundler_1.DSSEBundleBuilder; } });
66
Object.defineProperty(exports, "MessageSignatureBundleBuilder", { enumerable: true, get: function () { return bundler_1.MessageSignatureBundleBuilder; } });
@@ -9,7 +9,9 @@ Object.defineProperty(exports, "InternalError", { enumerable: true, get: functio
99
var identity_1 = require("./identity");
1010
Object.defineProperty(exports, "CIContextProvider", { enumerable: true, get: function () { return identity_1.CIContextProvider; } });
1111
var signer_1 = require("./signer");
12+
Object.defineProperty(exports, "DEFAULT_FULCIO_URL", { enumerable: true, get: function () { return signer_1.DEFAULT_FULCIO_URL; } });
1213
Object.defineProperty(exports, "FulcioSigner", { enumerable: true, get: function () { return signer_1.FulcioSigner; } });
1314
var witness_1 = require("./witness");
15+
Object.defineProperty(exports, "DEFAULT_REKOR_URL", { enumerable: true, get: function () { return witness_1.DEFAULT_REKOR_URL; } });
1416
Object.defineProperty(exports, "RekorWitness", { enumerable: true, get: function () { return witness_1.RekorWitness; } });
1517
Object.defineProperty(exports, "TSAWitness", { enumerable: true, get: function () { return witness_1.TSAWitness; } });

node_modules/@sigstore/sign/dist/signer/fulcio/ca.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ class CAClient {
3939
return cert.chain.certificates;
4040
}
4141
catch (err) {
42-
throw new error_1.InternalError({
43-
code: 'CA_CREATE_SIGNING_CERTIFICATE_ERROR',
44-
message: 'error creating signing certificate',
45-
cause: err,
46-
});
42+
(0, error_1.internalError)(err, 'CA_CREATE_SIGNING_CERTIFICATE_ERROR', 'error creating signing certificate');
4743
}
4844
}
4945
}

node_modules/@sigstore/sign/dist/signer/fulcio/index.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.FulcioSigner = void 0;
3+
exports.FulcioSigner = exports.DEFAULT_FULCIO_URL = void 0;
44
/*
55
Copyright 2023 The Sigstore Authors.
66
@@ -20,21 +20,35 @@ const error_1 = require("../../error");
2020
const util_1 = require("../../util");
2121
const ca_1 = require("./ca");
2222
const ephemeral_1 = require("./ephemeral");
23+
exports.DEFAULT_FULCIO_URL = 'https://fulcio.sigstore.dev';
2324
// Signer implementation which can be used to decorate another signer
2425
// with a Fulcio-issued signing certificate for the signer's public key.
2526
// Must be instantiated with an identity provider which can provide a JWT
2627
// which represents the identity to be bound to the signing certificate.
2728
class FulcioSigner {
2829
constructor(options) {
29-
this.ca = new ca_1.CAClient(options);
30+
this.ca = new ca_1.CAClient({
31+
...options,
32+
fulcioBaseURL: options.fulcioBaseURL || /* istanbul ignore next */ exports.DEFAULT_FULCIO_URL,
33+
});
3034
this.identityProvider = options.identityProvider;
3135
this.keyHolder = options.keyHolder || new ephemeral_1.EphemeralSigner();
3236
}
3337
async sign(data) {
3438
// Retrieve identity token from the supplied identity provider
3539
const identityToken = await this.getIdentityToken();
3640
// Extract challenge claim from OIDC token
37-
const subject = util_1.oidc.extractJWTSubject(identityToken);
41+
let subject;
42+
try {
43+
subject = util_1.oidc.extractJWTSubject(identityToken);
44+
}
45+
catch (err) {
46+
throw new error_1.InternalError({
47+
code: 'IDENTITY_TOKEN_PARSE_ERROR',
48+
message: `invalid identity token: ${identityToken}`,
49+
cause: err,
50+
});
51+
}
3852
// Construct challenge value by signing the subject claim
3953
const challenge = await this.keyHolder.sign(Buffer.from(subject));
4054
if (challenge.key.$case !== 'publicKey') {

node_modules/@sigstore/sign/dist/signer/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.FulcioSigner = void 0;
3+
exports.FulcioSigner = exports.DEFAULT_FULCIO_URL = void 0;
44
/*
55
Copyright 2023 The Sigstore Authors.
66
@@ -17,4 +17,5 @@ See the License for the specific language governing permissions and
1717
limitations under the License.
1818
*/
1919
var fulcio_1 = require("./fulcio");
20+
Object.defineProperty(exports, "DEFAULT_FULCIO_URL", { enumerable: true, get: function () { return fulcio_1.DEFAULT_FULCIO_URL; } });
2021
Object.defineProperty(exports, "FulcioSigner", { enumerable: true, get: function () { return fulcio_1.FulcioSigner; } });

node_modules/@sigstore/sign/dist/witness/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.TSAWitness = exports.RekorWitness = void 0;
3+
exports.TSAWitness = exports.RekorWitness = exports.DEFAULT_REKOR_URL = void 0;
44
/*
55
Copyright 2023 The Sigstore Authors.
66
@@ -17,6 +17,7 @@ See the License for the specific language governing permissions and
1717
limitations under the License.
1818
*/
1919
var tlog_1 = require("./tlog");
20+
Object.defineProperty(exports, "DEFAULT_REKOR_URL", { enumerable: true, get: function () { return tlog_1.DEFAULT_REKOR_URL; } });
2021
Object.defineProperty(exports, "RekorWitness", { enumerable: true, get: function () { return tlog_1.RekorWitness; } });
2122
var tsa_1 = require("./tsa");
2223
Object.defineProperty(exports, "TSAWitness", { enumerable: true, get: function () { return tsa_1.TSAWitness; } });

node_modules/@sigstore/sign/dist/witness/tlog/client.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,11 @@ class TLogClient {
4343
entry = await this.rekor.getEntry(uuid);
4444
}
4545
catch (err) {
46-
throw new error_1.InternalError({
47-
code: 'TLOG_FETCH_ENTRY_ERROR',
48-
message: 'error fetching tlog entry',
49-
cause: err,
50-
});
46+
(0, error_1.internalError)(err, 'TLOG_FETCH_ENTRY_ERROR', 'error fetching tlog entry');
5147
}
5248
}
5349
else {
54-
throw new error_1.InternalError({
55-
code: 'TLOG_CREATE_ENTRY_ERROR',
56-
message: 'error creating tlog entry',
57-
cause: err,
58-
});
50+
(0, error_1.internalError)(err, 'TLOG_CREATE_ENTRY_ERROR', 'error creating tlog entry');
5951
}
6052
}
6153
return entry;

node_modules/@sigstore/sign/dist/witness/tlog/index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.RekorWitness = void 0;
3+
exports.RekorWitness = exports.DEFAULT_REKOR_URL = void 0;
44
/*
55
Copyright 2023 The Sigstore Authors.
66
@@ -19,9 +19,13 @@ limitations under the License.
1919
const util_1 = require("../../util");
2020
const client_1 = require("./client");
2121
const entry_1 = require("./entry");
22+
exports.DEFAULT_REKOR_URL = 'https://rekor.sigstore.dev';
2223
class RekorWitness {
2324
constructor(options) {
24-
this.tlog = new client_1.TLogClient(options);
25+
this.tlog = new client_1.TLogClient({
26+
...options,
27+
rekorBaseURL: options.rekorBaseURL || /* istanbul ignore next */ exports.DEFAULT_REKOR_URL,
28+
});
2529
}
2630
async testify(content, publicKey) {
2731
const proposedEntry = (0, entry_1.toProposedEntry)(content, publicKey);

node_modules/@sigstore/sign/dist/witness/tsa/client.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ class TSAClient {
3636
return await this.tsa.createTimestamp(request);
3737
}
3838
catch (err) {
39-
throw new error_1.InternalError({
40-
code: 'TSA_CREATE_TIMESTAMP_ERROR',
41-
message: 'error creating timestamp',
42-
cause: err,
43-
});
39+
(0, error_1.internalError)(err, 'TSA_CREATE_TIMESTAMP_ERROR', 'error creating timestamp');
4440
}
4541
}
4642
}

node_modules/@sigstore/sign/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sigstore/sign",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"description": "Sigstore signing library",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -27,12 +27,12 @@
2727
},
2828
"devDependencies": {
2929
"@sigstore/jest": "^0.0.0",
30-
"@sigstore/mock": "^0.3.0",
30+
"@sigstore/mock": "^0.4.0",
3131
"@sigstore/rekor-types": "^2.0.0",
3232
"@types/make-fetch-happen": "^10.0.0"
3333
},
3434
"dependencies": {
35-
"@sigstore/bundle": "^2.0.0",
35+
"@sigstore/bundle": "^2.1.0",
3636
"@sigstore/protobuf-specs": "^0.2.1",
3737
"make-fetch-happen": "^13.0.0"
3838
},

node_modules/sigstore/dist/config.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
2323
return result;
2424
};
2525
Object.defineProperty(exports, "__esModule", { value: true });
26-
exports.artifactVerificationOptions = exports.createBundleBuilder = exports.DEFAULT_TIMEOUT = exports.DEFAULT_RETRY = exports.DEFAULT_REKOR_URL = exports.DEFAULT_FULCIO_URL = void 0;
26+
exports.artifactVerificationOptions = exports.createBundleBuilder = exports.DEFAULT_TIMEOUT = exports.DEFAULT_RETRY = void 0;
2727
/*
2828
Copyright 2023 The Sigstore Authors.
2929
@@ -41,8 +41,6 @@ limitations under the License.
4141
*/
4242
const sign_1 = require("@sigstore/sign");
4343
const sigstore = __importStar(require("./types/sigstore"));
44-
exports.DEFAULT_FULCIO_URL = 'https://fulcio.sigstore.dev';
45-
exports.DEFAULT_REKOR_URL = 'https://rekor.sigstore.dev';
4644
exports.DEFAULT_RETRY = { retries: 2 };
4745
exports.DEFAULT_TIMEOUT = 5000;
4846
function createBundleBuilder(bundleType, options) {
@@ -61,7 +59,7 @@ exports.createBundleBuilder = createBundleBuilder;
6159
// Instantiate the FulcioSigner based on the supplied options.
6260
function initSigner(options) {
6361
return new sign_1.FulcioSigner({
64-
fulcioBaseURL: options.fulcioURL || exports.DEFAULT_FULCIO_URL,
62+
fulcioBaseURL: options.fulcioURL,
6563
identityProvider: options.identityProvider || initIdentityProvider(options),
6664
retry: options.retry ?? exports.DEFAULT_RETRY,
6765
timeout: options.timeout ?? exports.DEFAULT_TIMEOUT,
@@ -84,7 +82,7 @@ function initWitnesses(options) {
8482
const witnesses = [];
8583
if (isRekorEnabled(options)) {
8684
witnesses.push(new sign_1.RekorWitness({
87-
rekorBaseURL: options.rekorURL || exports.DEFAULT_REKOR_URL,
85+
rekorBaseURL: options.rekorURL,
8886
fetchOnConflict: false,
8987
retry: options.retry ?? exports.DEFAULT_RETRY,
9088
timeout: options.timeout ?? exports.DEFAULT_TIMEOUT,

0 commit comments

Comments
 (0)