File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -650,14 +650,21 @@ def content_security_policy(self):
650650 return super (AuthenticatedFileHandler , self ).content_security_policy + \
651651 "; sandbox allow-scripts"
652652
653+ @web .authenticated
654+ def head (self , path ):
655+ self .check_xsrf_cookie ()
656+ return super (AuthenticatedFileHandler , self ).head (path )
657+
653658 @web .authenticated
654659 def get (self , path ):
660+ self .check_xsrf_cookie ()
661+
655662 if os .path .splitext (path )[1 ] == '.ipynb' or self .get_argument ("download" , False ):
656663 name = path .rsplit ('/' , 1 )[- 1 ]
657664 self .set_attachment_header (name )
658665
659666 return web .StaticFileHandler .get (self , path )
660-
667+
661668 def get_content_type (self ):
662669 path = self .absolute_path .strip ('/' )
663670 if '/' in path :
Original file line number Diff line number Diff line change @@ -31,10 +31,13 @@ def content_security_policy(self):
3131
3232 @web .authenticated
3333 def head (self , path ):
34- self .get (path , include_body = False )
34+ self .check_xsrf_cookie ()
35+ return self .get (path , include_body = False )
3536
3637 @web .authenticated
3738 def get (self , path , include_body = True ):
39+ # /files/ requests must originate from the same site
40+ self .check_xsrf_cookie ()
3841 cm = self .contents_manager
3942
4043 if cm .is_hidden (path ) and not cm .allow_hidden :
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ class NbconvertRootHandler(APIHandler):
99
1010 @web .authenticated
1111 def get (self ):
12+ self .check_xsrf_cookie ()
1213 try :
1314 from nbconvert .exporters import base
1415 except ImportError as e :
You can’t perform that action at this time.
0 commit comments