tencent cloud

Cloud Native Intelligent Gateway

Security Protection Policies

ダウンロード
フォーカスモード
フォントサイズ
最終更新日: 2026-10-15 14:11:21
AI翻訳・品質チェック済み
Security Protection provides unified security management capabilities for AI Gateway, covering all security scenarios through three tabs: Security Policy, TMS, and LLM-WAF. With this feature, you can:
Perform compliance detection on request text through content security (pornography, violence, politically sensitive content, and so on).
Block attacks such as prompt injection and jailbreak through injection protection.
Perform log masking or forwarding masking on private data such as phone numbers and ID card numbers through PII sensitive data detection.
Integrate with Tencent Cloud TMS and WAF LLM Security (LLM-WAF) to gain enhanced detection capabilities.

Prerequisites

An AI Gateway instance has been created.
Use the Content Security / Injection Protection / PII modules:
To use TMS content security, activate the service and purchase a TAS resource pack in the Tencent Cloud TMS console.
To use LLM-WAF semantic protection, activate the LLM Security plan in the Tencent Cloud WAF console and create an SDK access application.
For PII log masking to take effect, ensure that the Log Body Collection switch is enabled (in Model API Details > Basic Information > Log Configuration).

Operation Steps

Step 1: Creating a Content Security Policy

1. Log in to the AI Gateway console and select the target gateway instance to go to its details page.
2. In the left sidebar, choose Security and Configuration > Security Protection to go to the Security Protection page.
3. On the Security Policy Tab, select the Content Security module.
4. Click Create Policy and fill in the following parameters in the dialog box that appears:
Name: Enter the policy name (must start with a letter and can contain digits, -, _).
Term: Enter sensitive words as needed (one term per line or separated by commas).
Request handling after a match: Select to block the request directly (return a security message) or allow it (log only).
Message returned to the client upon interception: Enter the text to be returned to the caller upon interception (optional).
Detection direction: Currently, only input is supported.
Detection failure policy: Select to allow or block the request when an exception occurs, as needed.
Total detection timeout: Enter the time as needed.
Scope: Select Instance-level (all APIs) or Resource-level (select specific APIs).
Description: Enter the policy description (optional).
5. Click Submit to complete the configuration.
Note:
The detection types of the content security module (pornography / violence / politically sensitive content / advertisements / sensitive words) are determined by the associated lexicon and do not need to be configured separately here.

Step 2: Creating an Injection Protection Policy

1. On the Security Protection page, select the Injection Protection module in the Security Policy Tab.
2. Click Create Policy. In the dialog box that appears, fill in the relevant parameters as prompted on the page, and enable the following options in the built-in protection rules:
Prompt injection: Detects inputs that ignore, override, or replace existing instructions.
Instruction override and security policy bypass: Detects instructions that circumvent security rules or forcibly alter model behavior.
Role-play jailbreak: Detects inputs that circumvent security restrictions through fictional characters or jailbreak settings.
System prompt leakage: Detects requests that attempt to extract system prompts, developer messages, or internal rules.
Credential theft: Detects requests that attempt to steal keys, tokens, passwords, or environment variables.
Tool abuse: Detects inducements to call unauthorized or dangerous tools, functions, and commands.
Indirect prompt injection: Detects hidden instructions embedded in documents, web pages, or tool outputs.
3. Click Submit to complete the configuration.
Attention:
The execution action is configured uniformly at the policy level. When any built-in rule or keyword in a policy is matched, the same action is executed uniformly. Setting different actions for individual rules is not supported. If different actions are required, split them into multiple separate policies.

Step 3: Creating a PII Masking Policy

1. On the Security Protection page, select the Sensitive Data Detection (PII) module in the Security Policy Tab.
2. Click Create Policy and fill in the following parameters in the dialog box that appears:
Policy Name: Enter the policy name.
Desensitization scenario: Select log desensitization or forwarding desensitization as needed (choose one).
Built-in masking types: Select at least one: phone number, ID card, bank card number, email address, IP address, or name.
Custom masking rules: To customize masking, click Add Rule and enter the rule name, regular expression, and mask format (optional).
Scope: Select Instance-level (all APIs) or Resource-level (select specific APIs) as needed.
3. Click Save to complete the configuration.
Note:
Log masking applies a mask to data before it is written to the LLM Log (for example, 138****8888), without affecting the original content sent to the LLM. It is suitable for log compliance audit scenarios.
Forwarding masking replaces data with placeholders before it is forwarded to the LLM (for example, {{PII_IDCARD}}), and restores the data after the LLM returns a response. It is suitable for data sovereignty / privacy compliance scenarios, but may affect model output quality.

Step 4: Integrating the TMS Content Security Service

1. At the top of the Security Protection page, click the TMS Tab.
2. Complete the prerequisites by following the 4-step integration guide on the page (activate the service and purchase a resource pack in the Tencent Cloud TMS console).
3. In the Content Security Protection Policy module, click Create Protection Policy and enter the following parameters in the dialog box that appears:
Name: Enter the policy name (must start with a letter and can contain digits, -, _).
BizType: Enter the TMS business type.
Request handling after a match: Select to block the request directly or allow it as needed.
Message returned to the client upon interception: Enter the interception message (optional).
Detection direction: Select the detection direction.
Detection failure policy: Select to allow or block the request when an exception occurs, as needed.
Total detection timeout: Enter the time as needed.
TMS wait timeout: Enter the time as needed.
Scope: Select Instance-level (all APIs) or Resource-level (select specific APIs) as needed.
Description: Enter the policy description (optional).
4. Click Confirm to complete the configuration.
Note:
The TMS Tab and the "Security Policy > Content Security" module manage the same set of content security policies with a single data source. Policies created or modified in either entry are synchronized to the other entry in real time.

Step 5: Integrating LLM-WAF Semantic Protection

1. At the top of the Security Protection page, click the LLM-WAF Tab.
2. Complete the prerequisites by following the 4-step integration guide on the page (purchase the LLM security package in the Tencent Cloud WAF console).
3. In the LLM-WAF Protection Policy module, click Create Protection Policy and enter the following parameters in the dialog box that appears:
Policy Name: Enter the policy name.
WAF Instance: Select a WAF instance with LLM security capabilities enabled.
Service ID: Select an SDK access application with LLM protection enabled.
Interception Message: Enter the interception message (optional).
Detection Failure Policy: Select to allow or block the request when a detection exception occurs, as needed.
Total detection timeout: Enter the time as needed.
WAF wait timeout: Enter the time as needed.
Scope: Select Instance-level (all APIs) or Resource-level (select specific APIs) as needed.
4. Click Submit to complete the configuration.
Attention:
The detection direction and hit actions are configured centrally on the WAF console. After the gateway associates them by Service ID, they take effect automatically.

Other Operations

Viewing, Editing, Disabling, or Deleting Policies

1. In any policy list, you can view the basic information and scope of the policy.
2. In the operation column on the right side of the corresponding policy, you can perform the following operations:
Click Edit to modify the policy configuration.
Click Disable. In the confirmation dialog box, click Disable. The policy stops taking effect immediately, but its configuration is retained and can be re-enabled at any time.
Click Delete. In the confirmation dialog box, click Delete. The policy stops taking effect immediately and cannot be recovered.

ヘルプとサポート

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

フィードバック