Skip to content

feat: add maximum key size limit to ActorKeySchema #950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/actor-core/src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import type { ContentfulStatusCode } from "hono/utils/http-status";
import * as errors from "@/actor/errors";
import type { Logger } from "./log";

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

export const ActorKeySchema = z.array(z.string().max(MAX_KEY_SIZE));

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

Expand Down
Loading