fix(miniflare): local send_email accepts more than 50 recipients
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 77/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
Direzione di ricerca
Leggi packages/miniflare/src/workers/email/send_email.worker.ts, in particolare validateMessageBuilder e il percorso di registrazione dei messaggi citato nel rapporto. Confronta la validazione locale con il limite di 50 destinatari della Workers API, poi esegui la riproduzione fornita in una sessione Wrangler locale. Il risultato è raggiunto quando 1 e 50 destinatari continuano a funzionare, 51 viene rifiutato e Local Explorer registra solo gli invii riusciti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What versions & operating system are you using?
Linux x86_64, Node.js 26.12.0, npm-published Wrangler 4.168.0 with Miniflare 5.20261123.1-beta and workerd 1.20261123.1. Source inspected on current main.
Please provide a link to a minimal reproduction
The complete reproduction is inline under Steps to reproduce.
Describe the Bug
Summary
A structured send through an unrestricted send_email binding in local Wrangler succeeds and writes a Local Explorer record for 51 recipients across to, cc, and bcc. This lets local integration tests accept a request the documented Workers API rejects.
Steps to reproduce
- Save the Worker and configuration below in a fresh directory, then start Wrangler in local mode:
npx [email protected] dev --local --ip 127.0.0.1 --port 0
Save this configuration as wrangler.json.
Reproduction script: wrangler.json
{"name":"email-recipient-count","main":"worker.mjs","compatibility_date":"2026-11-25","send_email":[{"name":"EMAIL"}]}
Save this Worker as worker.mjs. It exercises the binding from a local HTTP handler and returns either the message ID or the binding error.
Reproduction script: worker.mjs
export default {
async fetch(request, env) {
const { to, cc, bcc } = await request.json();
try {
const sent = await env.EMAIL.send({
from: "[email protected]", to, cc, bcc,
subject: "Recipient count probe", text: "Local simulation",
});
return Response.json(sent);
} catch (error) {
return Response.json({ code: error.code, message: error.message }, { status: 400 });
}
},
};
- Save the probe below as
reproduce.mjsand pass it the loopback URL from Wrangler'sReady online, replacingPORTwith the printed port. It exercises 1, 50, and 51 distinct placeholder addresses, reports the handler status, and verifies any returned message ID and recipient count against the Local Explorer capture. It requires Node.js and a running local development session.
node reproduce.mjs http://127.0.0.1:PORT
Reproduction script: reproduce.mjs
import assert from "node:assert/strict";
const base = new URL(process.argv[2]);
assert.equal(base.hostname, "127.0.0.1");
const addresses = (prefix, count) =>
Array.from({ length: count }, (_, index) => `${prefix}${index}@example.com`);
for (const [expected, to, cc, bcc] of [
[1, addresses("to", 1), [], []],
[50, addresses("to", 20), addresses("cc", 20), addresses("bcc", 10)],
[51, addresses("to", 21), addresses("cc", 20), addresses("bcc", 10)],
]) {
const response = await fetch(base, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ to, cc, bcc }),
});
const result = await response.json();
if (!response.ok) {
console.log(expected, response.status, result.code ?? result.message);
continue;
}
const lookup = new URL("/cdn-cgi/local/explorer/api/local/email/sending", base);
lookup.searchParams.set("email_id", result.messageId);
const record = await fetch(lookup);
assert.equal(record.status, 200);
const { result: stored } = await record.json();
assert.equal(stored.messageId, result.messageId);
const count = (stored.to?.length ?? 0) + (stored.cc?.length ?? 0) + (stored.bcc?.length ?? 0);
assert.equal(count, expected);
console.log(expected, response.status, "stored recipients", count);
}
Expected behavior
The structured Workers API limits the sum of to, cc, and bcc to 50 and documents E_TOO_MANY_RECIPIENTS above that limit. A local test at 51 should observe the validation failure before it gets a successful send or a captured message. The local simulator guide does not list a recipient-count exception.
Actual behavior
The local handler returned a message ID at 51, and Local Explorer returned a record with the same ID and all 51 addresses. The 1- and 50-recipient controls also succeeded. This was a loopback-only test with no remote binding or delivery.
1 200 stored recipients 1
50 200 stored recipients 50
51 200 stored recipients 51
Evidence
- Expected source: Email Sending Workers API, including
E_TOO_MANY_RECIPIENTSunder Error codes, and the local sending guide. - Failure source: The local probe and Local Explorer capture above. The current default-branch source listed below validates configured sender and recipient restrictions in
validateMessageBuilderand then records the message without comparing the combined recipient count to 50. - Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
Miniflare's overview invites reports for undocumented differences from the deployed environment. Production error behavior here is from the published contract.
Restoration check
Run the probe in a fresh local session. The 1- and 50-recipient controls still return IDs and the 51-recipient case rejects with the recipient-limit signal. Then list sent messages at /cdn-cgi/local/explorer/api/local/email/sending in that session and verify that only the two controls were captured.
References
- https://github.com/cloudflare/workers-sdk/issues/16789 — covers local failures when
tois omitted and the lower bound of one recipient. - https://github.com/cloudflare/workers-sdk/pull/16844 — the proposed patch checks the lower bound. The 51-recipient case would still pass that check.
Triage assessment
- Impact level: P2
- Assessment status: supported
- Impact basis: Local integration tests that count on the binding to reject an oversized recipient list can pass incorrectly. The effect is confined to local simulation of this boundary and does not establish any live sending failure.
- Workaround status: unverified
- Workaround basis: A remote binding should expose the documented service-side validation, but the probe used only the local simulator and did not verify that route.
- Lingua principale
- TypeScript
- Stelle
- 4.7k
- Fork
- 1.7k
- Merge medio
- 1g 23h
- PR unite (30g)
- 290
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cloudflare/workers-sdk
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
cloudflare/workers-sdk#17189 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
cloudflare/workers-sdk#17187 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
cloudflare/workers-sdk#17174 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
cloudflare/workers-sdk#17165 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
cloudflare/workers-sdk#17159 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cloudflare/workers-sdk
Issue simili
-
foreground-up-signals-live: delivery-repair cell expects a spawn suggestion status no longer printsApertabug triage:owned
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
e2e-failure ready-to-code
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
redhat-developer/rhdh-plugin-export-overlays#4905 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
directus/directus#28558 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
review: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
1lck/Lithe-IDEA#2432 ·
I maintainer di solito rispondono entro 1 giorno
-
AWS Lambda Waiting for: Product Owner
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
getsentry/sentry-javascript#26910 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno