Skip to content

fix(bindings): derive sqlite limits from host time and memory caps#1600

Merged
chaliy merged 1 commit into
mainfrom
2026-05-08-fix-sqlite-opt-in-resource-limits
May 8, 2026
Merged

fix(bindings): derive sqlite limits from host time and memory caps#1600
chaliy merged 1 commit into
mainfrom
2026-05-08-fix-sqlite-opt-in-resource-limits

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 8, 2026

Motivation

  • The Python/JS bindings enabled the in-process SQLite builtin with SqliteLimits::default(), which allowed large result materialisation and rendering to bypass host ExecutionLimits and risk in-process DoS.
  • The change aligns SQLite budgets with the binding-level resource knobs so opting-in from Python/JS cannot exceed caller time or memory caps.

Description

  • Python: apply_sqlite_config now accepts timeout_seconds and max_memory, maps them to SqliteLimits::max_duration / max_db_bytes, and uses builder.sqlite_with_limits(...) instead of builder.sqlite(); constructor and reset call sites updated to pass the host limits.
  • JavaScript: added derive_sqlite_limits(state) which maps timeout_ms and max_memory (MiB) into SqliteLimits, and switched the JS opt-in to builder.sqlite_with_limits(derive_sqlite_limits(state)).
  • Kept the explicit env gate behavior unchanged (BASHKIT_ALLOW_INPROCESS_SQLITE=1) and preserved existing deny-list defaults; changes restrict sqlite runtime budgets to host-specified limits.

Testing

  • Ran cargo fmt --all which completed successfully.
  • Ran cargo check -p bashkit-python -p bashkit-js which completed successfully.

Codex Task

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

cloudflare-workers-and-pages Bot commented May 8, 2026

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 d5bec39 Commit Preview URL May 08 2026, 09:10 AM

@chaliy chaliy force-pushed the 2026-05-08-fix-sqlite-opt-in-resource-limits branch from feb16af to d5bec39 Compare May 8, 2026 09:09
@chaliy chaliy merged commit bf3e7f7 into main May 8, 2026
34 checks passed
@chaliy chaliy deleted the 2026-05-08-fix-sqlite-opt-in-resource-limits branch May 8, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant