tencent cloud

APIs

ModifyWebSecurityTemplate

ダウンロード
フォーカスモード
フォントサイズ
最終更新日: 2026-11-25 16:57:59

1. API Description

Domain name for API request: teo.intl.tencentcloudapi.com.

Modifies a security policy configuration template

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ModifyWebSecurityTemplate.
Version Yes String Common Params. The value used for this API: 2022-09-01.
Region No String Common Params. This parameter is not required.
ZoneId Yes String Site ID. Requires the input of the site to which the target policy template belongs in terms of access privileges. You can use the DescribeWebSecurityTemplates API to query the site to which the policy template belongs.
TemplateId Yes String Policy template ID.
TemplateName No String Name of the policy template after modification. It consists of Chinese characters, letters, digits, and underscores, cannot begin with an underline, and the length cannot exceed 32 characters. If the field is empty, no modification is made.
SecurityPolicy No SecurityPolicy Configuration content of the security policy template. If the value is empty, no modification is made. Submodule structures that are not passed in will not be modified. Currently supports exception rules, custom rules, rate limiting rules, and managed rules in the Web protection module. Configure the security policy through expression syntax. Bot management rule configuration is not currently supported and is under development.
Special note: When a submodule structure is passed in, please ensure that all rule content to be retained is carried. Rule content not passed in is deemed as deletion.

3. Output Parameters

Parameter Name Type Description
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Modify Policy Template Name

Modify the name of the temp-cuwgt1ca Template under the zone-2wkpkd52pku2 site to "Web Protection Standard Template V2".

Input Example

POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyWebSecurityTemplate
<Common request parameters>

{
    "ZoneId": "zone-2wkpkd52pku2",
    "TemplateId": "temp-cuwgt1ca",
    "TemplateName": "Web Protection Standard Template V2"
}

Output Example

{
    "Response": {
        "RequestId": "09ce3d28-1119-49cd-d5a9-27cb34dac669"
    }
}

Example2 Modify Policy Template Configuration Content

Modify the configuration content of the temp-cuwgt1ca Template under the zone-2wkpkd52pku2 site.

Input Example

POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyWebSecurityTemplate
<Common request parameters>

