DG-1986 | Use policy update time as last refresh time #3967
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change description
This PR contains following 3 small / one liner changes:
Since this timestamp is used to while fetching next set of policies, earlier method where audit event time was getting used had an edge case where if ES is not synced with policies that are created, policy refresher will not find that policy but since the last updated timestamp is updated with event time, it will be missed in subsequent fetches as well.
Currently, deleting an entity doesn't update
updateTime
of the entity, so if a policy is updated and then deleted, there would two audit events but both will have same value fortimestamp
which is the time when it was updated. This means then the delete event will not be catched by policy refresher since it has the already tracked timestamp which was generated later on.Adds an exception if policy refresher does not find any policies to create the policy engine. Earlier it was silently getting handled causing problem when delta is applied since there was no policy engine to apply delta to. Throwing exception allows it to keep trying to create engine if no policies are available in the system e.g. in case of atlas reset.
Test Cases
timestamp
is getting updated - ✅Type of change
Related issues
Checklists
Development
Security
Code review