Skip to content

Commit 53aa8f2

Browse files
committed
deps: pacote@17.0.5
1 parent 2e5331c commit 53aa8f2

File tree

4 files changed

+37
-19
lines changed

4 files changed

+37
-19
lines changed

node_modules/pacote/lib/registry.js

+28-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const sigstore = require('sigstore')
1414
const corgiDoc = 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*'
1515
const fullDoc = 'application/json'
1616

17+
// Some really old packages have no time field in their packument so we need a
18+
// cutoff date.
19+
const MISSING_TIME_CUTOFF = '2015-01-01T00:00:00.000Z'
20+
1721
const fetch = require('npm-registry-fetch')
1822

1923
const _headers = Symbol('_headers')
@@ -115,6 +119,13 @@ class RegistryFetcher extends Fetcher {
115119
return this.package
116120
}
117121

122+
// When verifying signatures, we need to fetch the full/uncompressed
123+
// packument to get publish time as this is not included in the
124+
// corgi/compressed packument.
125+
if (this.opts.verifySignatures) {
126+
this.fullMetadata = true
127+
}
128+
118129
const packument = await this.packument()
119130
let mani = await pickManifest(packument, this.spec.fetchSpec, {
120131
...this.opts,
@@ -124,6 +135,12 @@ class RegistryFetcher extends Fetcher {
124135
mani = rpj.normalize(mani)
125136
/* XXX add ETARGET and E403 revalidation of cached packuments here */
126137

138+
// add _time from packument if fetched with fullMetadata
139+
const time = packument.time?.[mani.version]
140+
if (time) {
141+
mani._time = time
142+
}
143+
127144
// add _resolved and _integrity from dist object
128145
const { dist } = mani
129146
if (dist) {
@@ -171,8 +188,10 @@ class RegistryFetcher extends Fetcher {
171188
'but no corresponding public key can be found'
172189
), { code: 'EMISSINGSIGNATUREKEY' })
173190
}
174-
const validPublicKey =
175-
!publicKey.expires || (Date.parse(publicKey.expires) > Date.now())
191+
192+
const publishedTime = Date.parse(mani._time || MISSING_TIME_CUTOFF)
193+
const validPublicKey = !publicKey.expires ||
194+
publishedTime < Date.parse(publicKey.expires)
176195
if (!validPublicKey) {
177196
throw Object.assign(new Error(
178197
`${mani._id} has a registry signature with keyid: ${signature.keyid} ` +
@@ -254,8 +273,13 @@ class RegistryFetcher extends Fetcher {
254273
), { code: 'EMISSINGSIGNATUREKEY' })
255274
}
256275

257-
const validPublicKey =
258-
!publicKey.expires || (Date.parse(publicKey.expires) > Date.now())
276+
const integratedTime = new Date(
277+
Number(
278+
bundle.verificationMaterial.tlogEntries[0].integratedTime
279+
) * 1000
280+
)
281+
const validPublicKey = !publicKey.expires ||
282+
(integratedTime < Date.parse(publicKey.expires))
259283
if (!validPublicKey) {
260284
throw Object.assign(new Error(
261285
`${mani._id} has attestations with keyid: ${keyid} ` +

node_modules/pacote/package.json

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pacote",
3-
"version": "17.0.4",
3+
"version": "17.0.5",
44
"description": "JavaScript package downloader",
55
"author": "GitHub Inc.",
66
"bin": {
@@ -25,9 +25,9 @@
2525
]
2626
},
2727
"devDependencies": {
28-
"@npmcli/arborist": "^6.0.0 || ^6.0.0-pre.0",
28+
"@npmcli/arborist": "^7.1.0",
2929
"@npmcli/eslint-config": "^4.0.0",
30-
"@npmcli/template-oss": "4.18.0",
30+
"@npmcli/template-oss": "4.19.0",
3131
"hosted-git-info": "^7.0.0",
3232
"mutate-fs": "^2.1.1",
3333
"nock": "^13.2.4",
@@ -72,13 +72,7 @@
7272
},
7373
"templateOSS": {
7474
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
75-
"ciVersions": [
76-
"16.14.0",
77-
"16.x",
78-
"18.0.0",
79-
"18.x"
80-
],
81-
"version": "4.18.0",
75+
"version": "4.19.0",
8276
"windowsCI": false,
8377
"publish": "true"
8478
}

package-lock.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
"npm-user-validate": "^2.0.0",
144144
"npmlog": "^7.0.1",
145145
"p-map": "^4.0.0",
146-
"pacote": "^17.0.4",
146+
"pacote": "^17.0.5",
147147
"parse-conflict-json": "^3.0.1",
148148
"proc-log": "^3.0.0",
149149
"qrcode-terminal": "^0.12.0",
@@ -12471,9 +12471,9 @@
1247112471
}
1247212472
},
1247312473
"node_modules/pacote": {
12474-
"version": "17.0.4",
12475-
"resolved": "https://registry.npmjs.org/pacote/-/pacote-17.0.4.tgz",
12476-
"integrity": "sha512-eGdLHrV/g5b5MtD5cTPyss+JxOlaOloSMG3UwPMAvL8ywaLJ6beONPF40K4KKl/UI6q5hTKCJq5rCu8tkF+7Dg==",
12474+
"version": "17.0.5",
12475+
"resolved": "https://registry.npmjs.org/pacote/-/pacote-17.0.5.tgz",
12476+
"integrity": "sha512-TAE0m20zSDMnchPja9vtQjri19X3pZIyRpm2TJVeI+yU42leJBBDTRYhOcWFsPhaMxf+3iwQkFiKz16G9AEeeA==",
1247712477
"inBundle": true,
1247812478
"dependencies": {
1247912479
"@npmcli/git": "^5.0.0",

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"npm-user-validate": "^2.0.0",
106106
"npmlog": "^7.0.1",
107107
"p-map": "^4.0.0",
108-
"pacote": "^17.0.4",
108+
"pacote": "^17.0.5",
109109
"parse-conflict-json": "^3.0.1",
110110
"proc-log": "^3.0.0",
111111
"qrcode-terminal": "^0.12.0",

0 commit comments

Comments
 (0)