Skip to content

fix: encode large base64url buffers safely#235

Open
samsamtrum wants to merge 1 commit into
zerodevapp:mainfrom
samsamtrum:fix-large-base64url-encode
Open

fix: encode large base64url buffers safely#235
samsamtrum wants to merge 1 commit into
zerodevapp:mainfrom
samsamtrum:fix-large-base64url-encode

Conversation

@samsamtrum
Copy link
Copy Markdown

Summary

  • avoid spreading every byte into String.fromCharCode when base64url-encoding buffers
  • add coverage for encoding a large buffer that previously exceeded the JavaScript argument limit

Why

base64UrlEncode is used for WebAuthn challenges and accepted any ArrayBuffer, but String.fromCharCode(...bytes) throws a RangeError once the buffer is large enough because it passes every byte as a function argument. Building the binary string incrementally keeps the behavior the same for normal inputs while avoiding that argument-limit failure.

Test

  • corepack pnpm vitest run packages/core/src/utils/utils.test.ts
  • corepack pnpm biome check packages/core/src/utils/utils.ts packages/core/src/utils/utils.test.ts

@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@samsamtrum is attempting to deploy a commit to the Offchain Labs - OCL Billed Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant