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

Support for JsonBody in fields to match on WAF ByteMatch rule #18515

Closed
chrisportela opened this issue Apr 1, 2021 · 8 comments · Fixed by #24772
Closed

Support for JsonBody in fields to match on WAF ByteMatch rule #18515

chrisportela opened this issue Apr 1, 2021 · 8 comments · Fixed by #24772
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/wafv2 Issues and PRs that pertain to the wafv2 service.
Milestone

Comments

@chrisportela
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Was trying to implement some WAF rules and noticed that the Console lets you make ones which target the parsed JsonBody instead of the raw Body.

This feature was released Feb 2021 and would be very helpful in blocking invalid requests.

New or Affected Resource(s)

  • aws_wafv2_web_acl

Potential Terraform Configuration

Just the statement portion for hypothetically ensuring a graphql query has "viewer" somewhere in the query field.

statement {
    byte_match_statement {
    field_to_match {
      json_body = {
        match_scope = "ALL"
        invalid_fallback_behavior = "NO_MATCH"
        match_pattern = {
          included_paths = ["/query"]
        }
      }
    }
    positional_constraint = "CONTAINS_WORD"
    search_string = "viewer"
    text_transformation = {
      priority = 0
      type = "NONE"
    }
  }
}

References

@chrisportela chrisportela added the enhancement Requests to existing resources that expand the functionality or scope. label Apr 1, 2021
@ghost ghost added the service/wafv2 Issues and PRs that pertain to the wafv2 service. label Apr 1, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 1, 2021
@anGie44 anGie44 removed the needs-triage Waiting for first response or review from a maintainer. label Apr 1, 2021
@nevelis
Copy link

nevelis commented Mar 29, 2022

It's been over a year since this feature came out, and nearly as long since this was reported. One of our rules requires json_body and we cannot describe our WAF infrastructure without this.

Given that there is no activity on this, I'm hoping someone has had some luck with a workaround. Any ideas short of using a null_resource with the CLI to do this properly? :(

@steveorourke
Copy link
Contributor

Blocked on this as well. I'll put together a PR, if no one else has made a start.

@tiborhercz
Copy link
Contributor

tiborhercz commented Aug 26, 2022

I see that this PR is stale for a long time. Which is a shame because of the work that is done by @steveorourke.
I will review and test the code and make sure it will get merged.

@tiborhercz
Copy link
Contributor

tiborhercz commented Aug 26, 2022

Code has been reviewed and tested. LGMT! 👍🏼
@steveorourke I have suggested some small changes to the code and documentation. Let me know what you think

@steveorourke
Copy link
Contributor

steveorourke commented Aug 28, 2022

Thanks @tiborhercz. I've accepted all suggestions.

@tiborhercz
Copy link
Contributor

Thanks @steveorourke
Code has been reviewed and tested. LGMT! 👍🏼

@bschaatsbergen Could you please also take a look?

@github-actions github-actions bot added this to the v4.29.0 milestone Aug 30, 2022
@github-actions
Copy link

github-actions bot commented Sep 2, 2022

This functionality has been released in v4.29.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Oct 3, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/wafv2 Issues and PRs that pertain to the wafv2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants