iterate-skill-installer 3.11.0 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/installer.js +14 -3
- package/package.json +1 -1
package/lib/installer.js
CHANGED
|
@@ -56,6 +56,16 @@ const CHECKSUMS_ASSET_NAME = 'SHA256SUMS.txt';
|
|
|
56
56
|
// verifies authenticity (not just integrity) against the embedded signing key.
|
|
57
57
|
const TARBALL_SIGNATURE_ASSET_NAME = 'iterate-skill.tar.gz.asc';
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Find a release asset by name, tolerating a malformed payload.
|
|
61
|
+
* Guards each element (a malformed GitHub API response can contain a null /
|
|
62
|
+
* non-object entry before the matching asset; `a.name` on null would throw a
|
|
63
|
+
* TypeError instead of the intended clean "release is missing …" error path).
|
|
64
|
+
*/
|
|
65
|
+
function findReleaseAsset(assets, name) {
|
|
66
|
+
return Array.isArray(assets) ? assets.find((a) => a && a.name === name) : undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
59
69
|
// Hard cap on a single curl download: a misbehaving CDN or a corrupt release
|
|
60
70
|
// must never hang the installer forever.
|
|
61
71
|
const CURL_MAX_TIME_SECONDS = '120';
|
|
@@ -1637,11 +1647,11 @@ async function main(options = {}) {
|
|
|
1637
1647
|
}
|
|
1638
1648
|
success(`Latest release: ${tag}`);
|
|
1639
1649
|
|
|
1640
|
-
const tarballAsset = release.assets
|
|
1641
|
-
const checksumAsset = release.assets
|
|
1650
|
+
const tarballAsset = findReleaseAsset(release.assets, TARBALL_ASSET_NAME);
|
|
1651
|
+
const checksumAsset = findReleaseAsset(release.assets, CHECKSUMS_ASSET_NAME);
|
|
1642
1652
|
// Optional `.asc` signature; its absence only downgrades authenticity to
|
|
1643
1653
|
// integrity (see the best-effort verify below), never fails the install.
|
|
1644
|
-
const signatureAsset = release.assets
|
|
1654
|
+
const signatureAsset = findReleaseAsset(release.assets, TARBALL_SIGNATURE_ASSET_NAME);
|
|
1645
1655
|
|
|
1646
1656
|
if (!tarballAsset) {
|
|
1647
1657
|
error(`Release is missing the ${TARBALL_ASSET_NAME} asset.`);
|
|
@@ -1820,6 +1830,7 @@ module.exports = {
|
|
|
1820
1830
|
parseChecksums,
|
|
1821
1831
|
constantTimeHashEqual,
|
|
1822
1832
|
enforceDownloadedSize,
|
|
1833
|
+
findReleaseAsset,
|
|
1823
1834
|
extractTarball,
|
|
1824
1835
|
rejectLinkEntries,
|
|
1825
1836
|
sumDeclaredSizes,
|