Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Smart Web Security
  • Getting started
    • All guides
    • Address lists
    • Viewing operations
    • Configuring monitoring
    • Setting up alerts
    • Configuring logs via Smart Web Security
    • Configuring logs via Application Load Balancer
    • Migrating to the new condition format in the API, CLI, and Terraform
    • Overview
    • Security profiles
    • WAF
    • ARL (request limit)
    • Rules
    • Conditions
    • Lists
    • Managing bot traffic
    • Protecting domains
    • Response templates
    • Logging
    • Quotas and limits
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes

In this article:

  • Updating current configurations
  • Condition description format
  • Updating the CLI
  • Examples of using new fields
  1. Step-by-step guides
  2. Migrating to the new condition format in the API, CLI, and Terraform

Updating the condition format in the API, CLI, and Terraform

Written by
Yandex Cloud
Updated at June 19, 2026
  • Updating current configurations
  • Condition description format
  • Updating the CLI
  • Examples of using new fields

Warning

Starting June 9, 2026, Yandex Smart Web Security will migrate to the new format of conditions and field names in security profile, WAF, and ARL rules. If using the API, CLI, or Terraform, update your commands and configurations.

Earlier, multiple values in the same condition were provided as a list. Now you need to combine such values into a single text field, separated by |.

The http_methods, authorities, ja3_ranges, and ja4_ranges fields got new names.

Updating current configurationsUpdating current configurations

All rules created in the old format will be automatically migrated to the new one. The migration will not affect your security settings.

Condition description format {matching-format}Condition description format

Field in old format

Field in new format

http_methods:

  • GET
  • POST

http_method_matcher:

GET|POST

authorities:

  • example.com
  • example.net

authority_matcher:

example\.com|example\.net

ja3_ranges:

  • d4e5f6a7b8c9
  • a1b2c3d4e5f6

ja3_matcher:

d4e5f6a7b8c9|a1b2c3d4e5f6

ja4_ranges:

  • t13d1516h2_8daaf6152771
  • t13d1812h2_c73b8a5f9d24

ja4_matcher:

t13d1516h2_8daaf6152771|t13d1812h2_c73b8a5f9d24

If the old configuration used different condition types for these fields, combine them into a regular expression.

Example of different condition types in the old format:

exact_match = example.com
exact_not_match = example.net
prefix_match = aaa/
prefix_match = bbb
prefix_not_match = ccc
pire_regex_match = d.*
pire_regex_not_match = f.*

Example of combining conditions in the new format:

"pireRegexMatch": "example\.com|~(example\.net)|aaa(|/.*)|bbb.*|~(ccc)|d.*|~(f.*)"

If in your regular expression the special characters (, ), {, }, [, ], ., *, +, ?, ^, $, |, \, &, or ~ are used as regular characters, escape them with \.

The ~ symbol can be used as logical negation.

In addition to regular expressions, you can combine conditions using lists of strings or lists of regular expressions.

Updating the CLIUpdating the CLI

  1. Update the CLI to the latest version:

    yc components update
    
  2. View the new field format in the create and update commands:

    yc smartwebsecurity security-profile create -h
    yc smartwebsecurity security-profile update -h
    

Examples of using new fieldsExamples of using new fields

CLI
Terraform
API

If you provide parameters directly in the command, replace the old fields with the new ones:

yc smartwebsecurity security-profile create \
  --name security-profile \
  --default-action ALLOW \
  --security-rules '[
    {
      name = "security-rule",
      priority = 1,
      dry-run = false,
      rule-specifier = {
        rule-condition = {
          action = DENY,
          condition = {
            authority = {
              authority-matcher = {
                match = {
                  pire-regex-match = "example1|example2"
                }
              }
            },
            http-method = {
              http-method-matcher = {
                match = {
                  pire-regex-match = "GET|POST"
                }
              }
            },
            finger-print = {
              ja3-matcher = {
                match = {
                  pire-regex-match = "d4e5f6a7b8c9|a1b2c3d4e5f6"
                }
              },
              ja4-matcher = {
                match = {
                  pire-regex-match = "t13d1516h2_8daaf6152771|t13d1812h2_c73b8a5f9d24"
                }
              }
            }
          }
        }
      }
    }
  ]'

Example of a command with new fields for lists:

