aboutsummaryrefslogtreecommitdiff
blob: 055685f8e9ce020131470ad56b2c74dbf9e18158 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Upstream patch to fix
"Maliciously crafted text files in IPython/Jupyter editor".

http://seclists.org/oss-sec/2015/q3/558
https://bugs.gentoo.org/show_bug.cgi?id=560708


From 6ec427b5234bfc6c97065f130f762aee8ee67df4 Mon Sep 17 00:00:00 2001
From: Min RK <benjaminrk@gmail.com>
Date: Mon, 20 Jul 2015 12:10:10 -0700
Subject: [PATCH 1/4] set mime-type on /files/

---
 notebook/files/handlers.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/notebook/files/handlers.py b/notebook/files/handlers.py
index def3ec6..9d27261 100644
--- a/notebook/files/handlers.py
+++ b/notebook/files/handlers.py
@@ -40,6 +40,11 @@ class FilesHandler(IPythonHandler):
             cur_mime = mimetypes.guess_type(name)[0]
             if cur_mime is not None:
                 self.set_header('Content-Type', cur_mime)
+            else:
+                if model['format'] == 'base64':
+                    self.set_header('Content-Type', 'application/octet-stream')
+                else:
+                    self.set_header('Content-Type', 'text/plain')
         
         if model['format'] == 'base64':
             b64_bytes = model['content'].encode('ascii')
-- 
2.4.6