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] Add HMAC template function for httpjson input #27168

Merged
merged 3 commits into from
Aug 4, 2021

Conversation

legoguy1000
Copy link
Contributor

@legoguy1000 legoguy1000 commented Jul 30, 2021

What does this PR do?

Adds a [[hmac "sha256" "secret" "string1" (formatDate (now) "RFC1123")]] function that can be used to calculate hmac signatures for API authentication.

Why is it important?

A lot of APIs use an HMAC signature to authenticate API calls. These signatures need to be generated at runtime, usually comprised of elements of the call. See https://docs.fireeye.com/iSight/index.html#/authentication as an example. Also https://elasticstack.slack.com/archives/CNEDGGJQ3/p1627286354468400

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

  • [ ]

How to test this PR locally

Run the integration tests located at x-pack/filebeat/input/httpjson/internal/v2/value_tpl_test.go

Related issues

Use cases

https://docs.fireeye.com/iSight/index.html#/authentication

Screenshots

Logs

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 30, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 30, 2021

💚 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: 2021-08-04T07:32:59.283+0000

  • Duration: 88 min 31 sec

  • Commit: f35a517

Test stats 🧪

Test Results
Failed 0
Passed 7908
Skipped 1201
Total 9109

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 7908
Skipped 1201
Total 9109

@legoguy1000
Copy link
Contributor Author

@kaiyan-sheng I'd be interested in your thoughts on this one.

Copy link
Contributor

@kaiyan-sheng kaiyan-sheng left a comment

Choose a reason for hiding this comment

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

This looks good to me. But I'm not familiar with the httpjson input code :) @P1llus @marc-gr Could you take a look please? Thanks!

@elasticmachine
Copy link
Collaborator

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

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Aug 2, 2021
@kaiyan-sheng kaiyan-sheng added the backport-v7.15.0 Automated backport with mergify label Aug 2, 2021
@kaiyan-sheng
Copy link
Contributor

/test

Copy link
Contributor

@marc-gr marc-gr left a comment

Choose a reason for hiding this comment

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

All looks good! just a minor renaming for consistency and will be good to go :)

x-pack/filebeat/input/httpjson/internal/v2/value_tpl.go Outdated Show resolved Hide resolved
@legoguy1000
Copy link
Contributor Author

@marc-gr changes made.

@marc-gr
Copy link
Contributor

marc-gr commented Aug 4, 2021

/test

@marc-gr marc-gr merged commit a0452d9 into elastic:master Aug 4, 2021
mergify bot pushed a commit that referenced this pull request Aug 4, 2021
* Add HMAC template function for httpjson input

* Updates per comment

* Rename parameters in function body

Co-authored-by: Marc Guasch <[email protected]>
(cherry picked from commit a0452d9)
marc-gr pushed a commit that referenced this pull request Aug 4, 2021
…7228)

* Add HMAC template function for httpjson input

* Updates per comment

* Rename parameters in function body

Co-authored-by: Marc Guasch <[email protected]>
(cherry picked from commit a0452d9)

Co-authored-by: Alex Resnick <[email protected]>
@legoguy1000 legoguy1000 deleted the add-hmac-httpjson branch August 4, 2021 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v7.15.0 Automated backport with mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants