Skip to content

Commit 5197069

Browse files
committed
Update
1 parent 06d3f72 commit 5197069

File tree

7 files changed

+14
-69
lines changed

7 files changed

+14
-69
lines changed

packages/cache-handlers/deno.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@ascorbic/cache-handlers",
3+
"version": "0.0.0",
4+
"exports": "./src/index.ts",
5+
"license": "MIT",
6+
"publish": {
7+
"include": ["README.md", "src"]
8+
}
9+
}

packages/cache-handlers/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"build": "tsdown",
1515
"dev": "tsdown --watch",
1616
"prepublishOnly": "node --run build",
17+
"lint": "deno lint",
1718
"test": "pnpm run '/^test:.*/'",
1819
"test:deno": "deno test test/deno",
1920
"test:node": "vitest run",
@@ -32,7 +33,7 @@
3233
},
3334
"repository": {
3435
"type": "git",
35-
"url": "git+https://github.com/ascorbic/cdn-cache-control.git",
36+
"url": "git+https://github.com/ascorbic/cache-primitives.git",
3637
"directory": "packages/cache-handlers"
3738
},
3839
"homepage": "https://github.com/ascorbic/cdn-cache-control",

packages/cache-handlers/src/invalidation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { InvalidationOptions } from "./types.ts";
22
import { getCache, parseCacheTags, validateCacheTag } from "./utils.ts";
3-
import { getErrorHandler, safeJsonParse } from "./errors.ts";
3+
import { safeJsonParse } from "./errors.ts";
44

55
const METADATA_KEY = "https://cache-internal/cache-primitives-metadata";
66

packages/cache-handlers/test/deno/input-validation.test.ts

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -398,60 +398,6 @@ Deno.test(
398398
},
399399
);
400400

401-
Deno.test(
402-
"Input Validation - Config object with malicious properties",
403-
async () => {
404-
const cache = await caches.open("test");
405-
406-
// Test with config objects containing malicious properties
407-
const maliciousConfigs = [
408-
{
409-
__proto__: { admin: true },
410-
cacheName: "test",
411-
},
412-
{
413-
constructor: { prototype: { isAdmin: true } },
414-
maxTtl: 3600,
415-
},
416-
{
417-
toString: () => "malicious",
418-
defaultTtl: 1800,
419-
},
420-
{
421-
valueOf: () => ({ admin: true }),
422-
features: { cacheControl: true },
423-
},
424-
] as const;
425-
426-
for (const config of maliciousConfigs) {
427-
// Should create handlers without issues despite malicious config
428-
// Construct helpers to ensure config doesn't break them
429-
const mergedConfig = { cacheName: "test", ...config };
430-
// Basic write then read cycle
431-
const req = new Request("https://example.com/api/config-test");
432-
const resp = new Response("data", {
433-
headers: { "cache-control": "max-age=1" },
434-
});
435-
const written = await writeToCache(req, resp, mergedConfig);
436-
assertExists(written);
437-
const { cached } = await readFromCache(req, mergedConfig);
438-
if (cached) {
439-
await cached.text();
440-
}
441-
442-
// Verify no prototype pollution occurred
443-
assertEquals(
444-
Object.prototype.hasOwnProperty.call(Object.prototype, "admin"),
445-
false,
446-
);
447-
assertEquals(
448-
Object.prototype.hasOwnProperty.call(Object.prototype, "isAdmin"),
449-
false,
450-
);
451-
}
452-
},
453-
);
454-
455401
Deno.test(
456402
"Input Validation - Extremely deep object nesting in metadata",
457403
async () => {

packages/cache-handlers/test/workerd/worker-entry.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/cache-handlers/tsdown.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineConfig } from "tsdown";
2-
import baseConfig from "../../tsdown.config.js";
2+
import baseConfig from "../../tsdown.config.ts";
33

44
export default defineConfig({
55
...baseConfig,

packages/cdn-cache-control/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"homepage": "https://github.com/ascorbic/cache-primitives",
66
"repository": {
77
"type": "git",
8-
"url": "https://github.com/ascorbic/cache-primitives.git",
8+
"url": "git+https://github.com/ascorbic/cache-primitives.git",
99
"directory": "packages/cdn-cache-control"
1010
},
1111
"main": "dist/index.js",

0 commit comments

Comments
 (0)