Uh oh!
There was an error while loading. Please reload this page.
fix(app): support attachments in insecure contexts - #44735
Open
marcelokarval wants to merge 1 commit into
Open
Conversation
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. |
Contributor
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes#41706
Type of change
What does this PR do?
This fixes attachment blob-ID generation when the app is served over an insecure HTTP origin, where
crypto.subtleis unavailable. It keeps the existing SHA-256 IDs whencrypto.subtleis available and otherwise generates a 128-bit ID withcrypto.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
devand adds V2-path regression coverage.How did you verify your code works?
bun run test:browserinpackages/app— 43 passedbun run typecheckinpackages/appbun run typecheckinpackages/session-uiisSecureContext === falseand nocrypto.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