Skip to content

Commit dea702d

Browse files
author
Michael Smith
committed
deps: @sigstore/[email protected]
1 parent 4eab03f commit dea702d

6 files changed

Lines changed: 64 additions & 16 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,17 @@ function getSigner(cert) {
5656
else {
5757
issuer = cert.extension(OID_FULCIO_ISSUER_V1)?.value.toString('ascii');
5858
}
59+
const oids = cert.extensions.map((ext) => {
60+
const oid = ext.subs[0].toOID();
61+
return {
62+
oid: { id: oid.split('.').map(Number) },
63+
value: ext.subs[ext.subs.length - 1].value,
64+
};
65+
});
5966
const identity = {
6067
extensions: { issuer },
6168
subjectAlternativeName: cert.subjectAltName,
69+
oids,
6270
};
6371
return {
6472
key: core_1.crypto.createPublicKey(cert.publicKey),

‎node_modules/@sigstore/verify/dist/policy.js‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
Object.defineProperty(exports, "__esModule", { value: true });
33
exports.verifySubjectAlternativeName = verifySubjectAlternativeName;
44
exports.verifyExtensions = verifyExtensions;
5+
exports.verifyOIDs = verifyOIDs;
56
const error_1 = require("./error");
7+
// Verifies that the signer's SAN matches the policy identity. The
8+
// policyIdentity is treated as a JavaScript regular expression pattern and
9+
// tested against the full signerIdentity string. For exact matching, use
10+
// anchored patterns (e.g. '^user@example\\.com$').
611
function verifySubjectAlternativeName(policyIdentity, signerIdentity) {
712
if (signerIdentity === undefined || !signerIdentity.match(policyIdentity)) {
813
throw new error_1.PolicyError({
@@ -22,3 +27,24 @@ function verifyExtensions(policyExtensions, signerExtensions = {}) {
2227
}
2328
}
2429
}
30+
function verifyOIDs(policyOIDs, signerOIDs = []) {
31+
for (const policyOID of policyOIDs) {
32+
const match = signerOIDs.find((signerOID) => oidEquals(policyOID.oid?.id, signerOID.oid?.id) &&
33+
policyOID.value.equals(signerOID.value));
34+
if (!match) {
35+
/* istanbul ignore next */
36+
const oid = policyOID.oid?.id.join('.') ?? '<unknown>';
37+
throw new error_1.PolicyError({
38+
code: 'UNTRUSTED_SIGNER_ERROR',
39+
message: `invalid certificate extension - missing OID ${oid}`,
40+
});
41+
}
42+
}
43+
}
44+
function oidEquals(a, b) {
45+
/* istanbul ignore if */
46+
if (a === undefined || b === undefined) {
47+
return false;
48+
}
49+
return a.length === b.length && a.every((v, i) => v === b[i]);
50+
}

‎node_modules/@sigstore/verify/dist/timestamp/index.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ function getTSATimestamp(timestamp, data, timestampAuthorities) {
1212
};
1313
}
1414
function getTLogTimestamp(entry) {
15+
// Only entries with an inclusion promise provide a verifiable timestamp
16+
if (!entry.inclusionPromise) {
17+
return undefined;
18+
}
1519
return {
1620
type: 'transparency-log',
1721
logID: entry.logId.keyId,

‎node_modules/@sigstore/verify/dist/verifier.js‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,33 @@ class Verifier {
4646
}
4747
// Checks that all of the timestamps in the entity are valid and returns them
4848
verifyTimestamps(entity) {
49-
let timestampCount = 0;
50-
const timestamps = entity.timestamps.map((timestamp) => {
49+
const timestamps = [];
50+
for (const timestamp of entity.timestamps) {
5151
switch (timestamp.$case) {
5252
case 'timestamp-authority':
53-
timestampCount++;
54-
return (0, timestamp_1.getTSATimestamp)(timestamp.timestamp, entity.signature.signature, this.trustMaterial.timestampAuthorities);
55-
case 'transparency-log':
56-
timestampCount++;
57-
return (0, timestamp_1.getTLogTimestamp)(timestamp.tlogEntry);
53+
timestamps.push((0, timestamp_1.getTSATimestamp)(timestamp.timestamp, entity.signature.signature, this.trustMaterial.timestampAuthorities));
54+
break;
55+
case 'transparency-log': {
56+
const result = (0, timestamp_1.getTLogTimestamp)(timestamp.tlogEntry);
57+
/* istanbul ignore else */
58+
if (result) {
59+
timestamps.push(result);
60+
}
61+
break;
62+
}
5863
}
59-
});
64+
}
6065
// Check for duplicate timestamps
6166
if (containsDupes(timestamps)) {
6267
throw new error_1.VerificationError({
6368
code: 'TIMESTAMP_ERROR',
6469
message: 'duplicate timestamp',
6570
});
6671
}
67-
if (timestampCount < this.options.timestampThreshold) {
72+
if (timestamps.length < this.options.timestampThreshold) {
6873
throw new error_1.VerificationError({
6974
code: 'TIMESTAMP_ERROR',
70-
message: `expected ${this.options.timestampThreshold} timestamps, got ${timestampCount}`,
75+
message: `expected ${this.options.timestampThreshold} timestamps, got ${timestamps.length}`,
7176
});
7277
}
7378
return timestamps.map((t) => t.timestamp);
@@ -133,6 +138,11 @@ class Verifier {
133138
if (policy.extensions) {
134139
(0, policy_1.verifyExtensions)(policy.extensions, identity.extensions);
135140
}
141+
// Check that the OIDs of the signer match the policy
142+
/* istanbul ignore if */
143+
if (policy.oids) {
144+
(0, policy_1.verifyOIDs)(policy.oids, identity.oids);
145+
}
136146
}
137147
}
138148
exports.Verifier = Verifier;

‎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": "3.1.0",
3+
"version": "3.1.1",
44
"description": "Verification of Sigstore signatures",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -28,7 +28,7 @@
2828
"dependencies": {
2929
"@sigstore/protobuf-specs": "^0.5.0",
3030
"@sigstore/bundle": "^4.0.0",
31-
"@sigstore/core": "^3.1.0"
31+
"@sigstore/core": "^3.2.1"
3232
},
3333
"engines": {
3434
"node": "^20.17.0 || >=22.9.0"

‎package-lock.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,14 +2197,14 @@
21972197
}
21982198
},
21992199
"node_modules/@sigstore/verify": {
2200-
"version": "3.1.0",
2201-
"resolved": "https://registry.npmjs.org/@sigstore/verify/-/verify-3.1.0.tgz",
2202-
"integrity": "sha512-mNe0Iigql08YupSOGv197YdHpPPr+EzDZmfCgMc7RPNaZTw5aLN01nBl6CHJOh3BGtnMIj83EeN4butBchc8Ag==",
2200+
"version": "3.1.1",
2201+
"resolved": "https://registry.npmjs.org/@sigstore/verify/-/verify-3.1.1.tgz",
2202+
"integrity": "sha512-qv7+G3J2cc6wwFj3yKvXOamzqhMwSk1ogPGmhpS8iXllcPrJaIIBA+4HbttlHVu1pqWTdmaCH/WE7UOC51kdoA==",
22032203
"inBundle": true,
22042204
"license": "Apache-2.0",
22052205
"dependencies": {
22062206
"@sigstore/bundle": "^4.0.0",
2207-
"@sigstore/core": "^3.1.0",
2207+
"@sigstore/core": "^3.2.1",
22082208
"@sigstore/protobuf-specs": "^0.5.0"
22092209
},
22102210
"engines": {

0 commit comments

Comments
 (0)