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

[Filebeat][http_endpoint input] Adds support for custom auth header names and secret #20435

Merged
merged 8 commits into from
Aug 10, 2020

Conversation

P1llus
Copy link
Member

@P1llus P1llus commented Aug 4, 2020

What does this PR do?

Certain webhooks offers functionality to add a custom header and defined secret to each request to identify the source. This PR adds the possibility to configure the header name and secret that needs to be confirmed for every request, similar but not the same as basic auth.

Why is it important?

Required for certain modules like Zoom #20414

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • Updated docs
  • Updated nosetests

Added nosetest for wrong configuration option, ensuring that anything not matching header+secret is dropped and that a successful match allows the request with the correct responses.
Tested with:

> INTEGRATION_TESTS=1 BEAT_STRICT_PERMS=false nosetests -v -s tests/system/test_http_endpoint.py 
Test http_endpoint input with correct auth header and secret. ... ok
Test http_endpoint input with empty body. ... ok
Test http_endpoint input with GET request. ... ok
Test http_endpoint input with malformed body. ... ok
Test http_endpoint input with missing basic auth values. ... ok
Test http_endpoint input with HTTP events. ... ok
Test http_endpoint input with wrong auth header and secret. ... ok
Test http_endpoint input with wrong basic auth values. ... ok
Test http_endpoint input with wrong content header. ... ok

@elasticmachine
Copy link
Collaborator

Pinging @elastic/siem (Team:SIEM)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Aug 4, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 4, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #20435 updated]

  • Start Time: 2020-08-10T11:06:23.876+0000

  • Duration: 52 min 44 sec

Test stats 🧪

Test Results
Failed 0
Passed 2446
Skipped 397
Total 2843

@P1llus
Copy link
Member Author

P1llus commented Aug 5, 2020

I added the changes you requested @andrewstucki . I did not hardcode a header value though, as currently this does not have a "secret.enable true/false". So the config validation checks expects both to either be nil or both set to a value.

@P1llus P1llus requested a review from urso August 5, 2020 08:17
@P1llus
Copy link
Member Author

P1llus commented Aug 5, 2020

Jenkins test this

@P1llus P1llus requested a review from urso August 10, 2020 11:05
@urso urso merged commit d4fb2bc into elastic:master Aug 10, 2020
@urso urso added the v7.10.0 label Aug 10, 2020
@P1llus P1llus deleted the filebeat_http_endpoint_headersecret branch August 10, 2020 17:58
urso pushed a commit to urso/beats that referenced this pull request Aug 12, 2020
urso pushed a commit that referenced this pull request Aug 12, 2020
…rt for custom auth header names and secret (#20519)

Co-authored-by: Marius Iversen <pillus@chasenet.org>
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
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.

4 participants