Skip to content

fix(app): support attachments in insecure contexts - #44735

Open
marcelokarval wants to merge 1 commit into
anomalyco:devfrom
marcelokarval:insecure-attachments
Open

fix(app): support attachments in insecure contexts#44735
marcelokarval wants to merge 1 commit into
anomalyco:devfrom
marcelokarval:insecure-attachments

Conversation

@marcelokarval

@marcelokarvalmarcelokarval commented Aug 24, 2026

Copy link
Copy Markdown

Issue for this PR

Closes#41706

Type of change

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

What does this PR do?

This fixes attachment blob-ID generation when the app is served over an insecure HTTP origin, where crypto.subtle is unavailable. It keeps the existing SHA-256 IDs when crypto.subtle is available and otherwise generates a 128-bit ID with crypto.getRandomValues. The fallback is applied to both draft storage and the active V2 attachment path, so previews can be created without relying on the secure-context-only API.

This ports the fallback accepted in #42706 to dev and adds V2-path regression coverage.

How did you verify your code works?

  • bun run test:browser in packages/app — 43 passed
  • bun run typecheck in packages/app
  • bun run typecheck in packages/session-ui
  • Firefox against a LAN HTTP origin with isSecureContext === false and no crypto.subtle: image preview appeared without a page error.

Screenshots / recordings

Manual browser verification was performed in Firefox over LAN HTTP; no screenshot or recording was captured.

Checklist

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

@github-actions

Copy link
Copy Markdown
Contributor

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

Potential duplicate found:

This suggests PR #41710 may be an earlier attempt on a different branch, and the current PR consolidates and improves upon that work.

@github-actionsgithub-actionsBot removed the needs:compliance This means the issue will auto-close after 2 hours. label Aug 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Sign up for freeto 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 UI: pasting images fails with Cannot read properties of undefined (reading 'digest') when accessing via HTTP on non-localhost

1 participant

@marcelokarval