Skip to content

Commit

Permalink
Replace CSP plugin-types directive with object-src
Browse files Browse the repository at this point in the history
The HTTP Content-Security-Policy (CSP) plugin-types directive has been
removed from the specification and is not supported by most browsers.
Chrome browser suggests to specify "object-src 'none'" instead to block
plugins, so replace it with that directive.

Refer w3c/webappsec-csp#394 for details about
this change.

Tested:
* In Chrome 99.0.4844.74, it no longer gives errors about CSP
  plugin-types directive.
* Checked neiter <embed>, <object> or <applet> tags are used in eiter
  phosphor-webui or webui-vue.
* Using webui-vue, KVM and SOL Console works.

Change-Id: I79d7ed1de2c4d204bf040e7b32a7b6afe354862c
Signed-off-by: Jiaqing Zhao <[email protected]>
  • Loading branch information
jiaqingz-intel committed Mar 21, 2022
1 parent 80badf7 commit 91ac2e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/security_headers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ inline void addSecurityHeaders(const crow::Request& req [[maybe_unused]],
"connect-src 'self' wss:; "
"form-action 'none'; "
"frame-ancestors 'none'; "
"plugin-types 'none'; "
"object-src 'none'; "
"base-uri 'none' ");
// The KVM currently needs to load images from base64 encoded
// strings. img-src 'self' data: is used to allow that.
Expand All @@ -54,7 +54,7 @@ inline void addSecurityHeaders(const crow::Request& req [[maybe_unused]],
"connect-src *; "
"form-action *; "
"frame-ancestors *; "
"plugin-types *; "
"object-src *; "
"base-uri *");

const std::string_view origin = req.getHeaderValue("Origin");
Expand Down

0 comments on commit 91ac2e5

Please sign in to comment.