Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
MickaelDatadome authored Nov 7, 2024
2 parents cc95795 + 2477f2c commit 6c30d74
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Controller/Adminhtml/FastlyCdn/Blocking/Blocking.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function execute()
return $result->setData([
'status' => true
]);
} catch (\Exception $e) {
} catch (\Throwable $e) {
return $result->setData([
'status' => false,
'msg' => $e->getMessage()
Expand Down
10 changes: 10 additions & 0 deletions Controller/Adminhtml/FastlyCdn/Edge/Dictionary/ListAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class ListAll extends Action
{
const ADMIN_RESOURCE = 'Magento_Config::config';

const NGWAF_DICTIONARY_NAME = "Edge_Security";

/**
* @var Http
*/
Expand Down Expand Up @@ -96,6 +98,14 @@ public function execute()
]);
}

// This dictionary represents NGWAF, used while migrating customers from WAF. Adobe is requesting that
// their customers shouldn't be able to disable it, so we remove it from Admin listing.
foreach ($dictionaries as $key => $dictionary) {
if (isset($dictionary->name) && $dictionary->name === self::NGWAF_DICTIONARY_NAME) {
array_splice($dictionaries, $key, 1);
}
}

return $result->setData([
'status' => true,
'dictionaries' => $dictionaries
Expand Down
2 changes: 1 addition & 1 deletion Model/Layout/LayoutPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function afterGenerateElements(\Magento\Framework\View\Layout $subject):
public function afterGetOutput(\Magento\Framework\View\Layout $subject, $result) // @codingStandardsIgnoreLine - unused parameter
{
if ($this->config->getType() === Config::FASTLY) {
$this->response->setHeader("Fastly-Module-Enabled", "1.2.220", true);
$this->response->setHeader("Fastly-Module-Enabled", "1.2.221", true);
}

return $result;
Expand Down
25 changes: 25 additions & 0 deletions Observer/InvalidateVarnishObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ public function execute(\Magento\Framework\Event\Observer $observer): void
continue;
}
$tag = $this->cacheTags->convertCacheTags($tag);

if (!$this->isTagAllowed($tag)) {
continue;
}

if (!in_array($tag, $this->alreadyPurged)) {
$tags[] = $tag;
$this->alreadyPurged[] = $tag;
Expand Down Expand Up @@ -113,4 +118,24 @@ private function canPurgeObject(\Magento\Framework\DataObject\IdentityInterface
}
return true;
}

/**
* Additional validation since IdentityInterface can pass canPurgeObject check (e.g. ProductRuleIndexer), but still
* hold tags of products or categories
*
* @param string $tag
* @return bool
*/
private function isTagAllowed(string $tag)
{
if ($tag === \Magento\Catalog\Model\Category::CACHE_TAG && !$this->config->canPurgeCatalogCategory()) {
return false;
}

if ($tag === \Magento\Catalog\Model\Product::CACHE_TAG && !$this->config->canPurgeCatalogProduct()) {
return false;
}

return true;
}
}
7 changes: 7 additions & 0 deletions Release-Notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Fastly_Cdn Release Notes

## 1.2.221

- Catch Throwable instead of Exception in Blocking controller https://github.com/fastly/fastly-magento2/pull/704
- Perform additional validation during tag purge https://github.com/fastly/fastly-magento2/pull/705
- Trigger init of edge modules if tab is open by default https://github.com/fastly/fastly-magento2/pull/707
- Don't display NGWAF dictionary in admin screen https://github.com/fastly/fastly-magento2/pull/710

## 1.2.220

- Logging endpoints changes https://github.com/fastly/fastly-magento2/pull/701
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.220
1.2.221
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"zordius/lightncandy": "^1.2"
},
"type": "magento2-module",
"version": "1.2.220",
"version": "1.2.221",
"license": "BSD-3-Clause",
"autoload": {
"files": [ "registration.php" ],
Expand Down
2 changes: 1 addition & 1 deletion etc/vcl_snippets/deliver.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

# Add an easy way to see whether custom Fastly VCL has been uploaded
if ( req.http.Fastly-Debug ) {
set resp.http.Fastly-Magento-VCL-Uploaded = "1.2.220";
set resp.http.Fastly-Magento-VCL-Uploaded = "1.2.221";
if (table.lookup(magentomodule_config, "allow_super_users_during_maint", "0") == "1") {
set resp.http.Fastly-Magento-Maintenance-Mode = "on";
}
Expand Down
2 changes: 1 addition & 1 deletion etc/vcl_snippets/miss.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
unset bereq.http.Accept-Encoding;

# Send VCL version uploaded to the backend
set bereq.http.Fastly-Magento-VCL-Uploaded = "1.2.220";
set bereq.http.Fastly-Magento-VCL-Uploaded = "1.2.221";
2 changes: 1 addition & 1 deletion etc/vcl_snippets/pass.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
}

# Send VCL version uploaded to the backend
set bereq.http.Fastly-Magento-VCL-Uploaded = "1.2.220";
set bereq.http.Fastly-Magento-VCL-Uploaded = "1.2.221";
12 changes: 5 additions & 7 deletions view/adminhtml/web/js/edge-dictionaries.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ define([
listDictionaries(active_version, false).done(function (response) {
$('.loading-dictionaries').hide();
if (response.status !== false) {
if (response.status !== false) {
if (response.dictionaries.length > 0) {
dictionaries = response.dictionaries;
processDictionaries(response.dictionaries);
} else {
$('.no-dictionaries').show();
}
if (response.dictionaries.length > 0) {
dictionaries = response.dictionaries;
processDictionaries(response.dictionaries);
} else {
$('.no-dictionaries').show();
}
}
}).fail(function () {
Expand Down
5 changes: 5 additions & 0 deletions view/adminhtml/web/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ define([
let active_version = '';
let next_version = '';
let fastlyFieldset = $('#system_full_page_cache_fastly');
let fastlyEdgeModulesTab = $('#system_full_page_cache_fastly_edge_modules');
let isAlreadyConfigured = true;
let serviceStatus = false;

Expand All @@ -35,6 +36,10 @@ define([
}
});

if (fastlyEdgeModulesTab.is(':visible')) {
modlyInit();
}

$('#system_full_page_cache_fastly_edge_modules-head').one('click', function () {
modlyInit();
});
Expand Down

0 comments on commit 6c30d74

Please sign in to comment.