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

Add security considerations section #338

Merged
merged 4 commits into from
May 27, 2022
Merged

Conversation

beaufortfrancois
Copy link
Contributor

To address concerns raised by @reillyeon at #335 (comment), I'm adding a security considerations section to the screen brightness explainer.

@anssiko Please have a look

@anssiko anssiko requested a review from rakuco May 23, 2022 14:49
@anssiko
Copy link
Member

anssiko commented May 23, 2022

@beaufortfrancois thanks much!

@rakuco PTAL

Copy link
Member

@reillyeon reillyeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change allows us to remove some of the open questions.

@beaufortfrancois
Copy link
Contributor Author

This change allows us to remove some of the open questions.

Done. Thanks for catching!


- The screen brightness can be controlled only in response to a user gesture to ensure user retain control over their screen brightness. This prevents a situation where a site increases screen brightness every time the system or user overrides it manually.

- If the page visibility becomes hidden after screen brightness has been increased, the screen brightness should be restored automatically.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add that if the brightness change request is denied, it could/should be denied with a generic reason where it isn't possible to necessarily distinguish why the request failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @willmorgan I've actually went further. See my latest patch. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful to know whether the request succeeded or not, but not necessarily why. So we would blanket deny with a NotAllowedError and not go any more granular than that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the requirements to know whether the request succeeded or not?

Thinking out loud: If the screen brightness is already at its maximum and you call await screen.requestBrightnessIncrease() would you expect this to fail even it didn't succeed?

I think having this baked in would help adoption of this feature from a security/privacy perspective.

Copy link
Contributor

@willmorgan willmorgan May 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I think if there's no gesture, battery level is too low, or feature policy is misconfigured (assuming we're doing feature policy!), I'd expect to see something like a NotAllowedError.

If the brightness is already at 100% and we call await screen.requestBrightnessIncrease(), then I'd expect the promise to fulfil. Otherwise, it might be possible to infer the brightness of the screen. If we allowed that to happen it would contradict the intention to prevent reading the screen brightness - reading the screen brightness is a non-goal of this API for privacy reasons anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@willmorgan Thank you! I've updated the explainer with your feedback. PTAL

@beaufortfrancois
Copy link
Contributor Author

Please have another look with latest changes.

Copy link
Contributor

@willmorgan willmorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I'm not sure if we should consider here any interplay with the multi screen / window placement API, as that may be relevant when it comes to releasing the request. I think it might be better to address those points in more detail when there is an agreed API surface choice. What do you think @anssiko?

@anssiko
Copy link
Member

anssiko commented May 26, 2022

@willmorgan I think that is worth noting in the explainer. And latest when the API is more fleshed out any hooks that may be needed for https://github.com/w3c/window-placement should be brought to the attention of folks working on that API by opening a new issue for a future enhancement.

@beaufortfrancois
Copy link
Contributor Author

@anssiko Shall we merge? What are the next steps?

@anssiko
Copy link
Member

anssiko commented May 27, 2022

Thanks @beaufortfrancois @willmorgan.

With two reviews I think we’re good to merge this. I’m sure @rakuco is happy too and if he has further refinements we’ll get them in as we iterate.

As for the next steps for the proposal overall, we’re at #335 (comment)

@anssiko anssiko merged commit 9a01842 into w3c:gh-pages May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants