contentSecurityPolicy is a list of Content-Security-Policy (CSP) directives for the plugin.
Each directive specifies a list of values, appropriate for the given directive type,
for example a list of remote endpoints for fetch directives such as ScriptSrc.
Console web application uses CSP to detect and mitigate certain types of attacks,
such as cross-site scripting (XSS) and data injection attacks.
Dynamic plugins should specify this field if need to load assets from outside
the cluster or if violation reports are observed. Dynamic plugins should always prefer
loading their assets from within the cluster, either by vendoring them, or fetching
from a cluster service.
CSP violation reports can be viewed in the browser’s console logs during development and
testing of the plugin in the OpenShift web console.
Available directive types are DefaultSrc, ScriptSrc, StyleSrc, ImgSrc, FontSrc and ConnectSrc.
Each of the available directives may be defined only once in the list.
The value 'self' is automatically included in all fetch directives by the OpenShift web
console’s backend.
For more information about the CSP directives, see:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
The OpenShift web console server aggregates the CSP directives and values across
its own default values and all enabled ConsolePlugin CRs, merging them into a single
policy string that is sent to the browser via Content-Security-Policy
HTTP response header.
ConsolePlugin B directives:
script-src: https://script2.com/, https://script3.com/
font-src: https://font2.com/
img-src: https://img1.com/
Unified set of CSP directives, passed to the OpenShift web console server:
script-src: https://script1.com/, https://script2.com/, https://script3.com/
font-src: https://font1.com/, https://font2.com/
img-src: https://img1.com/
OpenShift web console server CSP response header:
Content-Security-Policy: default-src 'self'; base-uri 'self'; script-src 'self' https://script1.com/ https://script2.com/ https://script3.com/; font-src 'self' https://font1.com/ https://font2.com/; img-src 'self' https://img1.com/; style-src 'self'; frame-src 'none'; object-src 'none'