fix: validate cached binary version matches requested version (#146) (#169)

* fix: validate cached binary version matches requested version (#146)

* fix: fail closed when cached version cannot be verified
This commit is contained in:
Wai Yan Min Lwin
2026-03-04 22:27:24 +07:00
committed by GitHub
parent 4c32875876
commit 95edc153a3
4 changed files with 89 additions and 50 deletions
+5
View File
@@ -12,6 +12,11 @@ export function getCacheKey(url: string): string {
return `bun-${createHash("sha1").update(url).digest("base64")}`;
}
export function extractVersionFromUrl(url: string): string | undefined {
const match = url.match(/\/bun-v([^/]+)\//);
return match?.[1];
}
export async function request(
url: string,
init?: RequestInit,