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

Don't process tracking requests that are older than data purge cutoff #14831

Merged
merged 5 commits into from Sep 3, 2019

Conversation

katebutler
Copy link

Fixes #14802

@katebutler katebutler added the Needs Review PRs that need a code review label Aug 28, 2019
@katebutler katebutler added this to the 3.12.0 milestone Aug 28, 2019
@@ -130,6 +130,17 @@ public function handle()

$this->visitProperties = new VisitProperties();

// Break early if request timestamp is older than the cutoff for deleting older log entries
$cache = Tracker\Cache::getCacheGeneral();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 works nicely @katebutler

One thought: let's maybe move the logic to here: https://github.com/matomo-org/matomo/blob/3.x-dev/core/Tracker/Request.php#L503-L505

Could we also throw an InvalidRequestParameterException and a message that explains that timestamp is too old and data would be deleted again because of log retention ? A Common::printDebug be good as well.

At first was thinking we should fail silently as otherwise anyone could find out whether a user as raw data retention configured and to how many days the raw data retention is set). However, this is not possible because you need to authenticate the request anyway when tracking a request with a timestamp of older than one day. So only users with at least write access would be possible to find out about this and there it is fine.

Be good to throw an exception 👍

$maxLogAge = $cache['delete_logs_older_than'];
$logEntryCutoff = time() - (($maxLogAge + $scheduleInterval) * 60*60*24);
if ($cdt < $logEntryCutoff) {
$message = "Request skipped as custom timestamp is older than $maxLogAge days";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@katebutler could we mention log deletion in the exception message somehow? Otherwise people might be contacting us asking why the don't accept custom timestamps older than X days.

Something like Custom timestamp is older than the configured "delete old raw data" value of X days

@tsteur tsteur merged commit e84f89f into 3.x-dev Sep 3, 2019
@tsteur tsteur deleted the 14802 branch September 3, 2019 21:09
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When log deletion is enabled, do not allow import of any older data
3 participants