yc smartwebsecurity security-profile create \
  --name security-profile \
  --default-action ALLOW \
  --security-rules '[
    {
      name = "security-rule",
      priority = 1,
      dry-run = false,
      rule-specifier = {
        rule-condition = {
          action = DENY,
          condition = {
            source-ip = {
              asn-lists-match = {
                list-ids = ["<list_1_ID>", "<list_2_ID>"]
              },
              asn-lists-not-match = {
                list-ids = ["<list_1_ID>", "<list_2_ID>"]
              }
            },
            authority = {
              authority-matcher = {
                match = {
                  lists-matchers = {
                    str-lists-match = {
                      list-ids = ["<list_ID>"]
                    },
                    str-lists-not-match = {
                      list-ids = ["<list_ID>"]
                    },
                    reg-exp-lists-match = {
                      list-ids = ["<list_ID>"]
                    },
                    reg-exp-lists-not-match = {
                      list-ids = ["<list_ID>"]
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  ]'

If you are using a rules file, update the field names and condition values in it.

Learn more about the security-profile create and security-profile update commands in the CLI reference.

In the Terraform configuration, replace the old fields in blocks of conditions:

resource "yandex_sws_security_profile" "yandex-sws-security-profile" {
  name = "test-terraform-yandex-sws-security-profile"
  default_action = "ALLOW"

  security_rule {
    name = "rule-condition-migration"
    priority = 4

    rule_condition {
      action = "ALLOW"

      condition {
        authority {
          authority_matcher {
            pire_regex_match = "example1|example2"
          }
        }
        http_method {
          http_method_matcher {
            pire_regex_match = "GET|POST"
          }
        }
        finger_print {
          ja3_matcher {
            pire_regex_match = "d4e5f6a7b8c9|a1b2c3d4e5f6"
          }
          ja4_matcher {
            pire_regex_match = "t13d1516h2_8daaf6152771|t13d1812h2_c73b8a5f9d24"
          }
        }
      }
    }
  }
}

Example of a configuration with new fields for lists:

resource "yandex_sws_security_profile" "yandex-sws-security-profile" {
  name = "test-terraform-yandex-sws-security-profile"
  default_action = "ALLOW"

  security_rule {
    name = "rule-condition-new-lists"
    priority = 5

    rule_condition {
      action = "ALLOW"

      condition {
        source_ip {
          asn_lists_match {
            list_ids = ["<list_1_ID>", "<list_2_ID>"]
          }
          asn_lists_not_match {
            list_ids = ["<list_1_ID>", "<list_2_ID>"]
          }
        }

        authority {
          authority_matcher {
            lists_matchers {
              str_lists_match {
                list_ids = ["<list_ID>"]
              }
              str_lists_not_match {
                list_ids = ["<list_ID>"]
              }
              reg_exp_lists_match {
                list_ids = ["<list_ID>"]
              }
              reg_exp_lists_not_match {
                list_ids = ["<list_ID>"]
              }
            }
          }
        }
      }
    }
  }
}

For more on yandex_sws_security_profile properties, see this provider guide.

Example of a request with new fields:

curl -X POST \
  'https://smartwebsecurity.api.cloud.yandex.net/smartwebsecurity/v1/securityProfiles' \
  -H "Authorization: Bearer $(yc iam create-token)" \
  -H 'Content-Type: application/json' \
  -d '{
    "folderId": "<folder_ID>",
    "name": "security-profile",
    "defaultAction": "ALLOW",
    "securityRules": [
      {
        "name": "rule-condition-migration",
        "priority": 4,
        "ruleCondition": {
          "action": "ALLOW",
          "condition": {
            "authority": {
              "authorityMatcher": {
                "pireRegexMatch": "example1|example2"
              }
            },
            "httpMethod": {
              "httpMethodMatcher": {
                "pireRegexMatch": "GET|POST"
              }
            },
            "fingerPrint": {
              "ja3Matcher": {
                "pireRegexMatch": "d4e5f6a7b8c9|a1b2c3d4e5f6"
              },
              "ja4Matcher": {
                "pireRegexMatch": "t13d1516h2_8daaf6152771|t13d1812h2_c73b8a5f9d24"
              }
            }
          }
        }
      }
    ]
  }'

Example of a request with new fields for lists:

curl -X POST \
  'https://smartwebsecurity.api.cloud.yandex.net/smartwebsecurity/v1/securityProfiles' \
  -H "Authorization: Bearer $(yc iam create-token)" \
  -H 'Content-Type: application/json' \
  -d '{
    "folderId": "<folder_ID>",
    "name": "security-profile",
    "defaultAction": "ALLOW",
    "securityRules": [
      {
        "name": "rule-condition-new-lists",
        "priority": 5,
        "ruleCondition": {
          "action": "ALLOW",
          "condition": {
            "sourceIp": {
              "asnListsMatch": {
                "listIds": [
                  "<list_1_ID>",
                  "<list_2_ID>"
                ]
              },
              "asnListsNotMatch": {
                "listIds": [
                  "<list_1_ID>",
                  "<list_2_ID>"
                ]
              }
            },
            "authority": {
              "authorityMatcher": {
                "listsMatchers": {
                  "strListsMatch": {
                    "listIds": [
                      "<list_ID>"
                    ]
                  },
                  "strListsNotMatch": {
                    "listIds": [
                      "<list_ID>"
                    ]
                  },
                  "regExpListsMatch": {
                    "listIds": [
                      "<list_ID>"
                    ]
                  },
                  "regExpListsNotMatch": {
                    "listIds": [
                      "<list_ID>"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    ]
  }'

For more on methods, see the REST API reference: SecurityProfile.Create and SecurityProfile.Update for the SecurityProfile resource.

See alsoSee also

  • Creating a security profile
  • Editing basic settings of a security profile
  • Adding a rule to a security profile
  • Editing a rule in a security profile

Was the article helpful?

Previous
Configuring logs via Application Load Balancer
Next
All tutorials
© 2026 Direct Cursus Technology L.L.C.