Skip to content

Commit b3a445c

Browse files
fix(redis): Apply patch to fix redis acl connection (#162)
1 parent 4b43c46 commit b3a445c

File tree

11 files changed

+82
-11
lines changed

11 files changed

+82
-11
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
---
88

9+
## [2.8.1](https://github.com/crowdsecurity/cs-wordpress-bouncer/releases/tag/v2.8.0) - 2024-12-13
10+
[_Compare with previous release_](https://github.com/crowdsecurity/cs-wordpress-bouncer/compare/v2.8.0...v2.8.1)
11+
12+
13+
### Fixed
14+
15+
- Fix Redis connection error when using user and password in DSN
16+
17+
---
18+
919

1020
## [2.8.0](https://github.com/crowdsecurity/cs-wordpress-bouncer/releases/tag/v2.8.0) - 2024-12-13
1121
[_Compare with previous release_](https://github.com/crowdsecurity/cs-wordpress-bouncer/compare/v2.7.0...v2.8.0)

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
"patches": {
4141
"gregwar/captcha": {
4242
"Fix deprecation in CaptchaBuilder constructor": "patches/gregwar-captcha-constructor.patch"
43+
},
44+
"symfony/cache": {
45+
"Fix auth connection in RedisTrait": "patches/symfony-redis-cache-auth.patch"
4346
}
4447
}
4548
}

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crowdsec.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin URI: https://github.com/crowdsecurity/cs-wordpress-bouncer
55
* Description: Safer Together. Protect your WordPress application with CrowdSec.
66
* Tags: security, captcha, ip-blocker, crowdsec, hacker-protection, appsec
7-
* Version: 2.8.0
7+
* Version: 2.8.1
88
* Author: CrowdSec
99
* Author URI: https://www.crowdsec.net/
1010
* Github: https://github.com/crowdsecurity/cs-wordpress-bouncer
@@ -13,7 +13,7 @@
1313
* Requires PHP: 7.2
1414
* Requires at least: 4.9
1515
* Tested up to: 6.7
16-
* Stable tag: 2.8.0
16+
* Stable tag: 2.8.1
1717
* Text Domain: crowdsec-wp
1818
* First release: 2021.
1919
*/

inc/Constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ class Constants extends LibConstants
2121

2222
public const DEFAULT_BASE_FILE_PATH = __DIR__ . '/../../../../wp-content/uploads/crowdsec/';
2323
public const STANDALONE_CONFIG_PATH = __DIR__ . '/standalone-settings.php';
24-
public const VERSION = 'v2.8.0';
24+
public const VERSION = 'v2.8.1';
2525
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff --git a/vendor/symfony/cache/Traits/RedisTrait.php b/vendor/symfony/cache/Traits/RedisTrait.php
2+
index 518a563..c767330 100644
3+
--- a/vendor/symfony/cache/Traits/RedisTrait.php
4+
+++ b/vendor/symfony/cache/Traits/RedisTrait.php
5+
@@ -105,9 +105,13 @@ trait RedisTrait
6+
throw new CacheException('Cannot find the "redis" extension nor the "predis/predis" package.');
7+
}
8+
9+
- $params = preg_replace_callback('#^'.$scheme.':(//)?(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use (&$auth) {
10+
- if (isset($m[2])) {
11+
- $auth = rawurldecode($m[2]);
12+
+ $params = preg_replace_callback('#^'.$scheme.':(//)?(?:(?:(?<user>[^:@]*+):)?(?<password>[^@]*+)@)?#', function ($m) use (&$auth) {
13+
+ if (isset($m['password'])) {
14+
+ if (\in_array($m['user'], ['', 'default'], true)) {
15+
+ $auth = $m['password'];
16+
+ } else {
17+
+ $auth = [$m['user'], $m['password']];
18+
+ }
19+
20+
if ('' === $auth) {
21+
$auth = null;
22+
@@ -376,7 +380,13 @@ trait RedisTrait
23+
$params['parameters']['database'] = $params['dbindex'];
24+
}
25+
if (null !== $auth) {
26+
- $params['parameters']['password'] = $auth;
27+
+ if (\is_array($auth)) {
28+
+ // ACL
29+
+ $params['parameters']['username'] = $auth[0];
30+
+ $params['parameters']['password'] = $auth[1];
31+
+ } else {
32+
+ $params['parameters']['password'] = $auth;
33+
+ }
34+
}
35+
36+
if (isset($params['ssl'])) {

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Donate link: https://crowdsec.net/
44
Tags: security, captcha, ip-blocker, crowdsec, hacker-protection
55
Requires at least: 4.9
66
Tested up to: 6.7
7-
Stable tag: 2.8.0
7+
Stable tag: 2.8.1
88
Requires PHP: 7.2
99
License: MIT
1010
License URI: https://opensource.org/licenses/MIT

vendor/composer/installed.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,11 @@
11301130
},
11311131
"time": "2024-05-31T14:33:22+00:00",
11321132
"type": "library",
1133+
"extra": {
1134+
"patches_applied": {
1135+
"Fix auth connection in RedisTrait": "patches/symfony-redis-cache-auth.patch"
1136+
}
1137+
},
11331138
"installation-source": "dist",
11341139
"autoload": {
11351140
"psr-4": {

vendor/composer/installed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'name' => 'crowdsec/wordpress-bouncer',
44
'pretty_version' => 'dev-main',
55
'version' => 'dev-main',
6-
'reference' => 'e3507c08812edc1e02c0e4af672299f68cb9ad5a',
6+
'reference' => '4b43c4688a1c0cf4dbaa5aa269fe3ba9416bddf5',
77
'type' => 'project',
88
'install_path' => __DIR__ . '/../../',
99
'aliases' => array(),
@@ -67,7 +67,7 @@
6767
'crowdsec/wordpress-bouncer' => array(
6868
'pretty_version' => 'dev-main',
6969
'version' => 'dev-main',
70-
'reference' => 'e3507c08812edc1e02c0e4af672299f68cb9ad5a',
70+
'reference' => '4b43c4688a1c0cf4dbaa5aa269fe3ba9416bddf5',
7171
'type' => 'project',
7272
'install_path' => __DIR__ . '/../../',
7373
'aliases' => array(),

vendor/symfony/cache/PATCHES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)
2+
Patches applied to this directory:
3+
4+
Fix auth connection in RedisTrait
5+
Source: patches/symfony-redis-cache-auth.patch
6+
7+

0 commit comments

Comments
 (0)