Skip to content

Commit

Permalink
[BUGFIX] Task for IP anonymization respects mask
Browse files Browse the repository at this point in the history
IP anonymization now takes the correct pattern when querying the database.
Depending on the mask to be shortened.

Resolves: #89788
Releases: master, 9.5
Change-Id: Ic09d2385b33434cc2d7553087c2014b190f9c339
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63225
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
  • Loading branch information
brandung-gs authored and georgringer committed Feb 18, 2020
1 parent 8a9449f commit 7c94866
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion typo3/sysext/scheduler/Classes/Task/IpAnonymizationTask.php
Expand Up @@ -87,6 +87,11 @@ protected function handleTable($table, array $configuration)
if ($deleteTimestamp === false) {
throw new \RuntimeException(self::class . ' misconfiguration: number of days could not be calculated for table ' . $table, 1524526354);
}
if ($this->mask === 2) {
$notLikeMaskPattern = '%.0.0';
} else {
$notLikeMaskPattern = '%.0';
}
try {
$result = $queryBuilder
->select('uid', $configuration['ipField'])
Expand All @@ -102,7 +107,7 @@ protected function handleTable($table, array $configuration)
$queryBuilder->expr()->isNotNull($configuration['ipField']),
$queryBuilder->expr()->notLike(
$configuration['ipField'],
$queryBuilder->createNamedParameter('%.0.0', \PDO::PARAM_STR)
$queryBuilder->createNamedParameter($notLikeMaskPattern, \PDO::PARAM_STR)
),
$queryBuilder->expr()->notLike(
$configuration['ipField'],
Expand Down

0 comments on commit 7c94866

Please sign in to comment.