Script behavior rule

akamai_appsec_script_behavior_rule

Create and modify a CPC script behavior rule for a security policy. To delete a script behavior rule, run terraform destroy.

Note: This feature requires the policy to have a CPC configuration.

resource "akamai_appsec_script_behavior_rule" "my_rule" {
  config_id          = 12345
  security_policy_id = "abcd_123456"

  rule_name        = "Block PCI Data Access"
  rule_description = "Prevents third-party scripts from accessing payment card data"
  activity_type    = "DATA_ACCESS"
  action           = "deny"

  page_condition = "MATCHES"
  page_values    = ["/checkout", "/billing/*"]

  script_type      = "THIRD_PARTY"
  script_condition = "MATCHES"
  script_values    = ["analytics.example.com/*"]

  activity_values_condition = "MATCHES"
  activity_values           = ["CREDIT_CARD", "PII"]
}

Arguments

Pass all required arguments to create a script behavior rule. Each rule you create controls one combination of activity type, action, page scope, and script scope. Manage multiple rules by declaring multiple instances of this resource.

ArgumentRequiredDescription
config_id✔️A security configuration ID. Changing this value forces creation of a new resource.
security_policy_id✔️A security policy ID. Changing this value forces creation of a new resource.
rule_name✔️The name of the script behavior rule.
activity_type✔️The category of client-side activity the rule governs. Possible value is DATA_ACCESS.
action✔️Action taken when all rule conditions match. Possible values are:
  • alert. Records the event.
  • deny. Blocks the script from performing the specified activity.
page_condition✔️How page_values are evaluated. Possible value is MATCHES. This value triggers the rule when the request URL matches any value in the list.
page_values✔️A list of page URL path patterns. Supports wildcards; for example, /billing/* matches all paths under /billing/.
script_condition✔️How script_values are evaluated. Possible value is MATCHES that targets scripts whose origin matches any value in the list.
script_values✔️A list of script origin host patterns the rule targets.
activity_values_condition✔️How activity_values are evaluated. Possible value is MATCHES. It applies the rule when the activity involves any of the listed data types.
activity_values✔️A list of specific data types the rule targets. Possible values are CREDIT_CARD and PII.
rule_descriptionA human-readable description of the script behavior rule.
script_typeThe script category the rule targets. Possible value is THIRD_PARTY that applies the rule only to scripts loaded from external domains.

Attributes

Returned is your script behavior's rule_id. Use this ID to reference the rule in the Script behavior rule data source.


Did this page help you?