Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 65cf42c

Browse files
author
magento packaging service
committedFeb 7, 2025
Magento Release 2.4.6-p9
1 parent fc35000 commit 65cf42c

File tree

1,639 files changed

+59769
-40670
lines changed

Some content is hidden

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

1,639 files changed

+59769
-40670
lines changed
 

‎app/code/Magento/AdminAnalytics/ViewModel/Metadata.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
namespace Magento\AdminAnalytics\ViewModel;
1010

1111
use Magento\Config\Model\Config\Backend\Admin\Custom;
12+
use Magento\Csp\Helper\CspNonceProvider;
1213
use Magento\Framework\App\Config\ScopeConfigInterface;
14+
use Magento\Framework\App\ObjectManager;
1315
use Magento\Framework\App\ProductMetadataInterface;
1416
use Magento\Backend\Model\Auth\Session;
1517
use Magento\Framework\App\State;
@@ -21,6 +23,11 @@
2123
*/
2224
class Metadata implements ArgumentInterface
2325
{
26+
/**
27+
* @var string
28+
*/
29+
private $nonce;
30+
2431
/**
2532
* @var State
2633
*/
@@ -41,22 +48,33 @@ class Metadata implements ArgumentInterface
4148
*/
4249
private $config;
4350

51+
/**
52+
* @var CspNonceProvider
53+
*/
54+
private $nonceProvider;
55+
4456
/**
4557
* @param ProductMetadataInterface $productMetadata
4658
* @param Session $authSession
4759
* @param State $appState
4860
* @param ScopeConfigInterface $config
61+
* @param CspNonceProvider|null $nonceProvider
4962
*/
5063
public function __construct(
5164
ProductMetadataInterface $productMetadata,
5265
Session $authSession,
5366
State $appState,
54-
ScopeConfigInterface $config
67+
ScopeConfigInterface $config,
68+
CspNonceProvider $nonceProvider = null
5569
) {
5670
$this->productMetadata = $productMetadata;
5771
$this->authSession = $authSession;
5872
$this->appState = $appState;
5973
$this->config = $config;
74+
75+
$this->nonceProvider = $nonceProvider ?: ObjectManager::getInstance()->get(CspNonceProvider::class);
76+
77+
$this->nonce = $this->nonceProvider->generateNonce();
6078
}
6179

6280
/**
@@ -156,4 +174,14 @@ public function getCurrentUserRoleName(): string
156174
{
157175
return $this->authSession->getUser()->getRole()->getRoleName();
158176
}
177+
178+
/**
179+
* Get a random nonce for each request.
180+
*
181+
* @return string
182+
*/
183+
public function getNonce(): string
184+
{
185+
return $this->nonce;
186+
}
159187
}
Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
{
22
"name": "magento/module-admin-analytics",
33
"description": "N/A",
4+
"type": "magento2-module",
5+
"license": [
6+
"OSL-3.0",
7+
"AFL-3.0"
8+
],
49
"config": {
510
"sort-packages": true
611
},
12+
"version": "100.4.5-p6",
713
"require": {
814
"php": "~8.1.0||~8.2.0",
9-
"magento/framework": "*",
10-
"magento/module-backend": "*",
11-
"magento/module-config": "*",
12-
"magento/module-store": "*",
13-
"magento/module-ui": "*",
14-
"magento/module-release-notification": "*"
15+
"magento/framework": "103.0.*",
16+
"magento/module-backend": "102.0.*",
17+
"magento/module-config": "101.2.*",
18+
"magento/module-store": "101.1.*",
19+
"magento/module-ui": "101.2.*",
20+
"magento/module-release-notification": "100.4.*",
21+
"magento/module-csp": "100.4.*"
1522
},
16-
"type": "magento2-module",
17-
"license": [
18-
"OSL-3.0",
19-
"AFL-3.0"
20-
],
2123
"autoload": {
2224
"files": [
2325
"registration.php"
@@ -27,3 +29,4 @@
2729
}
2830
}
2931
}
32+

0 commit comments

Comments
 (0)
Please sign in to comment.