Skip to content

[miniflare] Make static asset disk services read-only - #16607

Open
petebacondarwin wants to merge 2 commits into
mainfrom
codex/read-only-asset-disks
Open

petebacondarwin wants to merge 2 commits into
mainfrom
codex/read-only-asset-disks

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Miniflare's static assets and Workers Sites namespaces only read their disk services. Configure those services as read-only to match that contract, while preserving writable persistence services.

Adds coverage for direct disk-service PUT/DELETE rejection, ordinary asset serving, developer updates after reload, and KV persistence across reloads. Includes a Miniflare patch changeset.

Wrangler and Vitest inherit the behavior through Miniflare. Vite preview uses the same asset services; Vite dev continues to serve assets through its own middleware.

Validation passed: Miniflare build, 77 assets/Workers Sites/KV tests, package TypeScript check, type-aware lint, and formatting. Separate consumer end-to-end suites were not run.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this aligns internal disk-service permissions with the existing read-only asset contract and adds no public configuration or API.

Devin Review

@changeset-bot

changeset-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2cfeb16

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
miniflare Patch
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
@cloudflare/remote-bindings Patch
@cloudflare/runtime-types Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-plugin Patch
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Oct 30, 2026
@workers-devprod
workers-devprod requested review from a team and dario-piotrowicz and removed request for a team October 30, 2026 17:16
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/tidy-assets-read-only.md: [@cloudflare/wrangler]
  • packages/miniflare/src/plugins/assets/index.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/plugins/kv/sites.ts: [@cloudflare/wrangler]
  • packages/miniflare/test/plugins/assets/read-only.spec.ts: [@cloudflare/wrangler]
devin-ai-integration[bot]

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 2cfeb166.

This review, of c2b98c47

✅ Approved — A small, well-scoped permission change with matching tests and a changeset; no issues found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

Risk: Low. A patch changeset for Miniflare fits this change.


🔒 Security: ✅ LGTM

The change shrinks the attack surface: the disk services now reject writes even when a caller reaches them directly instead of going through the namespace Worker.


📖 AGENTS.md: ✅ LGTM

Matches the repository's conventions: the behaviour is implemented in Miniflare so every consumer gets it, it has test coverage, and a changeset is included.


📋 Code Quality: ✅ LGTM

The writable: false change is limited to the asset and Sites storage services. The Workers bound to them only read, so serving behaviour is unchanged.


⚡ Performance: ✅ LGTM

No performance impact.


📝 Documentation: ✅ LGTM

No public documentation changes are needed. The behaviour is internal and does not add any configuration.


Reviewed commit: c2b98c47

@pkg-pr-new

pkg-pr-new Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@16607

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@16607

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@16607

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@16607

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@16607

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@16607

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@16607

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@16607

miniflare

npm i https://pkg.pr.new/miniflare@16607

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@16607

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@16607

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@16607

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@16607

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@16607

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@16607

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@16607

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@16607

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@16607

wrangler

npm i https://pkg.pr.new/wrangler@16607

commit: 2cfeb16

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved — A small, well-scoped permission change with matching tests and an accurate patch changeset. No issues found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

Risk: Low. A miniflare patch changeset fits this change.


🔒 Security: ✅ LGTM

The change reduces the attack surface: the asset and Sites disk services now reject writes even when a caller reaches them directly.


📖 AGENTS.md: ✅ LGTM

Follows the repository's conventions: the behaviour is implemented in Miniflare so Wrangler, Vitest and Vite preview all get it, tests cover the change, and a changeset is included.


📋 Code Quality: ✅ LGTM

writable: false is set only on the assets and Workers Sites disk services. Each of these services is used only by its own namespace Worker, and those Workers only read from it, so asset serving works as before. Storage services that must stay writable (KV, R2, D1) are unchanged. The new test covers rejection of direct PUT and DELETE requests, asset updates after a reload, and KV persistence across reloads.


⚡ Performance: ✅ LGTM

No performance impact.


📝 Documentation: ✅ LGTM

The updated changeset describes the behaviour accurately. No public documentation is needed, because the change adds no configuration or API.


Reviewed commit: 2cfeb166

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

Labels

None yet

2 participants