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

Set CSP frame-ancestors 'self' for nbgrader handlers #1915

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

Conversation

jeflem
Copy link

@jeflem jeflem commented Aug 26, 2024

This PR solves issue #1870 (formgrader does not show in JupyerLab tab due to JupyterHub >=4.1.0 security settings in HTTP headers).

Starting with JupyterHub 4.1.0 HTTP header

Content-Security-Policy:  frame-ancestors 'none'

is the default setting instead of

Content-Security-Policy: frame-ancestors 'self'

See Mitigating same-origin deployments for some background on this decision and CSP: frame-ancestors for details on the header.

The none header prevents loading of formgrader in a tab of JupyterLab.

The JupyterHub none setting overwrites the self setting of Jupyter Server running without JupyterHub. See

To allow embedding of nbgrader's formgrader (and possibly other nbgrader components) without affecting security of other JupyterHub components this PR sets frame-ancestors to self for responses of nbgrader handlers only.

The class BaseHandler modified by this PR is a subclass of tornado.web.RequestHandler, which provides the set_header method.

Copy link
Contributor

Binder 👈 Launch a Binder on branch jeflem/nbgrader/formgrader_jhub41

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.

1 participant