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

ti_misp - Fix duplicate requests for page 1 #6495

Conversation

andrewkroh
Copy link
Member

Avoid requesting page 1 more than once. The page counter within httpjson begins at 0 and the page parameter within MISP starts at 1.

The results were verified using this against the request tracer log from the system test.

jq -c '{"http.request.body.content":.["http.request.body.content"], "transaction.id":.["transaction.id"]}' tracer.ndjson | grep -v null
{"http.request.body.content":"{\"limit\":\"10\",\"page\":\"1\",\"returnFormat\":\"json\",\"timestamp\":\"1686065582\"}","transaction.id":"L1FFIRQ23HJ1E-1"}
{"http.request.body.content":"{\"limit\":\"10\",\"page\":\"2\",\"returnFormat\":\"json\",\"timestamp\":\"1686065582\"}","transaction.id":"L1FFIRQ23HJ1E-2"}
{"http.request.body.content":"{\"limit\":\"10\",\"page\":\"3\",\"returnFormat\":\"json\",\"timestamp\":\"1686065584\"}","transaction.id":"L1FFIRQ23HJ1E-3"}

Relates #6479

What does this PR do?

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Screenshots

@andrewkroh andrewkroh added bug Something isn't working, use only for issues Team:Security-External Integrations Integration:ti_misp MISP labels Jun 6, 2023
@andrewkroh andrewkroh requested a review from a team as a code owner June 6, 2023 15:55
@elasticmachine
Copy link

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@@ -9,70 +9,77 @@ rules:
- status_code: 200
body: |-
{
"response": [{
Copy link
Member Author

Choose a reason for hiding this comment

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

NOTE: I formatted this JSON body and then split the existing events across page 1 and page 2.

@elasticmachine
Copy link

elasticmachine commented Jun 6, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-06-08T04:08:48.880+0000

  • Duration: 14 min 22 sec

Test stats 🧪

Test Results
Failed 0
Passed 15
Skipped 0
Total 15

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@andrewkroh andrewkroh force-pushed the ti_misp/bugfix/stop-duplicate-page1-request branch from 94d908f to 7a3309a Compare June 6, 2023 19:54
Avoid requesting page 1 more than once. The page counter within httpjson begins at 0 and the page
parameter within MISP starts at 1.

The results were verified using this against the request tracer log from the system test.

    jq -c '{"http.request.body.content":.["http.request.body.content"], "transaction.id":.["transaction.id"]}' tracer.ndjson | grep -v null
    {"http.request.body.content":"{\"limit\":\"10\",\"page\":\"1\",\"returnFormat\":\"json\",\"timestamp\":\"1686065582\"}","transaction.id":"L1FFIRQ23HJ1E-1"}
    {"http.request.body.content":"{\"limit\":\"10\",\"page\":\"2\",\"returnFormat\":\"json\",\"timestamp\":\"1686065582\"}","transaction.id":"L1FFIRQ23HJ1E-2"}
    {"http.request.body.content":"{\"limit\":\"10\",\"page\":\"3\",\"returnFormat\":\"json\",\"timestamp\":\"1686065584\"}","transaction.id":"L1FFIRQ23HJ1E-3"}

Relates elastic#6479
@andrewkroh andrewkroh force-pushed the ti_misp/bugfix/stop-duplicate-page1-request branch from 7a3309a to e7d0645 Compare June 6, 2023 20:39
@elasticmachine
Copy link

elasticmachine commented Jun 6, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (2/2) 💚
Files 100.0% (2/2) 💚 1.258
Classes 100.0% (2/2) 💚 1.258
Methods 100.0% (30/30) 💚 5.508
Lines 86.344% (607/703) 👎 -7.237
Conditionals 100.0% (0/0) 💚

"Galaxy": [],
"ShadowAttribute": [],
"category": "Payload delivery",
"comment": "",
"comment": "filename contect for test event 3",
Copy link
Contributor

Choose a reason for hiding this comment

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

"context"?

Copy link
Member Author

Choose a reason for hiding this comment

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

That diff is a bit misleading in that I did not add this string. Viewing without whitespace is better for this file.

But my guess would be "content". 🤷

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to "content".

@andrewkroh andrewkroh requested a review from efd6 June 8, 2023 04:09
@andrewkroh andrewkroh merged commit 6b43275 into elastic:main Jun 8, 2023
@elasticmachine
Copy link

Package ti_misp - 1.15.2 containing this change is available at https://epr.elastic.co/search?package=ti_misp

sodhikirti07 pushed a commit that referenced this pull request Jun 15, 2023
Avoid requesting page 1 more than once. The page counter within httpjson begins at 0 and the page
parameter within MISP starts at 1.

The results were verified using this against the request tracer log from the system test.

    jq -c '{"http.request.body.content":.["http.request.body.content"], "transaction.id":.["transaction.id"]}' tracer.ndjson | grep -v null
    {"http.request.body.content":"{\"limit\":\"10\",\"page\":\"1\",\"returnFormat\":\"json\",\"timestamp\":\"1686065582\"}","transaction.id":"L1FFIRQ23HJ1E-1"}
    {"http.request.body.content":"{\"limit\":\"10\",\"page\":\"2\",\"returnFormat\":\"json\",\"timestamp\":\"1686065582\"}","transaction.id":"L1FFIRQ23HJ1E-2"}
    {"http.request.body.content":"{\"limit\":\"10\",\"page\":\"3\",\"returnFormat\":\"json\",\"timestamp\":\"1686065584\"}","transaction.id":"L1FFIRQ23HJ1E-3"}

Relates #6479
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
Labels
bug Something isn't working, use only for issues Integration:ti_misp MISP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants