Skip to content

Commit

Permalink
Set CSP frame-ancestors 'self' for nbgrader handlers (#1915)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Brichet <nicolas.brichet@quantstack.net>
  • Loading branch information
jeflem and brichet authored Nov 15, 2024
1 parent 0eaa4d5 commit ba1e70b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nbgrader/server_extensions/formgrader/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def api(self):
api.log_level = level
return api

def initialize(self):
super().initialize()
self.set_header("Content-Security-Policy", "frame-ancestors 'self'")

def render(self, name, **ns):
template = self.settings['nbgrader_jinja2_env'].get_template(name)
return template.render(**ns)
Expand Down

0 comments on commit ba1e70b

Please sign in to comment.