Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's unclear how multipart/x-mixed-replace should be handled #42

Open
farre opened this issue Sep 15, 2023 · 3 comments
Open

It's unclear how multipart/x-mixed-replace should be handled #42

farre opened this issue Sep 15, 2023 · 3 comments

Comments

@farre
Copy link

farre commented Sep 15, 2023

I've mostly seen multipart/x-mixed-replace used as a pre-video element solution for "streaming" jpeg to <img> element, a la mjpeg but the sub-resource of a multipart/x-mixed-replace can be of any type, and even switch between resoureces as far as I can tell.

This makes it impossible to sniff, which leads me to believe that we need to block multipart/x-mixed-replace entirely but I'm not at all sure of how web compatible this is.

@annevk
Copy link
Owner

annevk commented Sep 18, 2023

Does such a response always use Content-Type: multipart/x-mixed-replace? Would the first couple of bytes not identify whether it's an image or not? Either we can use that combination or we can safelist multipart/x-mixed-replace in its entirety and strongly recommend against using it.

@farre
Copy link
Author

farre commented Sep 18, 2023

Maybe there's a compromise here, if we say that we sniff the first part and block based on that and if the subresource changes type, then we just allow it.

That might be better than just allowing it in its entirety. I'm not sure how hard this is to spec or implement though, just immediate thoughts.

@annevk
Copy link
Owner

annevk commented Sep 18, 2023

Yeah, I was thinking that too. If it looks like it's going to be a stream of images based on the initial response, sure, go ahead. And then the server is on the hook for sending things later it didn't want to go across origins. But if it immediately sends something else, we block.

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

No branches or pull requests

2 participants