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

x-pack/filebeat/input/httpjson: fix relation parameter handling in getRFC5988Link #34622

Merged
merged 1 commit into from Mar 21, 2023

Conversation

efd6
Copy link
Contributor

@efd6 efd6 commented Feb 21, 2023

What does this PR do?

Previously the regular expression required a space separating the "rel" tag from previous text. While the examples in RFC5988 show a separating space, the ABNF does not indicate a requirement; the space that does exist in the examples is allowed by RFC2616 because of the implied *LWS rule for token separation.

The new regular expression also more carefully considers quoting for rel parameters and semicolon requirements.

Why is it important?

The existing code rejects valid links.

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

Related issues

Use cases

Screenshots

Logs

@efd6 efd6 added bug Filebeat Filebeat Team:Security-External Integrations backport-v7.17.0 Automated backport with mergify 8.8-candidate backport-v8.7.0 Automated backport with mergify labels Feb 21, 2023
@efd6 efd6 self-assigned this Feb 21, 2023
@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 Feb 21, 2023
@efd6 efd6 force-pushed the 34603-httpjson branch 2 times, most recently from ff4e493 to 0dcd7db Compare February 21, 2023 04:18
@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 21, 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-02-23T20:40:16.191+0000

  • Duration: 74 min 46 sec

Test stats 🧪

Test Results
Failed 0
Passed 2867
Skipped 172
Total 3039

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

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

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@efd6 efd6 marked this pull request as ready for review February 21, 2023 06:02
@efd6 efd6 requested a review from a team as a code owner February 21, 2023 06:02
@elasticmachine
Copy link
Collaborator

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

@efd6 efd6 changed the title x-pack/filebeat/input/httpjson: fix relation parameter in getRFC5988Link x-pack/filebeat/input/httpjson: fix relation parameter handling in getRFC5988Link Feb 21, 2023
@mergify
Copy link
Contributor

mergify bot commented Feb 23, 2023

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b 34603-httpjson upstream/34603-httpjson
git merge upstream/main
git push upstream 34603-httpjson

Previously the regular expression required a space separating the "ral"
tag from previous text. While the examples in RFC5988 show a separating
space, the ABNF does not indicate a requirement; the space that does
exist in the examples is allowed by RFC2616 because of the implied *LWS
rule for token separation.

The new regular expression also more carefully considers quoting for rel
parameters and semicolon requirements.
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

@efd6 efd6 merged commit ba67aa8 into elastic:main Mar 21, 2023
1 check passed
mergify bot pushed a commit that referenced this pull request Mar 21, 2023
…ink (#34622)

Previously the regular expression required a space separating the "ral"
tag from previous text. While the examples in RFC5988 show a separating
space, the ABNF does not indicate a requirement; the space that does
exist in the examples is allowed by RFC2616 because of the implied *LWS
rule for token separation.

The new regular expression also more carefully considers quoting for rel
parameters and semicolon requirements.

(cherry picked from commit ba67aa8)
mergify bot pushed a commit that referenced this pull request Mar 21, 2023
…ink (#34622)

Previously the regular expression required a space separating the "ral"
tag from previous text. While the examples in RFC5988 show a separating
space, the ABNF does not indicate a requirement; the space that does
exist in the examples is allowed by RFC2616 because of the implied *LWS
rule for token separation.

The new regular expression also more carefully considers quoting for rel
parameters and semicolon requirements.

(cherry picked from commit ba67aa8)
efd6 added a commit that referenced this pull request Mar 21, 2023
…ink (#34622) (#34867)

Previously the regular expression required a space separating the "ral"
tag from previous text. While the examples in RFC5988 show a separating
space, the ABNF does not indicate a requirement; the space that does
exist in the examples is allowed by RFC2616 because of the implied *LWS
rule for token separation.

The new regular expression also more carefully considers quoting for rel
parameters and semicolon requirements.

(cherry picked from commit ba67aa8)

Co-authored-by: Dan Kortschak <90160302+efd6@users.noreply.github.com>
efd6 added a commit that referenced this pull request Mar 21, 2023
…parameter handling in getRFC5988Link (#34868)

* x-pack/filebeat/input/httpjson: fix relation parameter in getRFC5988Link (#34622)

Previously the regular expression required a space separating the "ral"
tag from previous text. While the examples in RFC5988 show a separating
space, the ABNF does not indicate a requirement; the space that does
exist in the examples is allowed by RFC2616 because of the implied *LWS
rule for token separation.

The new regular expression also more carefully considers quoting for rel
parameters and semicolon requirements.

(cherry picked from commit ba67aa8)

* remove irrelevant changelog lines
* use common.MapStr
* adjust test for previous split behaviour
  Between 7.17 and 8.6, the capacity to split link headers from single strings was
  added, so make each link a single string

---------

Co-authored-by: Dan Kortschak <90160302+efd6@users.noreply.github.com>
Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
…ink (#34622)

Previously the regular expression required a space separating the "ral"
tag from previous text. While the examples in RFC5988 show a separating
space, the ABNF does not indicate a requirement; the space that does
exist in the examples is allowed by RFC2616 because of the implied *LWS
rule for token separation.

The new regular expression also more carefully considers quoting for rel
parameters and semicolon requirements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.8-candidate backport-v7.17.0 Automated backport with mergify backport-v8.7.0 Automated backport with mergify bug Filebeat Filebeat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filebeat input httpjson getRFC5988Link parsing failure
3 participants