【发布时间】:2021-01-13 15:27:47
【问题描述】:
我想阻止不包含授权标头的请求。我想出了以下规则,但我看到不包含此标头的请求也被允许。指定此条件的正确方法是什么?
rule {
name = "restrict-requests-without-authorization-header"
priority = 2
action {
block {}
}
statement {
size_constraint_statement {
field_to_match {
single_header {
name = "authorization"
}
}
comparison_operator = "LE"
size = 0
text_transformation {
priority = 0
type = "NONE"
}
}
}
visibility_config {
cloudwatch_metrics_enabled = true
metric_name = "restrict-requests-without-authorization-header-metrics"
sampled_requests_enabled = true
}
}
【问题讨论】:
-
明确您所说的“似乎不起作用”可能也很有用。你是如何测试它的,结果如何?
-
您是否尝试过发出 确实 具有
Authorization标头但长度值为零的请求?我想知道如果 Authorization 标头不存在,是否会跳过此规则。使用例如 3 的大小限制并发送带有短和长标头值的请求来检查行为可能会更容易
标签: terraform terraform-provider-aws amazon-waf