-
Notifications
You must be signed in to change notification settings - Fork 66
Add "validate share data" algorithm #185
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
dbbc9df
Add canShare() method
marcoscaceres a3a4319
add SecureContext and allowed to use check
marcoscaceres 99cccb7
Add http+https checks to validation
marcoscaceres c60193b
Handle empty files sequence
marcoscaceres a1a8a8b
Update index.html
marcoscaceres e04fca8
Merge branch 'master' into canShare
marcoscaceres 7dde1f3
Merge branch 'master' into canShare
marcoscaceres a42f0b7
Add "validate share data" algorithm
marcoscaceres 84e8c3a
fixup
marcoscaceres bd53f07
Simplify call to validate share data
marcoscaceres e683d56
Apply suggestions from code review
marcoscaceres 788a9e2
Merge branch 'master' into validate_data
marcoscaceres 6c0a9f5
Add AU-specific type check, plus reject
marcoscaceres daa015a
Merge branch 'main' into validate_data
marcoscaceres 6654681
Merge branch 'main' into validate_data
marcoscaceres 1adf6dc
Merge branch 'main' into validate_data
marcoscaceres bae0c90
Merge branch 'main' into validate_data
marcoscaceres b494946
Fixup internal slot
marcoscaceres 88865d6
Merge branch 'main' into validate_data
marcoscaceres f83e582
Merge branch 'main' into validate_data
marcoscaceres 95d9909
Update index.html
marcoscaceres 40618ca
Remove note about allowed to use in priv sec section
marcoscaceres 32eaf09
Merge branch 'main' into validate_data
marcoscaceres 1355ab6
Merge branch 'main' into validate_data
marcoscaceres abd6bcd
Fixup + remove link to issue 127
marcoscaceres 28e5ad5
fixup typo
marcoscaceres d86d782
another typo
marcoscaceres e72fe88
Add missing {{DOMException}} in places
marcoscaceres f79f7c6
Merge branch 'main' into validate_data
marcoscaceres a978ab3
Merge branch 'main' into validate_data
marcoscaceres 5b7071e
Remove null check, done elsewhere
marcoscaceres c03d6ab
Merge branch 'main' into validate_data
marcoscaceres c8c2525
Remove ref to secure-context
marcoscaceres b563520
Further fixup
marcoscaceres a612457
Merge branch 'main' into validate_data
marcoscaceres 9d2f37b
Let UA decide what's a hostile URL
marcoscaceres 5ca9b3a
Merge branch 'main' into validate_data
marcoscaceres 892497f
Include issue 178
marcoscaceres File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,7 @@ | |
}; | ||
secure-contexts"> | ||
This specification defines an API for sharing text, links and other | ||
|
@@ -147,7 +147,7 @@ | |
|
||
|
||
allowed to use the "[=web-share-feature|web-share=]" | ||
permission, return [=a promise rejected with=] with a | ||
permission, return [=a promise rejected with=] a | ||
{{"NotAllowedError"}} {{DOMException}}. | ||
|
||
|
@@ -161,32 +161,21 @@ | |
|
||
|
||
{{ShareData/text}}, or {{ShareData/url}} or {{ShareData/file}} are | ||
present, return a promise rejected with a {{TypeError}}. | ||
|
||
rejected with=] {{InvalidStateError}}. | ||
|
||
|
||
|
||
implementation does not support file sharing, return a | ||
promise rejected with a {{TypeError}}, and abort these | ||
steps. | ||
|
||
object's [=environment settings object/api base URL=]. | ||
|
||
false, then return [=a promise rejected with=] a {{TypeError}}. | ||
|
||
|
||
|
||
object's [=environment settings object/api base URL=]. | ||
|
||
parser on |data|'s {{ShareData/url}} with |base|. | ||
|
||
{{TypeError}}. | ||
|
||
a promise rejected with {{TypeError}}. | ||
|
||
|
||
member set to the result of running the URL serializer | ||
|
@@ -195,7 +184,7 @@ | |
|
||
return a promise rejected with with a {{"NotAllowedError"}} | ||
return [=a promise rejected with=] with a {{"NotAllowedError"}} | ||
{{DOMException}}. | ||
|
||
|
@@ -269,6 +258,55 @@ | |
or bypassing the UI if there is only a single share target. | ||
Validate share data | ||
To validate share data with |data:ShareData| and | ||
|base:URL|, run the following steps: | ||
|
||
|
||
{{ShareData/text}}, or {{ShareData/url}} or {{ShareData/files}} are | ||
present, return false. | ||
|
||
{{ShareData/title}}, or {{ShareData/text}}, or {{ShareData/url}} is | ||
present. | ||
|
||
|
||
|
||
marcoscaceres marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{{ShareData/files}} member is empty, or return false. | ||
marcoscaceres marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This causes a `{ files: [] }` dictionary to be treated as | ||
an empty dictionary. However, passing a dictionary like | ||
`{text: "text" files: []}` is fine, as `files` is just | ||
marcoscaceres marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ignored. | ||
|
||
false. | ||
marcoscaceres marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
|
||
on |data|'s url, with |base|, and no encoding override. | ||
|
||
|
||
false. | ||
|
||
|
@@ -459,9 +497,13 @@ | |
native applications. | ||
|
||
is available only in secure contexts (such as `https://` | ||
method is restricted to [=secure contexts=] (such as `https://` | ||
schemes). | ||
|
||
{{Navigator/share()}} method is one of the mechanisms described in | ||
[[[permissions-policy]]]. | ||
marcoscaceres marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
"https://en.wikipedia.org/wiki/Privacy_mode">private browsing mode | ||
might leak private data to a third-party application that does not | ||
|
@@ -508,8 +550,7 @@ | |
when information should be confidential, so forwarding any content | ||
presents a risk. In particular, the {{ShareData/title}} might be | ||
used by an attacker to trick a user into misinterpreting the nature | ||
of the content. | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.