Skip to content

Commit e3a1709

Browse files
authored
Security changes from upstream 2.4.8-p3 (#171)
* Security changes from upstream 2.4.8-p3 * Remove tiny_mce_6 files (replaced by hugerte)
1 parent 00300f8 commit e3a1709

File tree

477 files changed

+128766
-1861
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

477 files changed

+128766
-1861
lines changed

app/code/Magento/Amqp/Setup/ConfigOptionsList.php

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2018 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Amqp\Setup;
77

8+
use Magento\Framework\App\DeploymentConfig;
89
use Magento\Framework\Config\Data\ConfigData;
910
use Magento\Framework\Config\File\ConfigFilePool;
1011
use Magento\Framework\Setup\ConfigOptionsListInterface;
1112
use Magento\Framework\Setup\Option\TextConfigOption;
12-
use Magento\Framework\App\DeploymentConfig;
1313

1414
/**
1515
* Deployment configuration options needed for Setup application
@@ -19,34 +19,35 @@ class ConfigOptionsList implements ConfigOptionsListInterface
1919
/**
2020
* Input key for the options
2121
*/
22-
const INPUT_KEY_QUEUE_AMQP_HOST = 'amqp-host';
23-
const INPUT_KEY_QUEUE_AMQP_PORT = 'amqp-port';
24-
const INPUT_KEY_QUEUE_AMQP_USER = 'amqp-user';
25-
const INPUT_KEY_QUEUE_AMQP_PASSWORD = 'amqp-password';
26-
const INPUT_KEY_QUEUE_AMQP_VIRTUAL_HOST = 'amqp-virtualhost';
27-
const INPUT_KEY_QUEUE_AMQP_SSL = 'amqp-ssl';
28-
const INPUT_KEY_QUEUE_AMQP_SSL_OPTIONS = 'amqp-ssl-options';
22+
public const INPUT_KEY_QUEUE_AMQP_HOST = 'amqp-host';
23+
public const INPUT_KEY_QUEUE_AMQP_PORT = 'amqp-port';
24+
public const INPUT_KEY_QUEUE_AMQP_USER = 'amqp-user';
25+
public const INPUT_KEY_QUEUE_AMQP_PASSWORD = 'amqp-password';
26+
public const INPUT_KEY_QUEUE_AMQP_VIRTUAL_HOST = 'amqp-virtualhost';
27+
public const INPUT_KEY_QUEUE_AMQP_SSL = 'amqp-ssl';
28+
public const INPUT_KEY_QUEUE_AMQP_SSL_OPTIONS = 'amqp-ssl-options';
29+
public const INPUT_KEY_QUEUE_DEFAULT_CONNECTION ='queue-default-connection';
2930

3031
/**
3132
* Path to the values in the deployment config
3233
*/
33-
const CONFIG_PATH_QUEUE_AMQP_HOST = 'queue/amqp/host';
34-
const CONFIG_PATH_QUEUE_AMQP_PORT = 'queue/amqp/port';
35-
const CONFIG_PATH_QUEUE_AMQP_USER = 'queue/amqp/user';
36-
const CONFIG_PATH_QUEUE_AMQP_PASSWORD = 'queue/amqp/password';
37-
const CONFIG_PATH_QUEUE_AMQP_VIRTUAL_HOST = 'queue/amqp/virtualhost';
38-
const CONFIG_PATH_QUEUE_AMQP_SSL = 'queue/amqp/ssl';
39-
const CONFIG_PATH_QUEUE_AMQP_SSL_OPTIONS = 'queue/amqp/ssl_options';
34+
public const CONFIG_PATH_QUEUE_AMQP_HOST = 'queue/amqp/host';
35+
public const CONFIG_PATH_QUEUE_AMQP_PORT = 'queue/amqp/port';
36+
public const CONFIG_PATH_QUEUE_AMQP_USER = 'queue/amqp/user';
37+
public const CONFIG_PATH_QUEUE_AMQP_PASSWORD = 'queue/amqp/password';
38+
public const CONFIG_PATH_QUEUE_AMQP_VIRTUAL_HOST = 'queue/amqp/virtualhost';
39+
public const CONFIG_PATH_QUEUE_AMQP_SSL = 'queue/amqp/ssl';
40+
public const CONFIG_PATH_QUEUE_AMQP_SSL_OPTIONS = 'queue/amqp/ssl_options';
4041

4142
/**
4243
* Default values
4344
*/
44-
const DEFAULT_AMQP_HOST = '';
45-
const DEFAULT_AMQP_PORT = '5672';
46-
const DEFAULT_AMQP_USER = '';
47-
const DEFAULT_AMQP_PASSWORD = '';
48-
const DEFAULT_AMQP_VIRTUAL_HOST = '/';
49-
const DEFAULT_AMQP_SSL = '';
45+
public const DEFAULT_AMQP_HOST = '';
46+
public const DEFAULT_AMQP_PORT = '5672';
47+
public const DEFAULT_AMQP_USER = '';
48+
public const DEFAULT_AMQP_PASSWORD = '';
49+
public const DEFAULT_AMQP_VIRTUAL_HOST = '/';
50+
public const DEFAULT_AMQP_SSL = '';
5051

5152
/**
5253
* @var ConnectionValidator
@@ -64,7 +65,7 @@ public function __construct(ConnectionValidator $connectionValidator)
6465
}
6566

6667
/**
67-
* {@inheritdoc}
68+
* @inheritdoc
6869
*/
6970
public function getOptions()
7071
{
@@ -122,7 +123,7 @@ public function getOptions()
122123
}
123124

124125
/**
125-
* {@inheritdoc}
126+
* @inheritdoc
126127
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
127128
*/
128129
public function createConfig(array $data, DeploymentConfig $deploymentConfig)
@@ -170,7 +171,7 @@ public function createConfig(array $data, DeploymentConfig $deploymentConfig)
170171
}
171172

