Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
96dff68
wip
empiricompany Apr 23, 2025
9b27a60
remove config_csp
empiricompany Apr 23, 2025
9a48276
docs: add workaround for prototypeJS bug with disabled inputs in arra…
empiricompany Apr 23, 2025
5789fa2
allowing for specific directive handling admin / frontend
empiricompany Apr 24, 2025
e9cb09a
fix: serialized backend xml load default
empiricompany Apr 24, 2025
2373a84
Add Content Security Policy (CSP) support directives global, adminhtm…
empiricompany Apr 24, 2025
ff834f2
feat: add report-uri support
empiricompany Apr 24, 2025
fc47226
system config admin only global
empiricompany Apr 24, 2025
d8ff1bc
fix: phpcs
empiricompany Apr 24, 2025
83616f5
make $_arrayRowsCache protected: used by public getArrayRows()
empiricompany Apr 24, 2025
69e6844
feat: add area config info to inputs
empiricompany Apr 25, 2025
81b4c44
chroe: phpstan ignore
empiricompany Apr 25, 2025
be8a64c
chore: phpstan ignore
empiricompany Apr 25, 2025
1b15677
chore: rector
empiricompany Apr 25, 2025
e9490c5
chore
empiricompany Apr 25, 2025
9baf274
chore
empiricompany Apr 25, 2025
6c5fae0
use Reporting-Endpoints for report URI
empiricompany Apr 25, 2025
904e782
trim report uri
empiricompany Apr 25, 2025
b56c732
report uri not dependent fro report_only mode
empiricompany Apr 25, 2025
9a9cb23
add support for <meta> directives
empiricompany Apr 25, 2025
970c2e1
Apply @sreichel suggestions: improve method docs and type hints
empiricompany Apr 27, 2025
da96802
fix suggestion
empiricompany Apr 27, 2025
b9d0c28
fix suggestion
empiricompany Apr 27, 2025
06f3704
docs and type hints
empiricompany Apr 27, 2025
5f52bab
Merge branch 'main' into Mage_Csp
empiricompany Apr 27, 2025
ba5f5f9
Merge branch 'main' into Mage_Csp
empiricompany Apr 28, 2025
1c603ae
Merge branch 'main' into Mage_Csp
empiricompany Apr 30, 2025
60f964d
Merge branch 'main' into Mage_Csp
sreichel May 6, 2025
581ff4c
Merge branch 'main' into Mage_Csp
empiricompany May 8, 2025
9b8a833
feat: add support to split headers for each directive
empiricompany May 8, 2025
15942e7
Merge branch 'Mage_Csp' of https://github.com/empiricompany/openmage …
empiricompany May 8, 2025
4de6d40
fix: disable split headers in frontend CSP configuration by default
empiricompany May 8, 2025
243042a
php-cs-fixer
empiricompany May 8, 2025
6db3a01
Unify Csp Hosts
Hanmac May 8, 2025
eb2be42
~ check CS Fixer
Hanmac May 8, 2025
b17aba6
~ fix abtract
Hanmac May 8, 2025
5b7fbb9
refactor: extract node path parsing logic into a separate method
empiricompany May 8, 2025
e6599ba
fix: remove unnecessary whitespace in _parseNodePath method
empiricompany May 8, 2025
3e28c94
refactor: use short array syntax for node path extraction
empiricompany May 8, 2025
1cc35b2
~ use config path instead of NodePath
Hanmac May 8, 2025
ba487dc
refactor: update CSP classes and methods for improved structure and c…
empiricompany May 9, 2025
1876e80
refactor: remove unused renderer logic in _renderCellTemplate method
empiricompany May 9, 2025
f33f2f6
feat: add support for merging CSP <meta /> directives into HTTP headers
empiricompany May 9, 2025
80f117c
docs: fix correct return type annotation in getDirectives method
empiricompany May 9, 2025
0869014
Update app/code/core/Mage/Csp/Model/Observer/Abstract.php
empiricompany May 10, 2025
c9d7291
Merge branch 'main' into Mage_Csp
empiricompany May 10, 2025
2a5700f
Merge branch 'Mage_Csp' into Mage_Csp
empiricompany May 10, 2025
884a714
Merge pull request #2 from Hanmac/Mage_Csp
empiricompany May 10, 2025
f3ee438
Merge branch 'main' into Mage_Csp
empiricompany May 13, 2025
6572040
Merge branch 'main' into Mage_Csp
empiricompany Jun 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .phpstan.dist.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7008,6 +7008,30 @@ parameters:
count: 1
path: app/design/adminhtml/default/default/template/system/config/form/field/array.phtml

