-
Notifications
You must be signed in to change notification settings - Fork 19
Specify validation of share_target at manifest load time. #28
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
Conversation
7281ccf
to
e284031
Compare
</li> | ||
<li>Let <var>test relative URL</var> be the result of running the <a> | ||
replace placeholders</a> algorithm on <var>URL template</var> with | ||
<code>{}</code> (the empty <a data-cite= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't quite correct to substitute the empty dictionary to find out whether a URL template will expand to within scope.
Consider a manifest:
{
"scope": "/foo",
"share_target": {
"url_template": "/fo{text}o"
}
}
The manifest will parse correctly, because expanding url_template
with text = ""
is "/foo"
. But if given any non-empty text
, it will expand to be out of scope.
There are a few solutions to this:
- Fix the scope checking algorithm (this) to somehow make sure it fails if any substitution would move it outside the scope.
- Prevent template parameters from appearing in the path part (i.e., before the query) entirely.
@@ -377,6 +458,12 @@ <h3> | |||
empty <var>features</var>. | |||
</li> | |||
</ol> | |||
<p class="note"> | |||
This algorithm never aborts if <var>manifest</var> has had the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't strictly true, due to the above problem.
I think this scenario might be problematic:
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 |
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. |
e284031
to
69fba2b
Compare
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. |
Closes #25
Preview | Diff