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
[ti_misp] Keep the same timestamp for later pages #6649
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
🌐 Coverage report
|
efd6
reviewed
Jun 21, 2023
packages/ti_misp/data_stream/threat/agent/stream/httpjson.yml.hbs
Outdated
Show resolved
Hide resolved
andrewkroh
reviewed
Jun 22, 2023
chrisberkhout
force-pushed
the
ti-misp-succesive-pages-use-initial-timestamp
branch
from
June 22, 2023 15:52
e41e67f
to
3dcf5bf
Compare
andrewkroh
approved these changes
Jun 22, 2023
@chrisberkhout Thank you for such a wonderful change description (retained sans the |
Package ti_misp - 1.16.1 containing this change is available at https://epr.elastic.co/search?package=ti_misp |
4 tasks
This was referenced Jan 31, 2024
chrisberkhout
added a commit
to elastic/beats
that referenced
this pull request
Feb 8, 2024
Update the HTTP JSON input configuration for the Threat Intel module's misp fileset with pagination fixes that were done earlier in the Agent-based MISP integration, in these PRs: - Fix timestamp format sent to API elastic/integrations#6482 - Fix duplicate requests for page 1 elastic/integrations#6495 - Keep the same timestamp for later pages elastic/integrations#6649 - Pagination fixes elastic/integrations#9073
mergify bot
pushed a commit
to elastic/beats
that referenced
this pull request
Feb 8, 2024
Update the HTTP JSON input configuration for the Threat Intel module's misp fileset with pagination fixes that were done earlier in the Agent-based MISP integration, in these PRs: - Fix timestamp format sent to API elastic/integrations#6482 - Fix duplicate requests for page 1 elastic/integrations#6495 - Keep the same timestamp for later pages elastic/integrations#6649 - Pagination fixes elastic/integrations#9073 (cherry picked from commit b7fc69a)
mergify bot
pushed a commit
to elastic/beats
that referenced
this pull request
Feb 8, 2024
Update the HTTP JSON input configuration for the Threat Intel module's misp fileset with pagination fixes that were done earlier in the Agent-based MISP integration, in these PRs: - Fix timestamp format sent to API elastic/integrations#6482 - Fix duplicate requests for page 1 elastic/integrations#6495 - Keep the same timestamp for later pages elastic/integrations#6649 - Pagination fixes elastic/integrations#9073 (cherry picked from commit b7fc69a)
chrisberkhout
pushed a commit
to elastic/beats
that referenced
this pull request
Feb 9, 2024
…#37923) [filebeat][threatintel] MISP pagination fixes (#37898) Update the HTTP JSON input configuration for the Threat Intel module's misp fileset with pagination fixes that were done earlier in the Agent-based MISP integration, in these PRs: - Fix timestamp format sent to API elastic/integrations#6482 - Fix duplicate requests for page 1 elastic/integrations#6495 - Keep the same timestamp for later pages elastic/integrations#6649 - Pagination fixes elastic/integrations#9073
chrisberkhout
pushed a commit
to elastic/beats
that referenced
this pull request
Feb 9, 2024
…#37924) [filebeat][threatintel] MISP pagination fixes (#37898) Update the HTTP JSON input configuration for the Threat Intel module's misp fileset with pagination fixes that were done earlier in the Agent-based MISP integration, in these PRs: - Fix timestamp format sent to API elastic/integrations#6482 - Fix duplicate requests for page 1 elastic/integrations#6495 - Keep the same timestamp for later pages elastic/integrations#6649 - Pagination fixes elastic/integrations#9073
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
For a given sequence of page requests, the later requests should use the same timestamp parameter as the initial page in the sequence.
This is achieved by setting a query string parameter in the initial request that will be ignored by MISP, and using that to set the correct timestamp in the
response.pagination
transforms. This is a workaround for the fact thatreponse.pagination
transforms aren't provided direct access to the last request, but can access the URL via the last response.Details
When fetching data from MISP, we start at an earlier point (120 hours by default, 10 mins in testing) and page forward from that point. As items are received, item timstamps are recorded in
httpjson
cursor data. Upon restart that cursor data is used as the new start point.The bug was that the timestamp was being reset on every page. For example, looking at agent logs for system tests before the change we see:
The initial timestamp in the request body is 10 mins before that request was made, as expected. However, for later pages the timestamp is reset to a new value 10 minutes before the new request.
Aside: for the
threat
datastream, page 2 has the same timestamp as page 1. This is because it is requested just 3 milliseconds after page 1. The 3rd page is requested after 3 second delay (as is the 2nd page for thethreat_attributes
datastream) so we see a new timestamp value there. I'm not sure why the delays aren't all similar. Maybe a 3 second delay is triggered by a threshold that isn't reached by the 1st page for thethreat
datastream, which does have less data. Changing the run order doesn't seem to affect this.After the change the logs look like this:
Details of verifying that MISP doesn't break with the additional query string parameter
MISP setup
Verify that the page 1 response is the same with and without the query string parameter
They do indeed yield the same response:
Verify that the page 2 response is the same with and without the query string parameter
They do indeed yield the same response:
Checklist
changelog.yml
file.Author's Checklist
Related issues
response.pagination
transforms to read.last_request.*
beats#35887