172173
/**
173-
* {@inheritdoc}
174+
* @inheritdoc
174175
*/
175176
public function validate(array $options, DeploymentConfig $deploymentConfig)
176177
{
@@ -205,6 +206,11 @@ public function validate(array $options, DeploymentConfig $deploymentConfig)
205206
if (!$result) {
206207
$errors[] = "Could not connect to the Amqp Server.";
207208
}
209+
210+
if (isset($options[self::INPUT_KEY_QUEUE_DEFAULT_CONNECTION])
211+
&& $options[self::INPUT_KEY_QUEUE_DEFAULT_CONNECTION] !== 'amqp') {
212+
$errors = [];
213+
}
208214
}
209215

210216
return $errors;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2022 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/publisher.xsd">
9-
<publisher topic="async_config.saveConfig"/>
9+
<publisher topic="async_config.saveConfig" queue="saveConfig"/>
1010
</config>

app/code/Magento/AsynchronousOperations/Model/MassConsumer.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2018 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

88
namespace Magento\AsynchronousOperations\Model;
99

10+
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\MessageQueue\CallbackInvokerInterface;
12+
use Magento\Framework\MessageQueue\Consumer\ConfigInterface as ConsumerConfig;
1113
use Magento\Framework\MessageQueue\ConsumerConfigurationInterface;
1214
use Magento\Framework\MessageQueue\ConsumerInterface;
1315
use Magento\Framework\MessageQueue\EnvelopeInterface;
@@ -41,24 +43,32 @@ class MassConsumer implements ConsumerInterface
4143
*/
4244
private $registry;
4345

46+
/**
47+
* @var ConsumerConfig
48+
*/
49+
private $consumerConfig;
50+
4451
/**
4552
* Initialize dependencies.
4653
*
4754
* @param CallbackInvokerInterface $invoker
4855
* @param ConsumerConfigurationInterface $configuration
4956
* @param MassConsumerEnvelopeCallbackFactory $massConsumerEnvelopeCallback
5057
* @param Registry $registry
58+
* @param ConsumerConfig|null $consumerConfig
5159
*/
5260
public function __construct(
5361
CallbackInvokerInterface $invoker,
5462
ConsumerConfigurationInterface $configuration,
5563
MassConsumerEnvelopeCallbackFactory $massConsumerEnvelopeCallback,
56-
Registry $registry
64+
Registry $registry,
65+
?ConsumerConfig $consumerConfig = null
5766
) {
5867
$this->invoker = $invoker;
5968
$this->configuration = $configuration;
6069
$this->massConsumerEnvelopeCallback = $massConsumerEnvelopeCallback;
6170
$this->registry = $registry;
71+
$this->consumerConfig = $consumerConfig ?: ObjectManager::getInstance()->get(ConsumerConfig::class);
6272
}
6373

6474
/**

app/code/Magento/Backend/Block/Cache.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2011 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Backend\Block;
77

@@ -35,7 +35,11 @@ protected function _construct()
3535
}
3636

3737
if ($this->_authorization->isAllowed('Magento_Backend::flush_cache_storage')) {
38-
$message = __('The cache storage may contain additional data. Are you sure that you want to flush it?');
38+
$message = $this->escapeJs(
39+
$this->escapeHtml(
40+
__('The cache storage may contain additional data. Are you sure that you want to flush it?')
41+
)
42+
);
3943
$this->buttonList->add(
4044
'flush_system',
4145
[

app/code/Magento/Backend/Block/System/Design/Edit.php

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2011 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Backend\Block\System\Design;
77

8+
use Magento\Framework\Escaper;
9+
use Magento\Framework\App\ObjectManager;
10+
811
/**
912
* Edit store design schedule block.
1013
*/
@@ -16,25 +19,35 @@ class Edit extends \Magento\Backend\Block\Widget
1619
protected $_template = 'Magento_Backend::system/design/edit.phtml';
1720

