Open sapio-dwelch opened 5 years ago
I believe the thought was that long URLs can be a denial-of-service vector.
That decision was made before data: URLs were widely used for images, so could be reconsidered.
Do you know of a good cutoff?
https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers seems to conflate the address bar length and length limits to fetch.spec.whatwg.org.
Thanks for the reply.
I am not aware of what a good cutoff would be.
I thought that maybe the justification for a limit of 1024 was long URL == attack
, but, if so, why is it only being enforced for URLs found in style sheets and not for URLs found elsewhere? (I have tested an image with a data URL greater than 4000 bytes and there seems to be no such limit). If there is no enforcement of this for all URLs, then I would argue that it be removed for the URLs found in style sheets, as well.
Those who are concerned about the max lengths could still enforce a 1024 character limit (or any limit) using a custom AttributePolicy
.
Is there a workaround to allow any size data:image blocks? I have a size check on the whole payload of HTTP request, so I don't need to check individual properties length.
Length limits avoid a lot of boundary problems in downstream code so seem in scope for sanitizers.
https://stackoverflow.com/a/417184/20394 suggests that maybe the limit should be 2000 instead of 1024
When trying to sanitize large data URIs used as background images in CSS properties, there is a hard-coded URL limit of 1024 characters (this is in
StylingPolicy.sanitizeAndAppendUrl
). Any value larger than 1024 characters is removed.The output for TOO_LONG will not include the background-image property, but the output for NOT_TOO_LONG will. Is there a reason for the limit?