w3c / web-share-target

Web API proposal for receiving shared data
https://w3c.github.io/web-share-target/
Other
191 stars 20 forks source link

Specify validation of share_target at manifest load time. #28

Closed mgiuca closed 6 years ago

mgiuca commented 6 years ago

Closes #25


Preview | Diff

pkotwicz commented 6 years ago

I think this scenario might be problematic:

{
    "scope": "/foo",
    "share_target": {
        "url_template": "/foo/{text}/"
    }
}

If we do validation at parse time, it seems like |url_template| would fall under the scope. However, if a user wants to share ".." the URL will fall out of scope

mgiuca commented 6 years ago

That's a good point. (Note that other problematic characters such as '/' and '?' are not an issue because we encode the placeholders with the userinfo percent encode set, but '.' and '..' are a problem.)

I was going to suggest that we add U+002E to the encode set, but it turns out that won't help -- "%2e" is considered equivalent to ".". So I'm not sure exactly how we can prevent this: either prevent all placeholders from appearing before the '?' (would be the big hammer approach), or otherwise somehow ban these path segments.

mgiuca commented 6 years ago

I've closed this and moved the work to a new branch: https://github.com/mgiuca/web-share-target/tree/parse-at-parse-time which will actually parse the URL template as a URL instead of just validating it at load time.