Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## [0.33.0](https://github.com/crowdsecurity/php-cs-bouncer/releases/tag/v0.33.0) - 2022-11-10
[_Compare with previous release_](https://github.com/crowdsecurity/php-cs-bouncer/compare/v0.32.0...v0.33.0)

### Fixed
- In stream mode, a clean IP decision (`bypass`) was not cached at all. The decision is now cached for ten years as expected.

---

## [0.32.0](https://github.com/crowdsecurity/php-cs-bouncer/releases/tag/v0.32.0) - 2022-09-29
[_Compare with previous release_](https://github.com/crowdsecurity/php-cs-bouncer/compare/v0.31.0...v0.32.0)

Expand Down
20 changes: 9 additions & 11 deletions src/AbstractCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,17 +339,15 @@ protected function defferUpdateCacheConfig(array $config): void
protected function formatRemediationFromDecision(?array $decision): array
{
if (!$decision) {
$duration = time() + $this->cacheExpirationForCleanIp;
if ($this->streamMode) {
/**
* In stream mode we consider a clean IP forever... until the next resync.
* in this case, forever is 10 years as PHP_INT_MAX will cause trouble with the Memcached Adapter
* (int to float unwanted conversion)
* */
$duration = 315360000;
}

return [Constants::REMEDIATION_BYPASS, $duration, 0];
/**
* In stream mode we consider a clean IP forever... until the next resync.
* in this case, forever is 10 years as PHP_INT_MAX will cause trouble with the Memcached Adapter
* (int to float unwanted conversion)
*
*/
$duration = $this->streamMode ? 315360000 : $this->cacheExpirationForCleanIp;

return [Constants::REMEDIATION_BYPASS, time() + $duration, 0];
}

$duration = self::parseDurationToSeconds($decision['duration']);
Expand Down
2 changes: 1 addition & 1 deletion src/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Constants
/** @var string Path for html templates folder (e.g. ban and captcha wall) */
public const TEMPLATES_DIR = __DIR__ . "/templates";
/** @var string The last version of this library */
public const VERSION = 'v0.32.0';
public const VERSION = 'v0.33.0';
/** @var string The "disabled" x-forwarded-for setting */
public const X_FORWARDED_DISABLED = 'no_forward';
}