mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-12 11:06:53 +08:00
Only allow download URLs pointing at the official S3 URL (#71)
fixes #52
This commit is contained in:
4
lib/installer.js
generated
4
lib/installer.js
generated
@@ -146,6 +146,10 @@ function getDownloadURL(fileInfo, version, arch) {
|
|||||||
if (version == 'nightly') {
|
if (version == 'nightly') {
|
||||||
return `${baseURL}/${getNightlyFileName(arch)}`;
|
return `${baseURL}/${getNightlyFileName(arch)}`;
|
||||||
}
|
}
|
||||||
|
// Verify that fileInfo.url points at the official Julia download servers
|
||||||
|
if (!fileInfo.url.startsWith('https://julialang-s3.julialang.org/')) {
|
||||||
|
throw new Error(`versions.json points at a download location outside of Julia's download server: ${fileInfo.url}. Aborting for security reasons.`);
|
||||||
|
}
|
||||||
return fileInfo.url;
|
return fileInfo.url;
|
||||||
}
|
}
|
||||||
exports.getDownloadURL = getDownloadURL;
|
exports.getDownloadURL = getDownloadURL;
|
||||||
|
|||||||
@@ -142,6 +142,10 @@ export function getDownloadURL(fileInfo, version: string, arch: string): string
|
|||||||
return `${baseURL}/${getNightlyFileName(arch)}`
|
return `${baseURL}/${getNightlyFileName(arch)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verify that fileInfo.url points at the official Julia download servers
|
||||||
|
if (!fileInfo.url.startsWith('https://julialang-s3.julialang.org/')) {
|
||||||
|
throw new Error(`versions.json points at a download location outside of Julia's download server: ${fileInfo.url}. Aborting for security reasons.`)
|
||||||
|
}
|
||||||
return fileInfo.url
|
return fileInfo.url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user