You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(ai): bedrock-media MIME tables read through the prototype chain — media type "constructor" bypasses the unsupported-type error #916
packages/ai/src/protocols/utils/bedrock-media.ts routes media by MIME type with two bare table reads:
:97 — const imageFormat = IMAGE_FORMATS[mime as keyof typeof IMAGE_FORMATS]
:105 — const documentFormat = DOCUMENT_FORMATS[mime as keyof typeof DOCUMENT_FORMATS]
mime is the caller-supplied media type (part.media.mediaType.toLowerCase()), an arbitrary string. A bare record[key] read walks the prototype chain, so a media type of "constructor", "toString", or "__proto__" resolves to an inherited Object member (truthy) instead of missing. The if (imageFormat) / if (documentFormat) checks therefore pass with a function/object as the "format", bypassing the clear unsupported-media-type errors this function exists to produce, and a malformed Bedrock image/document block (format = the Object function) is built instead.
This is the #833 prototype-chain class, found while dispositioning the packages/ai hits for #912 (extending the check:proto-reads gate to packages/ai/src). It is filed separately per #912's acceptance criteria rather than allowlisted silently.
A test or probe shows media type "constructor" produces the unsupported-type error, and a known type (e.g. image/png, application/pdf) still lowers correctly.
bun run check:proto-reads still passes (the guarded lines keep their allowlist disposition, updated to "guarded at the site").
Session / ID: issue-sweep-rotating run 2026-10-29 15:24 CDT (2026-10-29T20:53:28Z)
Found via: sweep pickup
Task: PR fix(ai): guard bedrock-media MIME tables against prototype-chain reads #921 MERGED (squash 4619e76); issue closed by the merge. CI: linux unit/typecheck/affected/e2e/compliance/standards all pass; windows unit failed only on the unrelated gitHasReader timing test (5002ms timeout, job 123714333961) — pre-existing flake stream, change verified sound (laptop bedrock-media + media tests 12 pass, ai typecheck clean).
Expectation: done — prototype-named media types now fall through to the unsupported-media-type error.
Activity
developing-today commentedon Oct 29, 2026
OPENCODE-232
dezren39 commentedon Oct 29, 2026
🤖 Agent note · filed
dezren39 commentedon Oct 29, 2026
🤖 Agent note · picked up
dezren39 commentedon Oct 29, 2026
🤖 Agent note · handed off
dezren39 commentedon Oct 29, 2026
🤖 Agent note · done
fix(ci): refresh packages/ai allowlist dispositions for #916/#917 guards
fix(ci): refresh packages/ai allowlist dispositions for #916/#917 guards