@@ -72,6 +72,52 @@ Required::
7272| `object`
7373| backend holds the configuration of backend which is serving console's plugin .
7474
75+ | `contentSecurityPolicy`
76+ | `array`
77+ | contentSecurityPolicy is a list of Content-Security-Policy (CSP) directives for the plugin.
78+ Each directive specifies a list of values, appropriate for the given directive type,
79+ for example a list of remote endpoints for fetch directives such as ScriptSrc.
80+ Console web application uses CSP to detect and mitigate certain types of attacks,
81+ such as cross-site scripting (XSS) and data injection attacks.
82+ Dynamic plugins should specify this field if need to load assets from outside
83+ the cluster or if violation reports are observed. Dynamic plugins should always prefer
84+ loading their assets from within the cluster, either by vendoring them, or fetching
85+ from a cluster service.
86+ CSP violation reports can be viewed in the browser's console logs during development and
87+ testing of the plugin in the OpenShift web console.
88+ Available directive types are DefaultSrc, ScriptSrc, StyleSrc, ImgSrc, FontSrc and ConnectSrc.
89+ Each of the available directives may be defined only once in the list.
90+ The value 'self' is automatically included in all fetch directives by the OpenShift web
91+ console's backend.
92+ For more information about the CSP directives, see:
93+ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
94+
95+ The OpenShift web console server aggregates the CSP directives and values across
96+ its own default values and all enabled ConsolePlugin CRs, merging them into a single
97+ policy string that is sent to the browser via `Content-Security-Policy` HTTP response header.
98+
99+ Example:
100+ ConsolePlugin A directives:
101+ script-src: https://script1.com/, https://script2.com/
102+ font-src: https://font1.com/
103+
104+ ConsolePlugin B directives:
105+ script-src: https://script2.com/, https://script3.com/
106+ font-src: https://font2.com/
107+ img-src: https://img1.com/
108+
109+ Unified set of CSP directives, passed to the OpenShift web console server:
110+ script-src: https://script1.com/, https://script2.com/, https://script3.com/
111+ font-src: https://font1.com/, https://font2.com/
112+ img-src: https://img1.com/
113+
114+ OpenShift web console server CSP response header:
115+ 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'
116+
117+ | `contentSecurityPolicy[]`
118+ | `object`
119+ | ConsolePluginCSP holds configuration for a specific CSP directive
120+
75121| `displayName`
76122| `string`
77123| displayName is the display name of the plugin.
@@ -166,6 +212,111 @@ that contains metadata about the plugin and the extensions.
166212| `integer`
167213| port on which the Service that is serving the plugin is listening to.
168214
215+ |===
216+ === .spec.contentSecurityPolicy
217+ Description::
218+ +
219+ --
220+ contentSecurityPolicy is a list of Content-Security-Policy (CSP) directives for the plugin.
221+ Each directive specifies a list of values, appropriate for the given directive type,
222+ for example a list of remote endpoints for fetch directives such as ScriptSrc.
223+ Console web application uses CSP to detect and mitigate certain types of attacks,
224+ such as cross-site scripting (XSS) and data injection attacks.
225+ Dynamic plugins should specify this field if need to load assets from outside
226+ the cluster or if violation reports are observed. Dynamic plugins should always prefer
227+ loading their assets from within the cluster, either by vendoring them, or fetching
228+ from a cluster service.
229+ CSP violation reports can be viewed in the browser's console logs during development and
230+ testing of the plugin in the OpenShift web console.
231+ Available directive types are DefaultSrc, ScriptSrc, StyleSrc, ImgSrc, FontSrc and ConnectSrc.
232+ Each of the available directives may be defined only once in the list.
233+ The value 'self' is automatically included in all fetch directives by the OpenShift web
234+ console's backend.
235+ For more information about the CSP directives, see:
236+ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
237+
238+ The OpenShift web console server aggregates the CSP directives and values across
239+ its own default values and all enabled ConsolePlugin CRs, merging them into a single
240+ policy string that is sent to the browser via `Content-Security-Policy` HTTP response header.
241+
242+ Example:
243+ ConsolePlugin A directives:
244+ script-src: https://script1.com/, https://script2.com/
245+ font-src: https://font1.com/
246+
247+ ConsolePlugin B directives:
248+ script-src: https://script2.com/, https://script3.com/
249+ font-src: https://font2.com/
250+ img-src: https://img1.com/
251+
252+ Unified set of CSP directives, passed to the OpenShift web console server:
253+ script-src: https://script1.com/, https://script2.com/, https://script3.com/
254+ font-src: https://font1.com/, https://font2.com/
255+ img-src: https://img1.com/
256+
257+ OpenShift web console server CSP response header:
258+ 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'
259+ --
260+
261+ Type::
262+ `array`
263+
264+
265+
266+
267+ === .spec.contentSecurityPolicy[]
268+ Description::
269+ +
270+ --
271+ ConsolePluginCSP holds configuration for a specific CSP directive
272+ --
273+
274+ Type::
275+ `object`
276+
277+ Required::
278+ - `directive`
279+ - `values`
280+
281+
282+
283+ [cols="1,1,1",options="header"]
284+ |===
285+ | Property | Type | Description
286+
287+ | `directive`
288+ | `string`
289+ | directive specifies which Content-Security-Policy directive to configure.
290+ Available directive types are DefaultSrc, ScriptSrc, StyleSrc, ImgSrc, FontSrc and ConnectSrc.
291+ DefaultSrc directive serves as a fallback for the other CSP fetch directives.
292+ For more information about the DefaultSrc directive, see:
293+ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/default-src
294+ ScriptSrc directive specifies valid sources for JavaScript.
295+ For more information about the ScriptSrc directive, see:
296+ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src
297+ StyleSrc directive specifies valid sources for stylesheets.
298+ For more information about the StyleSrc directive, see:
299+ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src
300+ ImgSrc directive specifies a valid sources of images and favicons.
301+ For more information about the ImgSrc directive, see:
302+ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/img-src
303+ FontSrc directive specifies valid sources for fonts loaded using @font-face.
304+ For more information about the FontSrc directive, see:
305+ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/font-src
306+ ConnectSrc directive restricts the URLs which can be loaded using script interfaces.
307+ For more information about the ConnectSrc directive, see:
308+ https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/connect-src
309+
310+ | `values`
311+ | `array (string)`
312+ | values defines an array of values to append to the console defaults for this directive.
313+ Each ConsolePlugin may define their own directives with their values. These will be set
314+ by the OpenShift web console's backend, as part of its Content-Security-Policy header.
315+ The array can contain at most 16 values. Each directive value must have a maximum length
316+ of 1024 characters and must not contain whitespace, commas (,), semicolons (;) or single
317+ quotes ('). The value '*' is not permitted.
318+ Each value in the array must be unique.
319+
169320|===
170321=== .spec.i18n
171322Description::
0 commit comments