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

LibWeb: Partition Blob URL fetches by Storage Key #3303

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

shannonbooth
Copy link
Contributor

This was a security mechanism introduced in the fetch spec, with
supporting AOs added to the FileAPI spec.

@shannonbooth shannonbooth force-pushed the blob-partioning branch 2 times, most recently from bb21920 to 36c4a08 Compare January 19, 2025 06:56
bool is_top_level_navigation = request->destination() == Infrastructure::Request::Destination::Document;

// 5. If isTopLevelNavigation is false and requestEnvironment is null, then return a network error.
if (is_top_level_navigation && !request_environment)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be !is_top_level_navigation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof, yes it should, good spot, thanks! Now I need to figure out how to write a test for this one, doesn't seem trivial with my current understanding of fetch 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to find any method of trigging this, every caller of fetch that I can see from a search sets the client of the request. So I've just pushed a fix for now.

Did happen to find a bug with not supporting blob URLs when trying to find a repro for this, will raise a separate PR for that.

Instead of just putting in members directly, wrap them up in structs
which represent what a URL blob entry is meant to hold per the spec.
This makes more obvious what this is meant to represent, such as the
ByteBuffer being used to represent the bytes behind a Blob.

This also allows us to use a stronger type for a function that needs
to return a Blob URL entry's object.
When we serialize blob URL entries we do not serialize the entire
environment settings object and only use it's origin. To allow
a Blob URL entry to access its relevant storage key, add a getter
that simply takes an origin.
This was a security mechanism introduced in the fetch spec, with
supporting AOs added to the FileAPI spec.
@tcl3 tcl3 enabled auto-merge (rebase) January 21, 2025 17:41
@tcl3 tcl3 merged commit 00cef33 into LadybirdBrowser:master Jan 21, 2025
7 checks passed
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.

2 participants