Skip to content

Commit a75a0c8

Browse files
committed
feat: add maximum key size limit to ActorKeySchema
1 parent 07b916e commit a75a0c8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/actor-core/src/common/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import type { ContentfulStatusCode } from "hono/utils/http-status";
33
import * as errors from "@/actor/errors";
44
import type { Logger } from "./log";
55

6-
export const ActorKeySchema = z.array(z.string());
6+
// Maximum size of a key component in bytes
7+
// Set to 128 bytes to allow for separators and escape characters in the full key
8+
// Cloudflare's maximum key size is 512 bytes, so we need to be significantly smaller
9+
export const MAX_KEY_SIZE = 128;
10+
11+
export const ActorKeySchema = z.array(z.string().max(MAX_KEY_SIZE));
712

813
export type ActorKey = z.infer<typeof ActorKeySchema>;
914

0 commit comments

Comments
 (0)