File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ Yii2 integration of Content Security Policy Header
105
105
106
106
Possible integrations
107
107
----------------
108
- CSP can work by ** signature** or by ** token** ( * nonce * )
108
+ CSP can work by ** signature** or by the ** nonce token**
109
109
see:
110
110
111
111
@@ -121,7 +121,7 @@ Example:
121
121
This kind of integration does not require patch to the framework code but it's space wasting and hard to mantain
122
122
even with a small number of signatures.
123
123
124
- Integration by token ( nonce)
124
+ Integration by nonce token
125
125
----------------
126
126
This kind of integration require some (small) patch at framework (\yii\helpers\BaseHtml) level to take full advantage of nonce token.
127
127
The nonce feature (enabled by default) don't need maintenace once integrated and has reduced footprint on the header
@@ -239,6 +239,16 @@ In detail the line:
239
239
echo ' <script ' .Yii :: $app- > response- > getContentSecurityPolicyTokenAttribute ().' >' . $view - > renderPhpFile (__DIR__ . ' /assets/toolbar.js' ) . ' </script>' ;
240
240
241
241
` ` `
242
+ Runtime disabilitation
243
+ ----------------
244
+ Since no header is sent until the ` ` ` render` ` ` call it's possible to disable one or more modules as needed.
245
+
246
+ ` ` ` php
247
+ public function actionIndex () {
248
+ Yii:: $app- > getResponse ()- > modules[' sample-module' ]- > enabled= false ;
249
+ return $this- > render (" index" );
250
+ }
251
+ ` ` `
242
252
243
253
244
254
You can’t perform that action at this time.
0 commit comments