@@ -88,7 +88,7 @@ public function configure(
88
88
*/
89
89
private function addRemediationToCacheItem (string $ ip , string $ type , int $ expiration , int $ decisionId ): string
90
90
{
91
- $ item = $ this ->adapter ->getItem ($ ip );
91
+ $ item = $ this ->adapter ->getItem (base64_encode ( $ ip) );
92
92
93
93
// Merge with existing remediations (if any).
94
94
$ remediations = $ item ->isHit () ? $ item ->get () : [];
@@ -130,7 +130,7 @@ private function addRemediationToCacheItem(string $ip, string $type, int $expira
130
130
*/
131
131
private function removeDecisionFromRemediationItem (string $ ip , int $ decisionId ): bool
132
132
{
133
- $ item = $ this ->adapter ->getItem ($ ip );
133
+ $ item = $ this ->adapter ->getItem (base64_encode ( $ ip) );
134
134
$ remediations = $ item ->get ();
135
135
136
136
$ index = false ;
@@ -149,7 +149,7 @@ private function removeDecisionFromRemediationItem(string $ip, int $decisionId):
149
149
'type ' => 'CACHE_ITEM_REMOVED ' ,
150
150
'ip ' => $ ip ,
151
151
]);
152
- $ this ->adapter ->delete ($ ip );
152
+ $ this ->adapter ->delete (base64_encode ( $ ip) );
153
153
154
154
return true ;
155
155
}
@@ -426,7 +426,7 @@ private function miss(string $ip): string
426
426
*/
427
427
private function hit (string $ ip ): string
428
428
{
429
- $ remediations = $ this ->adapter ->getItem ($ ip )->get ();
429
+ $ remediations = $ this ->adapter ->getItem (base64_encode ( $ ip) )->get ();
430
430
431
431
// We apply array values first because keys are ids.
432
432
$ firstRemediation = array_values ($ remediations )[0 ];
@@ -447,7 +447,7 @@ public function get(string $ip): string
447
447
throw new BouncerException ('CrowdSec Bouncer configured in "stream" mode. Please warm the cache up before trying to access it. ' );
448
448
}
449
449
450
- if ($ this ->adapter ->hasItem ($ ip )) {
450
+ if ($ this ->adapter ->hasItem (base64_encode ( $ ip) )) {
451
451
$ remediation = $ this ->hit ($ ip );
452
452
$ cache = 'hit ' ;
453
453
} else {
0 commit comments