-
message: '#^Access to protected property Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Hosts\:\:\$_addAfter\.$#'
identifier: property.protected
count: 4
path: app/design/adminhtml/default/default/template/system/config/form/field/csp.phtml

-
message: '#^Access to protected property Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Hosts\:\:\$_addButtonLabel\.$#'
identifier: property.protected
count: 2
path: app/design/adminhtml/default/default/template/system/config/form/field/csp.phtml

-
message: '#^Access to protected property Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Hosts\:\:\$_columns\.$#'
identifier: property.protected
count: 5
path: app/design/adminhtml/default/default/template/system/config/form/field/csp.phtml

-
message: '#^Call to protected method _renderCellTemplate\(\) of class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Hosts\.$#'
identifier: method.protected
count: 2
path: app/design/adminhtml/default/default/template/system/config/form/field/csp.phtml

-
message: '#^Unreachable statement \- code above always terminates\.$#'
identifier: deadCode.unreachable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ abstract class Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract exte
*
* @var array|null
*/
private $_arrayRowsCache;
protected $_arrayRowsCache;

/**
* Indication whether block is prepared to render or no
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* connect-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Admin_Connectsrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Connectsrc
{
protected $_area = Mage_Core_Model_App_Area::AREA_ADMINHTML;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* default-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Admin_Defaultsrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Defaultsrc
{
protected $_area = Mage_Core_Model_App_Area::AREA_ADMINHTML;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* font-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Admin_Fontsrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Fontsrc
{
protected $_area = Mage_Core_Model_App_Area::AREA_ADMINHTML;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* form-action hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Admin_Formaction extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Formaction
{
protected $_area = Mage_Core_Model_App_Area::AREA_ADMINHTML;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* frame-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Admin_Framesrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Framesrc
{
protected $_area = Mage_Core_Model_App_Area::AREA_ADMINHTML;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* img-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Admin_Imgsrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Imgsrc
{
protected $_area = Mage_Core_Model_App_Area::AREA_ADMINHTML;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* media-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Admin_Mediasrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Mediasrc
{
protected $_area = Mage_Core_Model_App_Area::AREA_ADMINHTML;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* object-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Admin_Objectsrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Objectsrc
{
protected $_area = Mage_Core_Model_App_Area::AREA_ADMINHTML;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* Script-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Admin_Scriptsrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Scriptsrc
{
protected $_area = Mage_Core_Model_App_Area::AREA_ADMINHTML;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* style-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Admin_Stylesrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Stylesrc
{
protected $_area = Mage_Core_Model_App_Area::AREA_ADMINHTML;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* connect-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Connectsrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Hosts
{
/**
* Directive name
*
* @var string
*/
protected $_directiveName = 'connect-src';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* default-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Defaultsrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Hosts
{
/**
* Directive name
*
* @var string
*/
protected $_directiveName = 'default-src';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Csp
* @copyright Copyright (c) 2025 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/

/**
* font-src hosts field renderer
*/
class Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Fontsrc extends Mage_Adminhtml_Block_System_Config_Form_Field_Csp_Hosts
{
/**
* Directive name
*
* @var string
*/
protected $_directiveName = 'font-src';
}
Loading
Loading