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

sophos_central: ensure from_date parameter is within bounds #9143

Merged
merged 1 commit into from Feb 15, 2024

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented Feb 14, 2024

Proposed commit message

The Sophos Central API requires that request are within the last 24 hours, so clamp the from_date parameter to within this constraint to prevent invalid user input or invalid cursors from causing request failure.

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

The Sophos Central API requires that request are within the last 24
hours, so clamp the from_date parameter to within this constraint to
prevent invalid user input or invalid cursors from causing request
failure.
Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No Coverage information No data about Coverage
No Duplication information No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@elasticmachine
Copy link

💚 Build Succeeded

History

cc @efd6

@efd6 efd6 marked this pull request as ready for review February 14, 2024 02:13
@efd6 efd6 requested a review from a team as a code owner February 14, 2024 02:13
@elasticmachine
Copy link

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

@@ -25,8 +25,8 @@ request.transforms:
value: {{tenant_id}}
- set:
target: url.params.from_date
value: '[[.cursor.from_date]]'
default: '[[(now (parseDuration "-{{initial_interval}}")).Unix]]'
value: '[[max .cursor.from_date ((now).Add (parseDuration "-23h59m")).Unix]]'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Choose 23h59m to avoid failure due to skew between now and when the request arrives at the endpoint.

Copy link
Contributor

@kcreddy kcreddy left a comment

Choose a reason for hiding this comment

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

LGTM

@efd6 efd6 merged commit c622611 into elastic:main Feb 15, 2024
5 checks passed
@elasticmachine
Copy link

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

gizas pushed a commit that referenced this pull request Mar 13, 2024
The Sophos Central API requires that request are within the last 24
hours, so clamp the from_date parameter to within this constraint to
prevent invalid user input or invalid cursors from causing request
failure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Sophos_Central] Request time not as aspected on request
3 participants