Skip to content

Commit 88c27ea

Browse files
committed
fix CSP with data: URLs
1 parent 5f8f546 commit 88c27ea

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## CHANGELOG
22

3+
### [24.6.1] - Jun 20, 2024
4+
- Updated `Content-Security-Policy` to explicitly allow `data:` scheme for `img-src` as `*` doesn't permit it
5+
36
### [24.6.0] - Jun 20, 2024
47
- Added an actual CHANGELOG.md instead of relying on GitHub Release history
58
- The `Content-Security-Policy` header is now set as a HTTP response header and uses a standard value for all pages
@@ -309,6 +312,7 @@
309312
### 21.11.0 - Nov 29, 2021
310313
- Initial release
311314

315+
[24.6.1]: https://github.com/cmason3/jinjafx_server/compare/24.6.0...24.6.1
312316
[24.6.0]: https://github.com/cmason3/jinjafx_server/compare/24.5.0...24.6.0
313317
[24.5.0]: https://github.com/cmason3/jinjafx_server/compare/24.3.0...24.5.0
314318
[24.3.0]: https://github.com/cmason3/jinjafx_server/compare/24.1.1...24.3.0

jinjafx_server.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import re, argparse, hashlib, traceback, glob, hmac, uuid, struct, binascii, gzip, requests, ctypes, subprocess
2929
import cmarkgfm, emoji
3030

31-
__version__ = '24.6.0'
31+
__version__ = '24.6.1'
3232

3333
llock = threading.RLock()
3434
rlock = threading.RLock()
@@ -415,9 +415,8 @@ def do_GET(self, head=False, cache=True, versioned=False):
415415

416416
elif r[1] == 200 or r[1] == 304:
417417
if r[1] == 200:
418-
# self.send_header('Content-Security-Policy', "frame-ancestors 'none'")
419418
self.send_header('X-Content-Type-Options', 'nosniff')
420-
self.send_header('Content-Security-Policy', "default-src 'self'; style-src 'self' https://cdnjs.cloudflare.com 'unsafe-inline'; script-src 'self' https://cdnjs.cloudflare.com; img-src *; frame-ancestors 'none'")
419+
self.send_header('Content-Security-Policy', "default-src 'self'; style-src 'self' https://cdnjs.cloudflare.com 'unsafe-inline'; script-src 'self' https://cdnjs.cloudflare.com; img-src data: *; frame-ancestors 'none'")
421420
self.send_header('Referrer-Policy', 'strict-origin-when-cross-origin')
422421

423422
self.send_header('Cache-Control', 'max-age=0, must-revalidate')

0 commit comments

Comments
 (0)