Skip to content

Conversation

@efd6
Copy link
Contributor

@efd6 efd6 commented Oct 21, 2024

Proposed commit message

When we receive no event from the Proofpoint TAP API, we need to publish an event even though there is no event to publish. The mechanics of cursor updates in the HTTPJSON input are that the cursor is updated when an event is published, so if we get a response with no event, the input assumes that there has been no new event and so (incorrectly) no progress, but we know that having received an empty response from the API, there is definitively no event in the requested time slice. So we can and should avoid querying that time slice again, and should update the cursor to the end of the time slice. This HTTPJSON behaviour is not documented, but is visible in the source code and is experimentally verified. So, publish the parent object in the case that there is no actual event in order to update the cursor, and adjust the ingest pipeline to allow it to tolerate an empty response.

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.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Screenshots

@efd6 efd6 added Integration:proofpoint_tap Proofpoint TAP bugfix Pull request that fixes a bug issue Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] labels Oct 21, 2024
@efd6 efd6 self-assigned this Oct 21, 2024
…n made

When we receive no event from the Proofpoint TAP API, we need to publish an event
even though there is no event to publish. The mechanics of cursor updates in the
HTTPJSON input are that the cursor is updated when an event is published, so if
we get a response with no event, the input assumes that there has been no new
event and so (incorrectly) no progress, but we know that having received an empty
response from the API, there is definitively no event in the requested time slice.
So we can and should avoid querying that time slice again, and should update the
cursor to the end of the time slice. This HTTPJSON behaviour is not documented,
but is visible in the source code and is experimentally verified. So, publish
the parent object in the case that there is no actual event in order to update
the cursor, and adjust the ingest pipeline to allow it to tolerate an empty
response.
@efd6 efd6 force-pushed the s5180-proofpoint_tap-publish_cursor branch from b6d2cfa to 75d4376 Compare October 21, 2024 02:39
@elastic-vault-github-plugin-prod
Copy link

elastic-vault-github-plugin-prod bot commented Oct 21, 2024

🚀 Benchmarks report

Package proofpoint_tap 👍(1) 💚(2) 💔(1)

Expand to view
Data stream Previous EPS New EPS Diff (%) Result
clicks_permitted 4329 2777.78 -1551.22 (-35.83%) 💔

To see the full report comment with /test benchmark fullreport

@efd6 efd6 marked this pull request as ready for review October 21, 2024 03:38
@efd6 efd6 requested a review from a team as a code owner October 21, 2024 03:38
@elasticmachine
Copy link

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

Copy link
Contributor

@ShourieG ShourieG left a comment

Choose a reason for hiding this comment

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

LGTM, nits only

