Repository navigation
Allow only http and https in the callback URL, and test the zone and port rules - #40
Merged
Merged
Conversation
…port rules The script posts to the callback URL only with fetch and XMLHttpRequest, which reach a server with no scheme but http and https, so any other protocol is refused, compared ignoring the case of ASCII letters only. A protocol from the request that is neither is logged once like any other URL that is not valid, and a protocol configured on the builder raises a ValueError. The tests now hold the shared cases no test held before: a bad IPv6 zone and anything but a port after the closing bracket, a port read by its value, each character rule 8 encodes, and the long s in a protocol.
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 free
to 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.
Problem
Two follow-ups to the callback URL check in #31, from the shared rules in specifications#74.
]. The check refuses both, in_checked_host_portinpipeline/fiftyone_pipeline_core/src/fiftyone_pipeline_core/callback_url.py, but none of the refused hosts held%25or text after the closing bracket. The zone check is what keeps a quote out of the script for a bracketed host, so if it went,[fe80::1%25'+alert(1)+']would reach the script and every test would still pass. The same was true of a port read by its value and of the characters rule 8 encodes.httpandhttps. The script posts to the callback URL only withfetchandXMLHttpRequest, and the Fetch Standard's scheme fetch gives every other scheme a network error or keeps it local, so a callback URL with any other scheme could never work. The check accepted any RFC 3986 scheme, such asftp.Change
callback_url.pyaccepts onlyhttpandhttps, compared after lower-casing the ASCII letters A to Z only. A comparison that ignores case in general can match a letter outside ASCII to an ASCII one, for example the long s (U+017F) tos, which would lethttpſpass ashttpsand then fail in the browser.header.protocolevidence that is neither gives a script with no callback, and is logged once like any other URL that is not valid (rule 6).JavascriptBuilderElementnow raises aValueErrorwhen it is made with any other protocol, as it already does for an object name that is not valid.], and a zone followed by a port,:00080and:0065535accepted,:0065536and longer refused),%at the end,ftp,h+t-p.sandhttpſnow refused, a configured protocol refused, and a refused protocol from the request logged once.Release note
httpandhttpsprotocols, in any case of their ASCII letters. A protocol from the request that is neither gives no callback and is logged once. A protocol configured on the builder that is neither raises aValueError.How it was checked
The full build with macOS is linked below once it has run.