fix: enforce manifest-based component downloads and validate package URLs during release builds

This commit is contained in:
2026-11-04 21:30:54 -08:00
parent b0096a2073
commit a506a2efb4
2 changed files with 7 additions and 4 deletions

View File

@@ -247,6 +247,9 @@ async function main() {
for (const [name, c] of Object.entries(manifestData.components || {})) { for (const [name, c] of Object.entries(manifestData.components || {})) {
console.log(`Uploading ${c.file}...`); console.log(`Uploading ${c.file}...`);
c.url = await uploadFileToGitLabPackage(path.join(__dirname, 'release-assets', c.file), 'vyla-home', version, `${name}-${timestamp}.zip`); c.url = await uploadFileToGitLabPackage(path.join(__dirname, 'release-assets', c.file), 'vyla-home', version, `${name}-${timestamp}.zip`);
if (!c.url || !c.url.includes('/packages/generic/vyla-home/')) {
throw new Error(`Upload for ${name} did not return a package URL.`);
}
} }
const signingKeyPem = process.env.VYLA_UPDATE_SIGNING_KEY; const signingKeyPem = process.env.VYLA_UPDATE_SIGNING_KEY;

View File

@@ -379,13 +379,13 @@ class UpdateClient {
const components = {}; const components = {};
for (const [name, c] of Object.entries(manifest.components)) { for (const [name, c] of Object.entries(manifest.components)) {
const link = links.find((a) => a.name === c.file);
const direct = typeof c.url === 'string' && const direct = typeof c.url === 'string' &&
c.url.startsWith('https://gitlab.com/api/v4/projects/') && c.url.startsWith('https://') &&
isAllowedHost(c.url) &&
c.url.includes('/packages/generic/vyla-home/'); c.url.includes('/packages/generic/vyla-home/');
const url = direct ? c.url : (link && link.url); const url = direct ? c.url : null;
if (!url) { if (!url) {
throw new Error(`Release is missing asset ${c.file}.`); throw new Error(`Release ${release.tag_name} manifest has no download URL for ${c.file}.`);
} }
components[name] = { url, sha256: c.sha256, id: c.id, size: c.size }; components[name] = { url, sha256: c.sha256, id: c.id, size: c.size };
} }