Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tensorboard/backend/http_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ def Respond(
"default-src 'self'",
"font-src %s"
% _create_csp_string("'self'", *_CSP_FONT_DOMAINS_WHITELIST),
"frame-ancestors *",
# Dynamic plugins are rendered inside an iframe.
"frame-src %s"
% _create_csp_string("'self'", *_CSP_FRAME_DOMAINS_WHITELIST),
Expand Down
12 changes: 6 additions & 6 deletions tensorboard/backend/http_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def testCsp(self):
q, "<b>hello</b>", "text/html", csp_scripts_sha256s=["abcdefghi"]
)
expected_csp = (
"default-src 'self';font-src 'self' data:;frame-ancestors *;"
"default-src 'self';font-src 'self' data:;"
"frame-src 'self';img-src 'self' data: blob:;object-src 'none';"
"style-src 'self' https://www.gstatic.com data: 'unsafe-inline';"
"connect-src 'self';script-src 'self' 'unsafe-eval' 'sha256-abcdefghi'"
Expand All @@ -253,7 +253,7 @@ def testCsp_noHash(self):
q, "<b>hello</b>", "text/html", csp_scripts_sha256s=None
)
expected_csp = (
"default-src 'self';font-src 'self' data:;frame-ancestors *;"
"default-src 'self';font-src 'self' data:;"
"frame-src 'self';img-src 'self' data: blob:;object-src 'none';"
"style-src 'self' https://www.gstatic.com data: 'unsafe-inline';"
"connect-src 'self';script-src 'unsafe-eval'"
Expand All @@ -268,7 +268,7 @@ def testCsp_noHash_noUnsafeEval(self):
q, "<b>hello</b>", "text/html", csp_scripts_sha256s=None
)
expected_csp = (
"default-src 'self';font-src 'self' data:;frame-ancestors *;"
"default-src 'self';font-src 'self' data:;"
"frame-src 'self';img-src 'self' data: blob:;object-src 'none';"
"style-src 'self' https://www.gstatic.com data: 'unsafe-inline';"
"connect-src 'self';script-src 'none'"
Expand All @@ -283,7 +283,7 @@ def testCsp_onlySelf(self):
q, "<b>hello</b>", "text/html", csp_scripts_sha256s=None
)
expected_csp = (
"default-src 'self';font-src 'self' data:;frame-ancestors *;"
"default-src 'self';font-src 'self' data:;"
"frame-src 'self';img-src 'self' data: blob:;object-src 'none';"
"style-src 'self' https://www.gstatic.com data: 'unsafe-inline';"
"connect-src 'self';script-src 'self'"
Expand All @@ -297,7 +297,7 @@ def testCsp_disableUnsafeEval(self):
q, "<b>hello</b>", "text/html", csp_scripts_sha256s=["abcdefghi"]
)
expected_csp = (
"default-src 'self';font-src 'self' data:;frame-ancestors *;"
"default-src 'self';font-src 'self' data:;"
"frame-src 'self';img-src 'self' data: blob:;object-src 'none';"
"style-src 'self' https://www.gstatic.com data: 'unsafe-inline';"
"connect-src 'self';script-src 'self' 'sha256-abcdefghi'"
Expand All @@ -324,7 +324,7 @@ def testCsp_globalDomainWhiteList(self):
q, "<b>hello</b>", "text/html", csp_scripts_sha256s=["abcd"]
)
expected_csp = (
"default-src 'self';font-src 'self' data:;frame-ancestors *;"
"default-src 'self';font-src 'self' data:;"
"frame-src 'self' https://myframe.com;"
"img-src 'self' data: blob: https://example.com;"
"object-src 'none';style-src 'self' https://www.gstatic.com data: "
Expand Down
2 changes: 0 additions & 2 deletions tensorboard/backend/security_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
_CSP_DEFAULT_SRC = "default-src"
# Whitelist of allowed CSP violations.
_CSP_IGNORE = {
# Allow TensorBoard to be iframed.
"frame-ancestors": ["*"],
# Polymer-based code uses unsafe-inline.
"style-src": ["'unsafe-inline'", "data:"],
# Used in canvas
Expand Down