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

add sensitivityLevel support for SQLi WAF rule #38077

Merged
merged 4 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/38077.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_wafv2_web_acl: Add `sensitivity_level` argument to `sqli_match_statement` configuration block
```
2 changes: 2 additions & 0 deletions internal/service/wafv2/flex.go
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ func expandSQLiMatchStatement(l []interface{}) *awstypes.SqliMatchStatement {

return &awstypes.SqliMatchStatement{
FieldToMatch: expandFieldToMatch(m["field_to_match"].([]interface{})),
SensitivityLevel: awstypes.SensitivityLevel(m["sensitivity_level"].(string)),
TextTransformations: expandTextTransformations(m["text_transformation"].(*schema.Set).List()),
}
}
Expand Down Expand Up @@ -2332,6 +2333,7 @@ func flattenSQLiMatchStatement(s *awstypes.SqliMatchStatement) interface{} {

m := map[string]interface{}{
"field_to_match": flattenFieldToMatch(s.FieldToMatch),
"sensitivity_level": s.SensitivityLevel,
"text_transformation": flattenTextTransformations(s.TextTransformations),
}

Expand Down
7 changes: 6 additions & 1 deletion internal/service/wafv2/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,12 @@ func sqliMatchStatementSchema() *schema.Schema {
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"field_to_match": fieldToMatchSchema(),
"field_to_match": fieldToMatchSchema(),
"sensitivity_level": {
Type: schema.TypeString,
Optional: true,
ValidateDiagFunc: enum.Validate[awstypes.SensitivityLevel](),
},
"text_transformation": textTransformationSchema(),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ An SQL injection match condition identifies the part of web requests, such as th
The `sqliMatchStatement` block supports the following arguments:

* `fieldToMatch` - (Optional) Part of a web request that you want AWS WAF to inspect. See [`fieldToMatch`](#field_to_match-block) below for details.
* `sensitivityLevel` - (Optional) The sensitivity that you want WAF to use to inspect for SQL injection attacks. Valid values include: `LOW` or `HIGH`.
* `textTransformation` - (Required) Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to bypass detection. At least one transformation is required. See [`textTransformation`](#text_transformation-block) below for details.

### `xssMatchStatement` Block
Expand Down
Loading