Skip to content

Commit 692f7d1

Browse files
committed
CONSOLE-4265: address comments 2
1 parent 5521582 commit 692f7d1

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

console/v1/types_console_plugin.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,21 @@ type ConsolePluginSpec struct {
5050
I18n ConsolePluginI18n `json:"i18n"`
5151
// contentSecurityPolicy is a list of Content Security Policy directives for the plugin.
5252
// Each directive specifies a list of values that indicate server origins and script endpoints
53-
// from which the plugin's assets can be loaded.
54-
// This helps guard against cross-site scripting (XSS) attacks.
55-
// Available directive types are default-src, script-src, img-src, style-src and font-src.
53+
// from which the plugin's assets can be loaded. This helps guard against cross-site
54+
// scripting (XSS) attacks by enforcing strict security policies for asset loading.
55+
// Dynamic plugins should to specify this field if they are loading assets form outside
56+
// the cluster or if violation reports are observed.
57+
// CSP violation reports can be viewed in browser's console during development and testing
58+
// of the plugin in the OpenShift web console.
59+
// Available directives are default-src, script-src, img-src, style-src and font-src.
5660
// Each of the available CSP directive may be defined only once in the list.
61+
// By default the console server adds the value 'self'to all the various 'src' directives.
5762
// For more information about the CSP directives, see:
5863
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
5964
//
6065
// The OpenShift web console server aggregates the CSP directives and values across
61-
// all enabled ConsolePlugin CRs, merging them to set a unified CSP header.
66+
// its own default values and all enabled ConsolePlugin CRs, merging them to set a unified
67+
// CSP header.
6268
//
6369
// Example:
6470
// ConsolePlugin A directives:
@@ -71,9 +77,9 @@ type ConsolePluginSpec struct {
7177
// img-src: https://img1.com/
7278
//
7379
// OpenShift web console server CSP response header:
74-
// script-src: https://script1.com/ https://script2.com/ https://script3.com/
75-
// font-src: https://font1.com/ https://font2.com/
76-
// img-src: https://img1.com/
80+
// script-src: self https://script1.com/ https://script2.com/ https://script3.com/
81+
// font-src: self https://font1.com/ https://font2.com/
82+
// img-src: self https://img1.com/
7783
//
7884
// +kubebuilder:validation:MinItems=1
7985
// +kubebuilder:validation:MaxItems=5
@@ -113,13 +119,13 @@ const (
113119

114120
// ConsolePluginCSP holds configuration for a specific CSP directive
115121
type ConsolePluginCSP struct {
116-
// directive is a type of CSP directive.
122+
// directive specifies which Content-Security-Policy directive to configure.
117123
// Available directive types are default-src, script-src, img-src, style-src and font-src.
118124
// +kubebuilder:validation:Enum:="default-src";"script-src";"img-src";"style-src";"font-src"
119125
// +kubebuilder:validation:Required
120126
Directive DirectiveType `json:"directive"`
121-
// values defines an array of source values mostly specifying server origins
122-
// and script endpoints.
127+
// values defines an array of additional values to append to the console
128+
// defaults for this directive.
123129
// Each ConsolePlugin may define their own directives with their values.
124130
// These will be set by the OpenShift web console's backend, as part of
125131
// its CSP header.

0 commit comments

Comments
 (0)