Skip to content

fix(jq): cap file binding memory#1613

Merged
chaliy merged 1 commit into
mainfrom
2026-05-08-jq-file-binding-limits
May 8, 2026
Merged

fix(jq): cap file binding memory#1613
chaliy merged 1 commit into
mainfrom
2026-05-08-jq-file-binding-limits

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 8, 2026

What

Adds defensive count and cumulative byte limits for jq --rawfile/--slurpfile bindings, with regression coverage for repeated bindings to the same VFS file.

Why

Repeated jq file bindings could retain and clone one bounded file many times across jq globals and $ARGS.named, allowing a small script to amplify memory use beyond VFS and output limits.

How

  • Caps file binding requests at parse time.
  • Counts cumulative file-bound bytes per binding before retaining jq globals.
  • Documents TM-DOS-062 in the threat model.

Risk

  • Low
  • Very large or highly repetitive jq file-binding invocations now fail with exit code 2 instead of attempting unbounded allocation.

Checklist

  • Tests added or updated
  • Backward compatibility considered

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 8f54fd1 Commit Preview URL May 08 2026, 08:09 PM

@chaliy chaliy merged commit 362c8f6 into main May 8, 2026
34 checks passed
@chaliy chaliy deleted the 2026-05-08-jq-file-binding-limits branch May 8, 2026 20:21
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