Release ForgeFlow 0.8.5 trusted asset downloads
This commit is contained in:
@@ -340,18 +340,21 @@ test("packaged updater downloads only a published checksum-matched Windows asset
|
||||
draft: false,
|
||||
prerelease: false,
|
||||
assets: [
|
||||
{ name: assetName, browser_download_url: "https://gitea.test/setup" },
|
||||
{
|
||||
id: 41,
|
||||
name: assetName,
|
||||
browser_download_url: "http://wrong-origin.test/setup",
|
||||
},
|
||||
{
|
||||
name: `${assetName}.sha256`,
|
||||
browser_download_url: "https://gitea.test/checksum",
|
||||
id: 42,
|
||||
browser_download_url: "http://wrong-origin.test/checksum",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
async downloadAuthenticated(url) {
|
||||
return url.endsWith("/checksum")
|
||||
? Buffer.from(`${sha256} ${assetName}\n`)
|
||||
: binary;
|
||||
async downloadReleaseAsset(_owner, _repo, assetId) {
|
||||
return assetId === 42 ? Buffer.from(`${sha256} ${assetName}\n`) : binary;
|
||||
},
|
||||
};
|
||||
const service = new UpdateService({
|
||||
@@ -398,18 +401,20 @@ test("packaged updater rejects a binary whose checksum does not match", async ()
|
||||
tag_name: "v0.8.2",
|
||||
assets: [
|
||||
{
|
||||
id: 51,
|
||||
name: assetName,
|
||||
browser_download_url: "https://gitea.test/portable",
|
||||
browser_download_url: "http://wrong-origin.test/portable",
|
||||
},
|
||||
{
|
||||
id: 52,
|
||||
name: `${assetName}.sha256`,
|
||||
browser_download_url: "https://gitea.test/checksum",
|
||||
browser_download_url: "http://wrong-origin.test/checksum",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
async downloadAuthenticated(url) {
|
||||
return url.endsWith("/checksum")
|
||||
async downloadReleaseAsset(_owner, _repo, assetId) {
|
||||
return assetId === 52
|
||||
? Buffer.from(`${"0".repeat(64)} ${assetName}`)
|
||||
: binary;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user