{"url":"https://www.example.com/url?q=httpabc12345","classification":"spam","clickTime":"2022-03-30T07:10:19.000Z","threatTime":"2022-03-29T09:27:21.000Z","userAgent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36","campaignId":"46x01x8x-x899-404x-xxx9-111xx393d1x7","id":"85219a90-1234-1234-1234-axx5xx4xxxfxxxx","clickIP":"89.160.20.112","sender":"abc123@example.com","recipient":"b81458bb9f757994e79a9287b8447622@example.com","senderIP":"81.2.69.143","GUID":"JXXXXaXehXHXzX-XxXhXyXXXXX7","threatID":"eaxxxxxxxxxxxx6376xxxxxxxxxxx1cba65xxx9x7xxxxxxxxxxfbbxx4x0","threatURL":"https://threatinsight.proofpoint.com/a2abc123-1234-1234-1234-babcded1234/threat/email/eaxxxxxa6597fd3xxxxxxxxx92e4xxxxxxxxxx27c98052fxxxxxxxxxx1234","threatStatus":"active","messageID":"12345678912345.12345.mail@example.com"}
{"url":"https://www.example.org/abcdabcd123?query=0","classification":"malware","clickTime":"2022-03-30T10:11:12.000Z","threatTime":"2022-03-21T14:40:31.000Z","userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/199.0.427504638 Mobile/15E148 Safari/604.1","campaignId":"46x01x8x-x899-404x-xxx9-111xx393d1x7","id":"a5c9f8bb-1234-1234-1234-dxx9xcxxxx8xxxc","clickIP":"89.160.20.112","sender":"abc123@example.com","recipient":"9c52aa64228824247c48df69b066e5a7@example.com","senderIP":"81.2.69.143","GUID":"XXcXXxXDXVXXXXXXXXXXXX4XXXXX","threatID":"502bxxxxxxxxxxx70513b6cxxxxxxxxxxxxebc7fc699xxxxxxxxxxxxxxxxd5f","threatURL":"https://threatinsight.proofpoint.com/a2abc123-1234-1234-1234-babcded1234/threat/email/502xxxxxxxxxcebxxxxxxxxxxa04277xxxxx5dxc6xxxxxxxxx5f","threatStatus":"active","messageID":"12345678912345.12345.mail@example.com"}
{"url":"https://www.example.org","classification":"spam","clickTime":"2022-03-30T10:01:01.000Z","threatTime":"2022-03-14T05:59:12.000Z","userAgent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36","campaignId":"46x01x8x-x899-404x-xxx9-111xx393d1x7","id":"d35cc5fc-1234-1234-1234-2xxx0xaxbxcxx","clickIP":"89.160.20.112","sender":"abc123@example.com","recipient":"xyz@example.com","senderIP":"81.2.69.143","GUID":"uHXXXJXTXlXDXmXgXTX3XOXLNXVXNX3XXXHX","threatID":"47580xdx0x2x5x2xfx8x3x3x7x7xxxxcx6x7x4x4x1xexcx5cx9x3xfxfxxx1","threatURL":"https://threatinsight.proofpoint.com/a2abc123-1234-1234-1234-babcded1234/threat/email/4xxxxd02xxxxxxxxxxxxcacf9da3xxxxxxxxxxx9a947xxxxxxxxxx1","threatStatus":"active","messageID":"12345678912345.12345.mail@example.com"}
{"queryEndTime":"2024-10-11T14:34:53Z","clicksBlocked":[]}
Copy link
Contributor

Choose a reason for hiding this comment

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

newline ?

@efd6 efd6 enabled auto-merge (squash) October 21, 2024 09:18
@elasticmachine
Copy link

💚 Build Succeeded

History

cc @efd6

@efd6 efd6 merged commit f057d3a into elastic:main Oct 21, 2024
@elastic-sonarqube
Copy link

@elastic-vault-github-plugin-prod

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

harnish-crest-data pushed a commit to chavdaharnish/integrations that referenced this pull request Feb 4, 2025
…n made (elastic#11475)

When we receive no event from the Proofpoint TAP API, we need to publish an event
even though there is no event to publish. The mechanics of cursor updates in the
HTTPJSON input are that the cursor is updated when an event is published, so if
we get a response with no event, the input assumes that there has been no new
event and so (incorrectly) no progress, but we know that having received an empty
response from the API, there is definitively no event in the requested time slice.
So we can and should avoid querying that time slice again, and should update the
cursor to the end of the time slice. This HTTPJSON behaviour is not documented,
but is visible in the source code and is experimentally verified. So, publish
the parent object in the case that there is no actual event in order to update
the cursor, and adjust the ingest pipeline to allow it to tolerate an empty
response.
harnish-crest-data pushed a commit to chavdaharnish/integrations that referenced this pull request Feb 5, 2025
…n made (elastic#11475)

When we receive no event from the Proofpoint TAP API, we need to publish an event
even though there is no event to publish. The mechanics of cursor updates in the
HTTPJSON input are that the cursor is updated when an event is published, so if
we get a response with no event, the input assumes that there has been no new
event and so (incorrectly) no progress, but we know that having received an empty
response from the API, there is definitively no event in the requested time slice.
So we can and should avoid querying that time slice again, and should update the
cursor to the end of the time slice. This HTTPJSON behaviour is not documented,
but is visible in the source code and is experimentally verified. So, publish
the parent object in the case that there is no actual event in order to update
the cursor, and adjust the ingest pipeline to allow it to tolerate an empty
response.
@efd6 efd6 deleted the s5180-proofpoint_tap-publish_cursor branch February 5, 2025 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes a bug issue Integration:proofpoint_tap Proofpoint TAP Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants