Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/remove 2.4.4 #4

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
738d768
fix #682
dpotkoc Jan 11, 2024
6ae7fae
updating to DataDome Fastly Module 2.19.4
MickaelDatadome Jan 16, 2024
63d7602
Merge branch 'master' into datadome-2.19.4
MickaelDatadome Jan 16, 2024
ce32d82
Merge pull request #685 from DataDome/datadome-2.19.4
vvuksan Jan 30, 2024
292b490
Merge pull request #684 from favicode/fix/real-time-logging-v2
vvuksan Jan 30, 2024
e700354
Bump to 1.2.212
vvuksan Jan 30, 2024
21a7132
ci: Use GITHUB_OUTPUT envvar instead of set-output command
arunsathiya Feb 6, 2024
0631b57
Module and documentation updates
mizdebski-netacea Feb 9, 2024
ad1cc76
Documenation wording change
mizdebski-netacea Feb 9, 2024
83663a9
Spelling fix
mizdebski-netacea Feb 9, 2024
de57a20
Add support for Brotli static compression
vvuksan Feb 13, 2024
4262d2b
Merge pull request #687 from mizdebski-netacea/documentation-and-modu…
vvuksan Feb 13, 2024
1238194
Merge pull request #688 from fastly/brotli
vvuksan Feb 13, 2024
f48a796
Merge pull request #686 from arunsathiya/master
vvuksan Feb 13, 2024
2da1203
Add testing for 2.4.6 and PHP 8.3
vvuksan Feb 13, 2024
183810f
Bump to 1.2.213
vvuksan Feb 13, 2024
775b5a1
Merge branch 'brotli'
vvuksan Feb 13, 2024
a4416ca
Rate limiting improvement
dpotkoc Mar 7, 2024
8a3ea3e
fix code quality
dpotkoc Mar 7, 2024
c8dcab8
Merge pull request #689 from favicode/fix/rate-limiting
vvuksan Mar 7, 2024
a5748c1
Bump to 1.2.214
Mar 7, 2024
d985098
Netacea Magento module updated with additional logging
mizdebski-netacea Mar 8, 2024
a0622b7
Fix for checking if current IP is in maintenance IP list
ivanviduka Mar 14, 2024
2f4e11b
Merge pull request #692 from favicode/fix/maintenance-ips-in-rate-lim…
vvuksan Mar 27, 2024
8c97f4c
Bump to 1.2.215
Mar 27, 2024
1694050
fix GEOIP redirection causes 404 #693
dpotkoc Apr 8, 2024
a49a155
Merge pull request #694 from favicode/fix/geoip
vvuksan Apr 8, 2024
fdd616c
Bump to 1.2.216
Apr 8, 2024
a7dd24b
Merge branch 'master' into chore/PE2-1049/additional-logging
mizdebski-netacea May 6, 2024
8e763fb
Merge pull request #690 from mizdebski-netacea/chore/PE2-1049/additio…
vvuksan May 8, 2024
0ed56f1
Bump to 1.2.217
May 8, 2024
cdb3a34
Netacea Magento module updated with PURGE requests handling
mizdebski-netacea May 9, 2024
37969c8
Fixing deprecated usage - adding cast to string and tags size check
ivanviduka May 13, 2024
0d33b66
Merge branch 'master' into feat/PEB-756/purge-requests-handling
mizdebski-netacea May 24, 2024
7df0309
Merge pull request #697 from favicode/fix/deprecated-functionality
vvuksan May 24, 2024
f8cf114
Merge pull request #696 from mizdebski-netacea/feat/PEB-756/purge-req…
vvuksan May 24, 2024
993a7be
Remove 2.4.4 test
ivanviduka May 27, 2024
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
6 changes: 0 additions & 6 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ jobs:
# composer: "v1"
# elasticsearch: "7.10.2"

- magento: "2.4.4"
php: "8.1"
composer: "v2"
opensearch: "1.2.0"