{
    "ZoneId": "zone-2wkpkd52pku2",
    "TemplateId": "temp-cuwgt1ca",
"TemplateName": "Security Template_rename"
    "SecurityPolicy": {
        "CustomRules": {
            "Rules": [
                {
                    "Action": {
                        "Name": "Deny"
                    },
                    "Condition": "${http.request.host} in ['111']",
                    "Enabled": "on",
                    "Id": "1492837231",
                    "Name": "acl1",
                    "Priority": 35,
                    "RuleType": "PreciseMatchRule"
                },
                {
                    "Action": {
                        "Name": "Deny"
                    },
                    "Condition": "${http.request.headers['referer']} in ['123']",
                    "Enabled": "on",
                    "Id": "1492837231",
                    "Name": "iptable1",
                    "Priority": 1,
                    "RuleType": "BasicAccessRule"
                }
            ]
        },
        "ExceptionRules": {
            "Rules": [
                {
                    "Condition": "${http.request.uri.path} in ['/api/v3/test','/api/v3/submit'] ",
                    "Enabled": "on",
                    "Id": "1492837231",
                    "ManagedRuleGroupsForException": [

                    ],
                    "ManagedRulesForException": [
                        "4401215074",
                        "4368124487"
                    ],
                    "Name": "SampleSkipManagedRuleForField",
                    "RequestFieldsForException": [
                        {
                            "Scope": "cookie",
                            "TargetField": "key",
                            "Condition": ""
                        }
                    ],
                    "SkipOption": "SkipOnSpecifiedRequestFields",
                    "SkipScope": "ManagedRules",
                    "WebSecurityModulesForException": [

                    ]
                }
            ]
        },
        "HttpDDoSProtection": {
            "AdaptiveFrequencyControl": {
                "Action": {
                    "ChallengeActionParameters": {
                        "ChallengeOption": "JSChallenge"
                    },
                    "Name": "Challenge"
                },
                "Enabled": "on",
                "Sensitivity": "Loose"
            },
            "BandwidthAbuseDefense": {
                "Action": {
                    "Name": "Monitor"
                },
                "Enabled": "off"
            },
            "ClientFiltering": {
                "Action": {
                    "ChallengeActionParameters": {
                        "ChallengeOption": "JSChallenge"
                    },
                    "Name": "Challenge"
                },
                "Enabled": "on"
            },
            "SlowAttackDefense": {
                "Action": {
                    "Name": "Deny"
                },
                "Enabled": "off",
                "MinimalRequestBodyTransferRate": {
                    "CountingPeriod": "60s",
                    "Enabled": "off",
                    "MinimalAvgTransferRateThreshold": "80bps"
                },
                "RequestBodyTransferTimeout": {
                    "Enabled": "off",
                    "IdleTimeout": "5s"
                }
            }
        },
        "ManagedRules": {
            "AutoUpdate": {
                "AutoUpdateToLatestVersion": "on"
            },
            "DetectionOnly": "on",
            "Enabled": "on",
            "ManagedRuleGroups": [
                {
                    "Action": {
                        "Name": "Monitor"
                    },
                    "GroupId": "wafgroup-webshell-attacks",
                    "MetaData": {
"GroupDetail": "Webshell detection protection"
"GroupName": "Webshell detection protection",
                        "RuleDetails": [
                            {
"Description": "This rule intercepts malicious obfuscated PHP Webshell"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-05-16T03:02:25Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "Protect against php code injection and webshell upload attacks"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2019-04-03T08:25:00Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "This rule intercepts malicious function call features in ASP Webshell and JSP Webshell"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-05-16T03:04:30Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "This rule intercepts the login password features existent in webshells",
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-01-10T09:39:02Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "Detection rule against the Behinder default_json transport protocol\n"
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-07-28T06:24:01Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "Protection rule against asp.net webshell based on the tag feature of asp.net webshell"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-01-19T09:12:31Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "webshell write features that appear in the header"
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-03-31T09:37:39Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "This rule intercepts suspicious function calls in webshells"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-01-12T07:29:50Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "This rule intercepts high-risk function call features in PHP Webshell"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-05-16T03:06:10Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "This rule intercepts variable definition behavior in PHP Webshell",
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-06-13T03:55:11Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "This rule blocks webshell files based on common features of webshell tool connections"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-08-13T06:35:48Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "Protect against java code injection and jsp webshell upload attacks"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2017-11-01T08:53:30Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "Detection rule against the Behinder default_image transport protocol"
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-07-28T06:24:25Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "This rule intercepts sensitive string features that may appear in webshells"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-01-10T09:43:16Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "protect against webshell attacks and detect sensitive variable usage such as $_GET/$_POST"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2018-11-28T06:51:52Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "This rule detects malicious obfuscated Webshell"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-01-12T07:33:55Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "This rule intercepts Webshell with suspicious encoded string features",
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-01-12T07:21:46Z",
                                "Tags": [

                                ]
                            }
                        ]
                    },
                    "RuleActions": [

                    ],
                    "SensitivityLevel": "strict"
                },
                {
                    "Action": {
                        "Name": "Monitor"
                    },
                    "GroupId": "wafgroup-xss-attacks",
                    "MetaData": {
"GroupDetail": "xss cross-site scripting protection"
"GroupName": "xss cross-site scripting protection"
                        "RuleDetails": [
                            {
"Description": "Strict xss rule for scenarios where some html tags are injected",
                                "RiskLevel": "low",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-03-23T05:32:56Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "This rule intercepts HTML injection via the data pseudo-protocol",
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-06-20T06:26:44Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Defends against flash xss attacks in xss attacks and detects access requests for swf files that can call sensitive functions"
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2018-04-18T06:37:44Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Protects sensitive tags and their sensitive properties in cookie fields of HTTP requests against xss attacks, such as attack patterns like <script src=xxx>/<iframe src=javascript:xxx>"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-06-24T12:35:37Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Block the behavior of using the javascript pseudo-protocol in GET request parameters for xss exploitation based on javascript disguised protocol characteristics"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-07-22T03:07:14Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "This rule intercepts sensitive pseudo-protocol call features in XSS attacks"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-11-22T12:31:05Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Protection rule against xss vulnerability in Ecommerse-1.0"
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-11-30T08:47:05Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "Attack pattern that intercepts calls to multiple pseudo-protocols within the same HTML tag"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-08-09T02:41:51Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Protection against javascript pseudo-protocol in xss"
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-04-01T03:47:49Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Protection against some special xss attack detection"
                                "RiskLevel": "low",
                                "RuleId": "1492837231",
                                "RuleVersion": "2024-11-19T06:37:27Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "Protects against some sensitive events and sensitive JS functions in xss attacks, such as onload=xxx and document.cookie",
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2019-01-03T07:36:29Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "This rule intercepts bypass attacks performed by attackers through methods such as entity encoding of browser pseudo-protocols",
                                "RiskLevel": "low",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-10-25T12:34:40Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Protects against common reflection/stored XSS attacks in moderate protection mode"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-08-17T08:25:13Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Scenarios where xss vulnerability type targets output points in js environment, such as using ;new Function(atob(` to execute malicious js code operations",
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2020-12-28T06:29:01Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Defends against reflected/stored XSS attacks in upload requests"
                                "RiskLevel": "low",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-08-17T08:23:02Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "For xss vulnerability type, use on event to execute js. This rule is used to overwrite newly-added on events for javascript execution."
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-01-18T08:14:05Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Protection rule that blocks XSS attempts using the <isindex tag"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-11-30T08:43:55Z",
                                "Tags": [

                                ]
                            },
                            {
"Description": "Protect against flash xss attacks"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2017-11-01T03:03:57Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Defends against xss attacks, detects sensitive operations where attackers call alert/prompt to verify via pop-ups or add malicious DOM nodes"
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2018-01-02T02:05:19Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Defends against attackers targeting XSS vulnerability detection and exploitation behavior"
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-04-02T08:25:47Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Sensitive operation that uses entity encoding in the cookie field of an HTTP request to bypass XSS attack protection"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-06-24T09:24:55Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Strict xss rule, a protection rule against some special encodings"
                                "RiskLevel": "low",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-03-23T12:45:22Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Protect against xss attacks and detect sensitive operations where attackers attempt to inject external JS scripts by calling getScript/CreateElement functions"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2018-01-02T02:09:14Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Defends against sensitive tags and their sensitive properties in xss attacks, such as attack patterns like <script src=xxx>/<iframe src=javascript:xxx>"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2019-12-31T07:48:29Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Detect attack patterns such as data uri/base64 in xss attacks against cookie fields in HTTP requests"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-06-24T10:09:09Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Protection rule against some client prototype chain pollution detection requests"
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-09-03T09:26:42Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Interception rule against specific xss probe payloads in strict mode"
                                "RiskLevel": "low",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-11-10T08:57:34Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Detect attack patterns of data uri/base64 in xss"
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2017-09-01T03:18:36Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Strict xss rule targeting predefined global variables in js"
                                "RiskLevel": "low",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-03-23T05:33:41Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Strict xss rule against scenarios where css is used to execute javascript in IE"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-03-23T04:58:47Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Protect against malicious XSS vulnerability type detection behavior"
                                "RiskLevel": "low",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-03-23T13:17:23Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Defends against XSS attacks that use angularjs features"
                                "RiskLevel": "medium",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-04-06T06:21:17Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Defend against physical encoding bypass attacks in XSS attacks"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2018-01-02T02:21:34Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "xss protection rule in loose mode"
                                "RiskLevel": "extreme",
                                "RuleId": "1492837231",
                                "RuleVersion": "2020-12-07T02:45:26Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Attack pattern that intercepts calls to multiple pseudo-protocols within the same HTML tag"
                                "RiskLevel": "high",
                                "RuleId": "1492837231",
                                "RuleVersion": "2021-08-09T02:40:05Z",
                                "Tags": [
                                    "owasp"
                                ]
                            },
                            {
"Description": "Protection rule against some historic XSS attack vectors"
                                "RiskLevel": "low",
                                "RuleId": "1492837231",
                                "RuleVersion": "2022-05-16T09:28:20Z",
                                "Tags": [
                                    "owasp"
                                ]
                            }
                        ]
                    },
                    "RuleActions": [

                    ],
                    "SensitivityLevel": "strict"
                }
            ],
            "SemanticAnalysis": "off"
        },
        "RateLimitingRules": {
            "Rules": [
                {
                    "Action": {
                        "Name": "Deny"
                    },
                    "ActionDuration": "20h",
                    "Condition": "${http.request.uri.path} in ['/api/v3/test','/api/v3/submit']",
                    "CountBy": [
                        "http.request.ip",
                        "http.request.cookies['UserSession']"
                    ],
                    "CountingPeriod": "2m",
                    "Enabled": "on",
                    "Id": "1492837231",
                    "MaxRequestThreshold": 1000,
                    "Name": "SampleHttpDdosRule",
                    "Priority": 100
                }
            ]
        }
    }
}

Output Example

{
    "Response": {
        "RequestId": "09ce3d28-1119-49cd-d5a9-27cb34dac669"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InvalidParameter.Security Parameter error.

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック