Skip to content
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

Report feature policy violations #138

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

clelland
Copy link
Contributor

@clelland clelland commented Sep 13, 2018

This adds support for reporting violations of the fullscreen feature policy, which should only be triggered when a script actually tries to enter fullscreen in a document where that is not allowed. (Checking fullscreenEnabled, for instance, also involves a feature policy check, but would not trigger a violation report)


Preview | Diff

@annevk
Copy link
Member

annevk commented Sep 13, 2018

This only reports if the second check fails, but presumably it should also report when the first check fails?

Could we bake reporting into "allowed to use" and suppress it the few times it should not happen? That might make it less likely to be overlooked.

@foolip
Copy link
Member

foolip commented Sep 14, 2018

It seems best to only create reports when it the error was because of a policy violation. Doing that in https://html.spec.whatwg.org/multipage/iframe-embed-object.html#allowed-to-use makes sense to me too.

@clelland
Copy link
Contributor Author

I think there may be cases where the call to 'allowed-to-use' and the actual determination of a policy violation are separated in the spec algorithms. For those cases, are we still going to need to have a separate "report a violation now" entry point, or is it okay to just call allowed-to-use again? -- We could mention somewhere that allowed-to-use should be idempotent, so the result of the first call can be cached.

@annevk
Copy link
Member

annevk commented Sep 17, 2018

I guess doing a survey of sorts across callers would be good, to find out the best API contract with the least amount of hassle for callers.

@foolip
Copy link
Member

foolip commented Sep 17, 2018

@clelland how will you implement this? Will the checking and the reporting be entirely separate, will there be a flag to the check that says whether to report, or something else? Unless it's convoluted by implementation details that don't matter at the spec level, a similar structure in the spec might make sense.

@clelland
Copy link
Contributor Author

The current implementation in Chrome has an IsFeatureEnabled() method which takes a bool that determines whether to report immediately on failure or not. There's also a separate ReportFeaturePolicyViolation method that can be called on its own if that's needed. Then it's up to the call sites for each feature to decide whether a failure is a reportable violation or not.

@annevk
Copy link
Member

annevk commented Sep 17, 2018

Sounds like the spec should match that pattern, provided it works well for the call sites.

@foolip
Copy link
Member

foolip commented Sep 18, 2018

Sounds like a reasonable structure, yeah. @clelland, in this case, would the reporting be implicit or explicit? Seems to me given the structure that making it implicit in the check is the way to make sure a violation is only reported when that's the real reason fullscreen failed?

Base automatically changed from master to main January 15, 2021 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants