Fix security vulnerabilities
This commit is contained in:
+6
-3
@@ -1,6 +1,9 @@
|
||||
export default function grabCacheNames({ key, paradigm = "html" }) {
|
||||
const parsed_key = encodeURIComponent(key);
|
||||
export default function grabCacheNames({ key, cache_id, paradigm = "html", }) {
|
||||
// Hashing keeps file names short and fixed-length no matter how long
|
||||
// the request path or query string is.
|
||||
const parsed_key = cache_id ||
|
||||
new Bun.CryptoHasher("sha256").update(key || "").digest("hex");
|
||||
const cache_name = `${parsed_key}.res.${paradigm}`;
|
||||
const cache_meta_name = `${parsed_key}.meta.json`;
|
||||
return { cache_name, cache_meta_name };
|
||||
return { cache_id: parsed_key, cache_name, cache_meta_name };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user