1821
/**
19-
* Core registry
22+
* Application data storage
2023
*
2124
* @var \Magento\Framework\Registry
2225
*/
2326
protected $_coreRegistry = null;
2427

28+
/**
29+
* Escaper for secure output rendering
30+
*
31+
* @var Escaper
32+
*/
33+
protected $escaper;
34+
2535
/**
2636
* @inheritdoc
2737
*
2838
* @param \Magento\Backend\Block\Template\Context $context
2939
* @param \Magento\Framework\Registry $registry
3040
* @param array $data
41+
* @param Escaper|null $escaper
3142
*/
3243
public function __construct(
3344
\Magento\Backend\Block\Template\Context $context,
3445
\Magento\Framework\Registry $registry,
35-
array $data = []
46+
array $data = [],
47+
?Escaper $escaper = null
3648
) {
3749
$this->_coreRegistry = $registry;
50+
$this->escaper = $escaper ?? ObjectManager::getInstance()->get(Escaper::class);
3851
parent::__construct($context, $data);
3952
}
4053

@@ -66,14 +79,17 @@ protected function _prepareLayout()
6679
);
6780

6881
if ($this->getDesignChangeId()) {
82+
$confirmMessage = $this->escaper->escapeJs(
83+
$this->escaper->escapeHtml(__('Are you sure?'))
84+
);
85+
$deleteOnClick = 'deleteConfirm(\'' . $confirmMessage . '\', \'' .
86+
$this->getDeleteUrl() . '\', {data: {}})';
6987
$this->getToolbar()->addChild(
7088
'delete_button',
7189
\Magento\Backend\Block\Widget\Button::class,
7290
[
7391
'label' => __('Delete'),
74-
'onclick' => 'deleteConfirm(\'' . __(
75-
'Are you sure?'
76-
) . '\', \'' . $this->getDeleteUrl() . '\', {data: {}})',
92+
'onclick' => $deleteOnClick,
7793
'class' => 'delete'
7894
]
7995
);

app/code/Magento/Backend/Block/Widget/Form/Container.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2011 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Backend\Block\Widget\Form;
77

@@ -13,8 +13,8 @@
1313
* Backend form container block
1414
*
1515
* @api
16-
* @deprecated 100.2.0 in favour of UI component implementation
17-
* @SuppressWarnings(PHPMD.NumberOfChildren)
16+
* @deprecated 100.2.0 Use UI components for form rendering instead of this legacy form container
17+
* @see \Magento\Ui\Component\Form
1818
* @since 100.0.2
1919
*/
2020
class Container extends \Magento\Backend\Block\Widget\Container
@@ -45,14 +45,14 @@ class Container extends \Magento\Backend\Block\Widget\Container
4545
protected $_blockGroup = 'Magento_Backend';
4646

4747
/**
48-
* @var string
48+
* @var string
4949
*/
50-
const PARAM_BLOCK_GROUP = 'block_group';
50+
public const PARAM_BLOCK_GROUP = 'block_group';
5151

5252
/**
53-
* @var string
53+
* @var string
5454
*/
55-
const PARAM_MODE = 'mode';
55+
public const PARAM_MODE = 'mode';
5656

5757
/**
5858
* @var string
@@ -111,14 +111,17 @@ protected function _construct()
111111
$objId = (int)$this->getRequest()->getParam($this->_objectId);
112112

113113
if (!empty($objId)) {
114+
$confirmMessage = $this->escapeJs(
115+
$this->escapeHtml(__('Are you sure you want to do this?'))
116+
);
117+
$deleteOnClick = 'deleteConfirm(\'' . $confirmMessage . '\', \'' .
118+
$this->getDeleteUrl() . '\', {data: {}})';
114119
$this->addButton(
115120
'delete',
116121
[
117122
'label' => __('Delete'),
118123
'class' => 'delete',
119-
'onclick' => 'deleteConfirm(\'' . __(
120-
'Are you sure you want to do this?'
121-
) . '\', \'' . $this->getDeleteUrl() . '\', {data: {}})'
124+
'onclick' => $deleteOnClick
122125
]
123126
);
124127
}

0 commit comments

Comments
 (0)