- magento: "2.4.5"
php: "8.1"
composer: "v2"
Expand All @@ -89,7 +84,6 @@ jobs:
php: "8.2"
composer: "v2"
opensearch: "2.5.0"

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/shielding-check-cron-manual.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
run: |
cat ./temp.json | jq . > etc/shielding/datacenters.json
rm -f ./temp.json
echo "::set-output name=diff-count::$(git diff --name-only | wc -l)"
echo "diff-count=$(git diff --name-only | wc -l)" >> "$GITHUB_OUTPUT"
SHA1=`sha1sum etc/shielding/datacenters.json | awk '{print $1}'`
echo "::set-output name=sha1::$SHA1"
echo "::set-output name=pr-count::$(gh pr list --search "${SHA1} in:title is:open" --json title -q '.[] | .title' | wc -l)"
echo "sha1=$SHA1" >> "$GITHUB_OUTPUT"
echo "pr-count=$(gh pr list --search "${SHA1} in:title is:open" --json title -q '.[] | .title' | wc -l)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check diff and create PR
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/shielding-check-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
run: |
cat ./temp.json | jq . > etc/shielding/datacenters.json
rm -f ./temp.json
echo "::set-output name=diff-count::$(git diff --name-only | wc -l)"
echo "diff-count=$(git diff --name-only | wc -l)" >> "$GITHUB_OUTPUT"
SHA1=`sha1sum etc/shielding/datacenters.json | awk '{print $1}'`
echo "::set-output name=sha1::$SHA1"
echo "::set-output name=pr-count::$(gh pr list --search "${SHA1} in:title is:open" --json title -q '.[] | .title' | wc -l)"
echo "sha1=$SHA1" >> "$GITHUB_OUTPUT"
echo "pr-count=$(gh pr list --search "${SHA1} in:title is:open" --json title -q '.[] | .title' | wc -l)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check diff and create PR
Expand Down
20 changes: 11 additions & 9 deletions Block/GeoIp/GetAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @copyright Copyright (c) 2016 Fastly, Inc. (http://www.fastly.com)
* @license BSD, see LICENSE_FASTLY_CDN.txt
*/

namespace Fastly\Cdn\Block\GeoIp;

use Fastly\Cdn\Model\Config;
Expand Down Expand Up @@ -60,13 +61,14 @@ class GetAction extends AbstractBlock
* @param EncoderInterface $urlEncoder
*/
public function __construct(
Config $config,
Context $context,
Response $response,
Url $url,
Config $config,
Context $context,
Response $response,
Url $url,
EncoderInterface $urlEncoder,
array $data = []
) {
array $data = []
)
{
$this->config = $config;
$this->response = $response;
$this->url = $url;
Expand All @@ -92,8 +94,8 @@ protected function _toHtml() // @codingStandardsIgnoreLine - required by parent
$currentUrl = $this->url->getCurrentUrl();
$baseUrl = $this->url->getBaseUrl();
$webTypeUrl = $this->url->getBaseUrl(['_type' => Url::URL_TYPE_WEB]);
if (strpos($currentUrl, $baseUrl) !== false) {

if (strpos($currentUrl, rtrim($baseUrl, "/")) !== false) {
$targetUrl = $currentUrl;
} else {
$targetUrl = str_replace($webTypeUrl, $baseUrl, $currentUrl);
Expand All @@ -109,7 +111,7 @@ protected function _toHtml() // @codingStandardsIgnoreLine - required by parent
$this->response->setHeader("x-esi", "1");
}
// Due to Varnish parser limitations HTTPS ESIs are not supported so we need to turn them into HTTP URLs
// This does not mean that request will go over HTTP. ESI subrequest will go out to the backend that is
// This does not mean that request will go over HTTP. ESI subrequest will go out to the backend that is
// currently specified so if it's HTTPS it will go over HTTPS
return sprintf(
'<esi:include src=\'%s\' />',
Expand Down
15 changes: 10 additions & 5 deletions Controller/Adminhtml/FastlyCdn/Logging/CreateEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@
use Magento\Framework\Controller\Result\JsonFactory;

/**
* Class CreateEndpoint
* @package Fastly\Cdn\Controller\Adminhtml\FastlyCdn\Logging
* Class CreateEndpoint for Logging
*/
class CreateEndpoint extends Action
{
const ADMIN_RESOURCE = 'Magento_Config::config';
public const ADMIN_RESOURCE = 'Magento_Config::config';

/**
* @var Http
Expand Down Expand Up @@ -113,6 +112,11 @@ public function execute()
$this->getRequest()->getParam('condition_priority')
);

$selectedConditions = $this->getRequest()->getParam('conditions', '');
if (!$condition) {
$condition = $selectedConditions;
}

$params = array_merge(
$this->getRequest()->getParam('log_endpoint'),
['response_condition' => $condition]
Expand Down Expand Up @@ -152,17 +156,18 @@ public function execute()
}

/**
*
* @param $clone
* @param $conditionName
* @param $applyIf
* @param $conditionPriority
* @return string|null
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
*/
private function createCondition($clone, $conditionName, $applyIf, $conditionPriority)
{
if (!$conditionName || !$applyIf || !$conditionPriority) {
return null;
return '';
}
$condition = [
'name' => $conditionName,
Expand Down
26 changes: 14 additions & 12 deletions Controller/Adminhtml/FastlyCdn/Logging/UpdateEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@
use Magento\Framework\Controller\Result\JsonFactory;

/**
* Class UpdateEndpoint
* @package Fastly\Cdn\Controller\Adminhtml\FastlyCdn\Logging
* Class UpdateEndpoint for Logging
*/
class UpdateEndpoint extends Action
{
const ADMIN_RESOURCE = 'Magento_Config::config';
public const ADMIN_RESOURCE = 'Magento_Config::config';

/**
* @var Http
Expand Down Expand Up @@ -84,6 +83,7 @@ public function __construct(
}

/**
*
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\Result\Json|\Magento\Framework\Controller\ResultInterface
*/
public function execute()
Expand Down Expand Up @@ -114,14 +114,15 @@ public function execute()
$this->getRequest()->getParam('condition_priority')
);

$params = array_merge(
$this->getRequest()->getParam('log_endpoint'),
['response_condition' => $condition]
);

$selectedConditions = $this->getRequest()->getParam('conditions', '');
if (!$condition) {
$condition = $selectedConditions;
}
$params = $this->getRequest()->getParam('log_endpoint');
$params = array_filter($params);
//Array filter removes empty strings, but empty compression_codec param turns off compression formats
if (!isset($params['compression_codec'])){
$params['response_condition'] = $condition;

if (!isset($params['compression_codec'])) {
$params['compression_codec'] = "";
}
$endpoint = $this->api->updateLogEndpoint($clone->number, $endpointType, $params, $oldName);
Expand Down Expand Up @@ -157,17 +158,18 @@ public function execute()
}

/**
*
* @param $clone
* @param $conditionName
* @param $applyIf
* @param $conditionPriority
* @return string|null
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
*/
private function createCondition($clone, $conditionName, $applyIf, $conditionPriority)
{
if (!$conditionName || !$applyIf || !$conditionPriority) {
return null;
return '';
}
$condition = [
'name' => $conditionName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,8 @@ After you have enabled the module it's time to configure. You will be prompted w

## Configurable options

### Netacea API Key

This is the API key provided to you by Netacea.

### Netacea Secret

This is the Secret provided to you by Netacea.

### Netacea Ignore List

This is the list of URL paths which integration will skip and won't apply any action to requests. <br />
Please note that the integration will check if a request's URL path starts with a value from the list and will decide if it should be skipped. <br />
Example:
- Path `/skipthis` is added to the ignore list
- Integration will skip requests which paths are starting from the `/skipthis`
- This means that requests for such websites would be skipped by the integration:
- `www.domain.com/skipthis`
- `www.domain.com/skipthisalso`
- `www.domain.com/skipthis/andthistoo`
In order to configure Netacea module please see the following documentation.<br />
[Netacea - Fastly/Magento](https://docs.netacea.com/netacea-plugin-information/fastly-magento/installation-and-configuration)

## Enabling

Expand Down
2 changes: 1 addition & 1 deletion Model/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ public function uploadSnippet($version, array $snippet)
if (isset($snippet['content'])) {
$adminUrl = $this->vcl->getAdminFrontName();
$adminPathTimeout = $this->config->getAdminPathTimeout();
$ignoredUrlParameters = $this->config->getIgnoredUrlParameters();
$ignoredUrlParameters = (string)$this->config->getIgnoredUrlParameters();

if ($ignoredUrlParameters === "") {
$queryParameters = '&';
Expand Down
27 changes: 13 additions & 14 deletions Model/FrontControllerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function aroundDispatch(FrontControllerInterface $subject, callable $proc
return $proceed(...$args);
}

$path = strtolower($this->request->getPathInfo());
$path = strtolower($this->request->getRequestUri());

if ($isRateLimitingEnabled && $this->sensitivePathProtection($path)) {
return $this->response;
Expand Down Expand Up @@ -167,7 +167,8 @@ private function sensitivePathProtection($path)

$limit = false;
foreach ($limitedPaths as $key => $value) {
if (preg_match('{' . $value->path . '}i', $path) == 1) {
$value->path = str_replace("#", "\#", $value->path);
if (preg_match('#' . $value->path . '#i', $path)) {
$limit = true;
break;
}
Expand Down Expand Up @@ -333,26 +334,24 @@ private function verifyBots($ip)
return false;
}

private function readMaintenanceIp($ip)
private function readMaintenanceIp($clientIps)
{
$tag = self::FASTLY_CACHE_MAINTENANCE_IP_FILE_TAG;
$data = json_decode($this->cache->load($tag));
if (empty($data)) {
$data = [];
$allowedIps = json_decode($this->cache->load($tag));
if (empty($allowedIps)) {
$allowedIps = [];
$flagDir = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
if ($flagDir->isExist('.maintenance.ip')) {
$temp = $flagDir->readFile('.maintenance.ip');
$data = explode(',', trim($temp));
$this->cache->save(json_encode($data), $tag, []);
$allowedIps = explode(',', trim($temp));
$this->cache->save(json_encode($allowedIps), $tag, []);
}
}

foreach ($data as $key => $value) {
if (!empty($value) && trim($value) == $ip) {
return true;
}
}
return false;
$ips = array_map("trim", explode(",", $clientIps));
$isAllowed = array_intersect($allowedIps, $ips);

return !empty($isAllowed);
}

private function log($message)
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.211", true);
$this->response->setHeader("Fastly-Module-Enabled", "1.2.217", true);
}

return $result;
Expand Down
5 changes: 4 additions & 1 deletion Model/ResponsePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ public function aroundSetHeader(Http $subject, callable $proceed, $name, $value,
// Make the necessary adjustment
$value = $this->cacheTags->convertCacheTags(str_replace(',', ' ', $value));
$tagsSize = $this->config->getXMagentoTagsSize();
if (strlen($value) > $tagsSize) {

if ($tagsSize === 0) {
$value = "";
} else if (strlen($value) > $tagsSize) {
$trimmedArgs = substr($value, 0, $tagsSize);
$value = substr($trimmedArgs, 0, strrpos($trimmedArgs, ' ', -1));
}
Expand Down
26 changes: 26 additions & 0 deletions Release-Notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Fastly_Cdn Release Notes

## 1.2.217

- Update to Netacea module https://github.com/fastly/fastly-magento2/pull/690

## 1.2.216

- Fix for GEOIP redirection causes 404 in specific cases https://github.com/fastly/fastly-magento2/pull/694

## 1.2.215

- Fix for checking if current IP is in maintenance IP list https://github.com/fastly/fastly-magento2/pull/692

## 1.2.214

- Rate limiting doesn't work correctly when store codes are involved https://github.com/fastly/fastly-magento2/pull/689

## 1.2.213

- Update Netacea Edge Module to 5.9.0 https://github.com/fastly/fastly-magento2/pull/687
- Add support for Brotli static compression https://github.com/fastly/fastly-magento2/pull/688

## 1.2.212

- Additional fixes to log shipping menu https://github.com/fastly/fastly-magento2/pull/684
- Updating to DataDome Fastly Module 2.19.4 https://github.com/fastly/fastly-magento2/pull/685

## 1.2.211

- Fix for not being able to add log shipping jobs due to bug in Fastly Magento UI https://github.com/fastly/fastly-magento2/pull/683
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.211
1.2.217
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.211",
"version": "1.2.217",
"license": "BSD-3-Clause",
"autoload": {
"files": [ "registration.php" ],
Expand Down
Loading
Loading