Skip to content

fix(app): support image attachments on insecure origins - #52529

Closed
ChristopheAwad wants to merge 1 commit into
anomalyco:devfrom
ChristopheAwad:insecure-attach
Closed

ChristopheAwad wants to merge 1 commit into
anomalyco:devfrom
ChristopheAwad:insecure-attach

Conversation

@ChristopheAwad

@ChristopheAwad ChristopheAwad commented Oct 1, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #47645

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Image attach failed on plain http hosts. crypto.subtle is undefined there, so blobID() threw and the part was dropped. The fix uses crypto.getRandomValues when subtle.digest is missing or throws. It also catches a failed draftStore.putBlob and falls back to a local blob reference. Same fallback added to the v2 path in session-ui.

Note: the fallback id is random, not a SHA-256 hash. Same file gets a new id on http. Secure contexts still use the hash.

How did you verify your code works?

Ran a personal build and opened the web UI over LAN on plain http from a second machine. Attached an image, the thumbnail appeared, and the model read the text in the image back correctly.

Also added packages/app/test-browser/draft-store-insecure.test.ts with 5 cases: hash path when subtle exists, fallback when subtle is missing, fallback when digest rejects, attach without draft store on insecure context, and empty plus non-image reject. CI runs typecheck and tests.

Screenshots / recordings

No UI change. No screenshot.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

@thdxr thdxr closed this Oct 10, 2026
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.

web: file attachments silently dropped on HTTP remote host — crypto.subtle undefined

2 participants