tencent cloud

Configuring Security Protection

Download
Focus Mode
Font Size
Last updated: 2026-11-17 14:27:52
AI-Translated
This document describes how to configure security protection to help you ensure the secure running of model services from two dimensions: AI content security and network access control.

Introduction

WAF LLM Security

The AI content security protection capability provided by WAF is designed specifically for large model application scenarios. It performs real-time security detection on interactions between users and large models to prevent risks such as Prompt injection attacks, sensitive information leakage, and harmful content generation, ensuring the secure and compliant running of large model services.

Core Features

Prompt Injection Attack Detection: Identify and block malicious Prompt injection attempts that try to bypass model security restrictions.
Sensitive Information Leakage Protection: Detect whether model responses contain sensitive information such as ID card numbers, phone numbers, and bank card numbers.
Harmful Content Generation Detection: Identify prohibited content such as pornographic, violent, or politically sensitive material in model-generated content.
Continuous Conversation Content Detection: Supports correlation analysis of contexts across multi-turn sessions to detect attack behaviors hidden within them.

Security group

It is a stateful virtual firewall used to configure network access control for CMR instances. You can allow or deny inbound and outbound traffic for specified protocols and ports by configuring security group rules.

Core Features

Logical Grouping: You can add CMR instances within the same region that have identical network security isolation requirements to the same security group.
Default Deny: When no rules are added to a security group, all inbound and outbound traffic is denied by default. You need to add allow rules as needed.
Stateful: For allowed inbound traffic, the system automatically allows it to flow out.
Immediate Effect: After you modify a security group rule, the new rule takes effect immediately without requiring an instance restart.
Rule Priority: Rules in a security group are matched in list order from top to bottom. The first matching rule is executed immediately, and subsequent rules are no longer matched.

Rule Composition

Each security group rule consists of the following components:
Field
Description
Source or Destination
Source address of traffic (inbound rule) or destination address (outbound rule). Supports CIDR blocks, IP addresses, IP address groups, security groups, and the current login IP address.
Protocol
Protocol type (such as TCP and UDP).
Port
Port number.
Policy
Allow or deny.
Remarks
Description of the rule.

Multiple Security Groups

A CMR instance can be bound to one or more security groups. When an instance is bound to multiple security groups, the system matches rules in descending order of security group priority. You can adjust the priority of security groups in the security group list.
Attention:
If no matching rule is found in a higher-priority security group, the system continues to match the next security group. We recommend that you place the strictest rules in higher-priority security groups.

Prerequisites

1. It is recommended to read Usage Constraints and Supported Models in advance for relevant information.
2. A CMR instance has been created. For detailed instructions, see Creating a CMR Instance.
3. A BYOK instance has been created. For detailed instructions, see Creating a BYOK Instance.
4. You have purchased a WAF instance and the Large Model Security add-on feature.

Operation Steps

Steps for WAF LLM Security Operations

Step 1: Enabling Security Protection

1. Log in to the CMR console. On the Instance Management page, click the target instance ID to go to the Basic Information page of the target instance.
2. Go to the Security Protection tab.
3. On the Security Protection page, in the WAF Large Model Security section, click Enable Protection.
4. In the configuration dialog box, configure the following parameters:
Parameter
Description
WAF instance
Select a purchased WAF instance. If the list is empty, purchase a WAF instance first.
Service information
Select the Service to protect. The system automatically pulls the list of Services configured under this instance.
Maximum conversation turns for detection
Set the maximum number of turns for continuous conversation content detection. Value range: 1-20. Default value: 5.
5. Click OK to complete the WAF security protection configuration. After the operation is complete, the security protection status of the instance will change to Enabled, indicating that the instance has been successfully connected to WAF security protection.
Attention:
After you enable WAF security protection, billing starts for the WAF instance. Ensure that your account has sufficient balance.
When you enable protection for the first time, select observation mode. After confirming that business traffic is normal, switch to interception mode to avoid affecting your business due to false positives.
If the WAF instance is not renewed upon expiration, the protection feature will automatically become invalid. Renew it in a timely manner.

Step 2: Viewing Protection Effects

After WAF security protection is enabled, you can view attack statistics and protection logs on the Protection Overview page of the WAF console to check the protection effect:
1. Log in to the WAF console.
2. On the Security Overview page, view attack statistics, including the number of attacks, attack type distribution, and attack trends.
3. Select Attack Logs in the left sidebar to view detailed attack logs, including attack time, attack type, attack source IP address, and interception action.
4. In the left sidebar, select Large Model Security to view protection statistics and detailed logs for the Large Model Security feature.
Note:
When you no longer need WAF protection, you can disable the WAF Large Model Security feature on the Security Protection page of the CMR instance. After it is disabled, WAF stops protecting the CMR instance, but other protection configurations of the WAF instance are not affected.

Security Group Operation Steps

1. Log in to the CMR console. On the Instance Management page, click the target instance ID to go to the Basic Information page of the target instance.
2. Go to the Security Protection tab.
3. On the Security Protection page, in the Security Group Configuration area, click Configure.
4. In the configuration window that appears, select a security group and click OK.
Note:
If you have not created a security group yet, you can create one in the Security Group console. When creating a security group, you can select a Tencent Cloud-provided security group template for quick configuration, or select a custom template to add rules manually. After the security group is created, return to the CMR console to bind it.

Best Practices

1. Multi-Layer Protection Combination

We recommend enabling both WAF Large Model Security and security groups to build a multi-layered security protection system.
Protection Tier
Capability
Recommended Configuration
Content security
WAF LLM Security
Enable Prompt injection detection and harmful content detection, and configure the number of turns for continuous conversation detection based on business requirements.
Network security
Security Group
Allow only the ports and source IP addresses required by the business, and follow the principle of least privilege.

2. Principle of Least Privilege for Security Groups

Allow only the ports required by your business, such as the listening port of the model service.
Limit the source IP address range to trusted business IP addresses, and avoid using 0.0.0.0/0 to allow all sources.
Regularly audit security group rules and delete rules that are no longer in use.

3. Recommendations for Switching Protection Modes

First-time WAF access: We recommend running in observation mode for 1 to 2 weeks and monitoring attack logs and business traffic.
Switch to interception mode: After confirming that no false positives occurred during observation, switch to interception mode during off-peak hours.
Regular inspection: Check WAF protection logs and security group rules every 1 to 2 months to ensure that protection policies align with business requirements.

FAQs

1. Security Group Rules Not Taking Effect After Configuration?

Security group rules take effect immediately after configuration, and no instance restart is required. If a rule does not take effect, check the following:
Confirm that the protocol and port matched by the rule are correct.
Confirm the priority order of rules. Higher-priority rules may be matched and executed first, causing subsequent rules to be skipped.
Confirm whether the instance is associated with the correct security group.
Confirm that the direction of the rule (inbound/outbound) is correct.

2. How to Handle WAF False Positives Blocking Legitimate Requests?

If WAF falsely blocks legitimate requests, you can take the following measures:
Find the blocked requests in the attack logs of the WAF console, and confirm the blocking rules and reasons.
Configure an allowlist for this rule to allow specific IPs, URLs, or parameters.
If the issue lies with the rule itself, you can change the rule's action mode to observation mode in the WAF console, and after confirmation, submit rule optimization feedback to Tencent Cloud.

3. How to Disable Security Protection for a CMR Instance?

Disable WAF protection: On the Security Protection page of the CMR instance, locate the WAF Large Model Security section and click Disable Protection.
Unbind security group: On the Security Protection page of the CMR instance, in the security group configuration area, click Configure and clear the selection of the bound security group.


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback