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

Javascript doesn't have access to camera, sensors etc. any more #2975

Open
joemarshall opened this issue Nov 13, 2020 · 0 comments
Open

Javascript doesn't have access to camera, sensors etc. any more #2975

joemarshall opened this issue Nov 13, 2020 · 0 comments

Comments

@joemarshall
Copy link

I'm running on the current notebook server at alpha.iodide.io

What I Did

Try accessing the accelerometer in javascript (or camera etc.)

What I Expected

It to work

What Happened

Exception due to feature policy

SecurityError: Failed to construct 'Accelerometer': Access to sensor features is disallowed by feature policy
[eval] (cell:2:11)

(if applicable) notebook that reproduces bug

https://alpha.iodide.io/notebooks/6529/

Reason is because of this code in iodide/server/notebooks/templates/notebook.html

note the 'allow' attribute.

<iframe
  id="eval-frame"
  src="{{ iframe_src|safe }}"
  sandbox="allow-scripts allow-same-origin allow-modals allow-popups allow-popups-to-escape-sandbox"
  allowfullscreen="true"
  allowvr="yes"
  allow="microphone"

It would be really nice if it had a way of adding things to the allow attribute somehow in notebooks. As an aside, this breaks the old example notebook for webcam access also https://alpha.iodide.io/notebooks/1478/

For camera, there's no real reason not to allow access to the camera as default, because browsers already ask for that permission when you use it. On the other hand, with the others I guess there's a need for some kind of UI to allow people to ask for extra permissions and/or to warn people that a notebook uses them when you first run it or open it.

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

No branches or pull requests

1 participant