Skip to content

Commit f48613d

Browse files
committed
deps: @sigstore/verify@2.1.1
1 parent a4c5e74 commit f48613d

File tree

6 files changed

+26
-35
lines changed

6 files changed

+26
-35
lines changed

node_modules/@sigstore/verify/dist/key/certificate.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,18 @@ exports.CertificateChainVerifier = void 0;
44
exports.verifyCertificateChain = verifyCertificateChain;
55
const error_1 = require("../error");
66
const trust_1 = require("../trust");
7-
function verifyCertificateChain(leaf, certificateAuthorities) {
7+
function verifyCertificateChain(timestamp, leaf, certificateAuthorities) {
88
// Filter list of trusted CAs to those which are valid for the given
9-
// leaf certificate.
10-
const cas = (0, trust_1.filterCertAuthorities)(certificateAuthorities, {
11-
start: leaf.notBefore,
12-
end: leaf.notAfter,
13-
});
9+
// timestamp
10+
const cas = (0, trust_1.filterCertAuthorities)(certificateAuthorities, timestamp);
1411
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1512
let error;
1613
for (const ca of cas) {
1714
try {
1815
const verifier = new CertificateChainVerifier({
1916
trustedCerts: ca.certChain,
2017
untrustedCert: leaf,
18+
timestamp,
2119
});
2220
return verifier.verify();
2321
}
@@ -41,12 +39,20 @@ class CertificateChainVerifier {
4139
...opts.trustedCerts,
4240
opts.untrustedCert,
4341
]);
42+
this.timestamp = opts.timestamp;
4443
}
4544
verify() {
4645
// Construct certificate path from leaf to root
4746
const certificatePath = this.sort();
4847
// Perform validation checks on each certificate in the path
4948
this.checkPath(certificatePath);
49+
const validForDate = certificatePath.every((cert) => cert.validForDate(this.timestamp));
50+
if (!validForDate) {
51+
throw new error_1.VerificationError({
52+
code: 'CERTIFICATE_ERROR',
53+
message: 'certificate is not valid or expired at the specified date',
54+
});
55+
}
5056
// Return verified certificate path
5157
return certificatePath;
5258
}

node_modules/@sigstore/verify/dist/key/index.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,10 @@ function verifyPublicKey(hint, timestamps, trustMaterial) {
3737
}
3838
function verifyCertificate(leaf, timestamps, trustMaterial) {
3939
// Check that leaf certificate chains to a trusted CA
40-
const path = (0, certificate_1.verifyCertificateChain)(leaf, trustMaterial.certificateAuthorities);
41-
// Check that ALL certificates are valid for ALL of the timestamps
42-
const validForDate = timestamps.every((timestamp) => path.every((cert) => cert.validForDate(timestamp)));
43-
if (!validForDate) {
44-
throw new error_1.VerificationError({
45-
code: 'CERTIFICATE_ERROR',
46-
message: 'certificate is not valid or expired at the specified date',
47-
});
48-
}
40+
let path = [];
41+
timestamps.forEach((timestamp) => {
42+
path = (0, certificate_1.verifyCertificateChain)(timestamp, leaf, trustMaterial.certificateAuthorities);
43+
});
4944
return {
5045
scts: (0, sct_1.verifySCTs)(path[0], path[1], trustMaterial.ctlogs),
5146
signer: getSigner(path[0]),

node_modules/@sigstore/verify/dist/timestamp/tsa.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ const trust_1 = require("../trust");
88
function verifyRFC3161Timestamp(timestamp, data, timestampAuthorities) {
99
const signingTime = timestamp.signingTime;
1010
// Filter for CAs which were valid at the time of signing
11-
timestampAuthorities = (0, trust_1.filterCertAuthorities)(timestampAuthorities, {
12-
start: signingTime,
13-
end: signingTime,
14-
});
11+
timestampAuthorities = (0, trust_1.filterCertAuthorities)(timestampAuthorities, signingTime);
1512
// Filter for CAs which match serial and issuer embedded in the timestamp
1613
timestampAuthorities = filterCAsBySerialAndIssuer(timestampAuthorities, {
1714
serialNumber: timestamp.signerSerialNumber,
@@ -44,6 +41,7 @@ function verifyTimestampForCA(timestamp, data, ca) {
4441
new certificate_1.CertificateChainVerifier({
4542
untrustedCert: leaf,
4643
trustedCerts: cas,
44+
timestamp: signingTime,
4745
}).verify();
4846
}
4947
catch (e) {
@@ -52,14 +50,6 @@ function verifyTimestampForCA(timestamp, data, ca) {
5250
message: 'invalid certificate chain',
5351
});
5452
}
55-
// Check that all of the CA certs were valid at the time of signing
56-
const validAtSigningTime = ca.certChain.every((cert) => cert.validForDate(signingTime));
57-
if (!validAtSigningTime) {
58-
throw new error_1.VerificationError({
59-
code: 'TIMESTAMP_ERROR',
60-
message: 'timestamp was signed with an expired certificate',
61-
});
62-
}
6353
// Check that the signing certificate's key can be used to verify the
6454
// timestamp signature.
6555
timestamp.verify(data, signingKey);

node_modules/@sigstore/verify/dist/trust/filter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Object.defineProperty(exports, "__esModule", { value: true });
33
exports.filterCertAuthorities = filterCertAuthorities;
44
exports.filterTLogAuthorities = filterTLogAuthorities;
5-
function filterCertAuthorities(certAuthorities, criteria) {
5+
function filterCertAuthorities(certAuthorities, timestamp) {
66
return certAuthorities.filter((ca) => {
7-
return (ca.validFor.start <= criteria.start && ca.validFor.end >= criteria.end);
7+
return ca.validFor.start <= timestamp && ca.validFor.end >= timestamp;
88
});
99
}
1010
// Filter the list of tlog instances to only those which match the given log

node_modules/@sigstore/verify/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sigstore/verify",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "Verification of Sigstore signatures",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -26,7 +26,7 @@
2626
"provenance": true
2727
},
2828
"dependencies": {
29-
"@sigstore/protobuf-specs": "^0.4.0",
29+
"@sigstore/protobuf-specs": "^0.4.1",
3030
"@sigstore/bundle": "^3.1.0",
3131
"@sigstore/core": "^2.0.0"
3232
},

package-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4959,15 +4959,15 @@
49594959
}
49604960
},
49614961
"node_modules/@sigstore/verify": {
4962-
"version": "2.1.0",
4963-
"resolved": "https://registry.npmjs.org/@sigstore/verify/-/verify-2.1.0.tgz",
4964-
"integrity": "sha512-kAAM06ca4CzhvjIZdONAL9+MLppW3K48wOFy1TbuaWFW/OMfl8JuTgW0Bm02JB1WJGT/ET2eqav0KTEKmxqkIA==",
4962+
"version": "2.1.1",
4963+
"resolved": "https://registry.npmjs.org/@sigstore/verify/-/verify-2.1.1.tgz",
4964+
"integrity": "sha512-hVJD77oT67aowHxwT4+M6PGOp+E2LtLdTK3+FC0lBO9T7sYwItDMXZ7Z07IDCvR1M717a4axbIWckrW67KMP/w==",
49654965
"inBundle": true,
49664966
"license": "Apache-2.0",
49674967
"dependencies": {
49684968
"@sigstore/bundle": "^3.1.0",
49694969
"@sigstore/core": "^2.0.0",
4970-
"@sigstore/protobuf-specs": "^0.4.0"
4970+
"@sigstore/protobuf-specs": "^0.4.1"
49714971
},
49724972
"engines": {
49734973
"node": "^18.17.0 || >=20.5.0"

0 commit comments

Comments
 (0)