tencent cloud

Web Application Firewall

Skill Security Detection

ダウンロード
フォーカスモード
フォントサイズ
最終更新日: 2026-11-19 16:21:14
AI翻訳

Feature Overview

Skill security detection is a security admission detection capability of Tencent Cloud WAF for AI Agent Skills. It performs automated security scans on third-party Skill packages before listing, integration, and runtime to identify malicious code, Prompt injection, credential theft, supply chain risks, and abnormal runtime behavior.
Traditional Web vulnerability scanning addresses vulnerability issues at the Web application layer, while Skill security detection addresses a more specific category of risks in the AI Agent ecosystem: third-party Skills contain natural language instructions and Prompt commands, as well as code, scripts, dependencies, remote links, and tool invocation logic.
Attackers can hide malicious behavior in documentation, installation scripts, dependency packages, Prompt inducements, or runtime toolchains, while traditional SAST/DAST finds it difficult to fully determine whether the declared functionality is consistent with the actual behavior.
Skill security detection unifies the following three detection capabilities into a single engineering pipeline to perform automated detection on uploaded Skill packages:
Detection Capability
Description
AI semantic audit
Perform semantic analysis on the natural language description and Prompt instructions of the Skill to determine whether the declared feature is consistent with the actual behavior.
Static rule scan
Perform static analysis on the code, scripts, dependencies, and configuration files in the Skill package to identify known malicious patterns.
Dynamic sandbox validation
Run the Skill in an isolated sandbox environment, observe its runtime behavior, and identify abnormal behaviors such as file operations, network exfiltration, and command execution.
After the detection is completed, the system outputs unified risk levels, scores, risk items, and report links for review, remediation, and record-keeping.

Detection Type

The following major threat types are covered by Skill security detection:
Risk Dimension
Description
Supply chain risk
Detect whether third-party packages and remote links that the Skill depends on contain known vulnerabilities or malicious components.
Command injection
Detect whether the Skill code or Prompt contains malicious command execution logic.
Data exfiltration
Detect whether the Skill sends user data or system information to external addresses during runtime.
Prompt injection
Detect whether the Skill description or instructions contain malicious Prompts that hijack model behavior.
Abnormal runtime behavior
Detect abnormal behaviors such as file operations and network access during Skill runtime.
Note:
The complete list of specific risk dimensions and their rating criteria are subject to the actual display in the console, and each dimension will be continuously updated as detection capabilities iterate.

Scenarios

Scenario
Customer Values
Skill Marketplace Listing Review
Identify malicious code, Prompt injection, credential theft, supply chain risks, and runtime abnormal behaviors before third-party Skills are listed.
Internal SkillHub Admission
Establish a unified security baseline for Skills submitted by internal employees or external suppliers.
Batch Rescan of Existing Skills
After rules, models, or sandbox capabilities are upgraded, perform version-based rescans on historical Skills.
Automated Integration via OpenAPI
Support customer platforms, CI/CD, and operations backends in calling upload and query APIs.
Security Operations and Audit
Output traceable scan conclusions, risk items, scores, and reports to facilitate review, remediation, and record-keeping.

Detection Process

Prerequisites

The LLM security feature has been connected through the SDK/API Integration method, and access credentials have been obtained.

Specifications

Skill security detection reuses historical detection results for the same Skill based on the SHA256 Hash of the file content to avoid duplicate scanning. However, the ZIP file format records metadata such as modification time and file system attributes in the file header. Even if the source file content is identical, the ZIP binary produced by packaging in different environments may differ, resulting in inconsistent hashes and the inability to reuse results. Therefore, before calling the upload API, you must package the ZIP according to the following specifications to ensure that the same Skill directory always produces a consistent ContentHash.

Packaging Specifications
:
Configuration Item
Requirement
Packaging Method
Use the built-in ZIP library of the programming language for packaging, such as Go archive/zip and Python zipfile.
File Sorting
Sort by path byte order, which is equivalent to running LC_ALL=C sort in the Shell.
Timestamp.
Fixed to 2000-01-01 00:00:00 UTC.
Compression Algorithm
DEFLATE, with the compression level fixed at 6.
Permissions for the file.
Fixed to 0644.
Extra Field / Comment
Do not write.
Directory Entries
Do not write directory entries separately. The directory structure is reflected by the file paths themselves.
File Filtering
All files in the Skill directory must be packaged without any filtering or exclusion.

Packaging Example

Go Language

The following example demonstrates how to use Go to package a Skill directory into a ZIP file according to the specifications and generate a Base64-encoded string that can be used as the FileData parameter of the UploadSkillSecScan API.
1. Replace /path/to/skill_dir with the path to the Skill directory to be detected.
2. Run the program to obtain the Base64-encoded string and ContentHash.
3. Pass the Base64 string as the FileData parameter to the UploadSkillSecScan API.
package main

import (
"archive/zip"
"bytes"
"compress/flate"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"fmt"
"io"
"os"
"path/filepath"
"sort"
"strings"
"time"
)

// Fixed timestamp: 2000-01-01 00:00:00 UTC
var fixedModTime = time.Date(2000, 1, 1, 0, 0, 0, 0, time.UTC)

func packSkillDir(skillDir string) ([]byte, error) {
// 1. Collect relative paths of all files
var files []string
err := filepath.Walk(skillDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if info.IsDir() {
return nil // Do not write directory entry
}
rel, err := filepath.Rel(skillDir, path)
if err != nil {
return err
}
// Use / as the path separator in the ZIP file
files = append(files, filepath.ToSlash(rel))
return nil
})
if err != nil {
return nil, err
}

// 2. Sort by path byte order (equivalent to LC_ALL=C sort)
sort.Strings(files)

// 3. Write ZIP (compression level 6, fixed timestamp, fixed permission 0644)
buf := new(bytes.Buffer)
zw := zip.NewWriter(buf)
// Explicitly register a deflate writer at compression level 6 to ensure stable output across Go versions
zw.RegisterCompressor(zip.Deflate, func(out io.Writer) (io.WriteCloser, error) {
return flate.NewWriter(out, 6)
})

for _, rel := range files {
header := &zip.FileHeader{
Name: rel,
Method: zip.Deflate,
Modified: fixedModTime,
}
header.SetMode(0644)
// Do not write Extra Field / Comment
header.Extra = nil
header.Comment = ""

w, err := zw.CreateHeader(header)
if err != nil {
return nil, err
}
f, err := os.Open(filepath.Join(skillDir, filepath.FromSlash(rel)))
if err != nil {
return nil, err
}
if _, err := io.Copy(w, f); err != nil {
f.Close()
return nil, err
}
f.Close()
}
if err := zw.Close(); err != nil {
return nil, err
}
return buf.Bytes(), nil
}

func main() {
if len(os.Args) < 2 {
fmt.Println("Usage: skill_package_to_base64 <skill_dir>")
os.Exit(1)
}
skillDir := strings.TrimRight(os.Args[1], string(os.PathSeparator))

zipBytes, err := packSkillDir(skillDir)
if err != nil {
fmt.Fprintf(os.Stderr, "pack failed: %v\\n", err)
os.Exit(1)
}

sum := sha256.Sum256(zipBytes)
fmt.Println("ContentHash:", hex.EncodeToString(sum[:]))
fmt.Println("FileData (Base64):")
fmt.Println(base64.StdEncoding.EncodeToString(zipBytes))
}

Python Language

The following example demonstrates how to use Python to package a Skill directory into a ZIP file according to the specifications and generate a Base64-encoded string that can be used as the FileData parameter of the UploadSkillSecScan API.
Note:
The runtime environment requires Python 3.7 or later. This example depends only on the Python standard library, and no third-party packages need to be installed.
1. Replace the command-line argument with the path to the Skill directory to be detected:
python3 skill_package_to_base64.py /path/to/skill_dir
2. Run the program to obtain the Base64-encoded string and ContentHash.
3. Pass the Base64 string as the FileData parameter to the UploadSkillSecScan API.
#!/usr/bin/env python3
# skill_package_to_base64.py
# Package the Skill directory into a ZIP file as specified, and output Base64 and ContentHash (SHA256)
import base64
import hashlib
import io
import os
import sys
import zipfile

# Fixed timestamp: 2000-01-01 00:00:00 UTC
FIXED_DATE_TIME = (2000, 1, 1, 0, 0, 0)
# File permission 0644
UNIX_FILE_MODE = 0o644


def collect_files(skill_dir: str):
"""Recursively collect relative paths of all files under skill_dir and sort them in byte order."""
files = []
for root, _dirs, filenames in os.walk(skill_dir):
for name in filenames:
abs_path = os.path.join(root, name)
rel = os.path.relpath(abs_path, skill_dir)
# Use / as the path separator in the ZIP file
rel = rel.replace(os.sep, "/")
files.append(rel)
# Sort by path byte order (equivalent to LC_ALL=C sort)
files.sort(key=lambda s: s.encode("utf-8"))
return files


def pack_skill_dir(skill_dir: str) -> bytes:
buf = io.BytesIO()
# Compression level is fixed at 6 (Python 3.7+ supports compresslevel)
with zipfile.ZipFile(
buf, mode="w", compression=zipfile.ZIP_DEFLATED, compresslevel=6
) as zf:
for rel in collect_files(skill_dir):
abs_path = os.path.join(skill_dir, rel.replace("/", os.sep))
with open(abs_path, "rb") as f:
data = f.read()

zi = zipfile.ZipInfo(filename=rel, date_time=FIXED_DATE_TIME)
zi.compress_type = zipfile.ZIP_DEFLATED
# Write file permission 0644 to the upper 16 bits of external_attr
zi.external_attr = (UNIX_FILE_MODE & 0xFFFF) << 16
# Do not write Extra Field / Comment
zi.extra = b""
zi.comment = b""

zf.writestr(zi, data)

return buf.getvalue()


def main():
if len(sys.argv) < 2:
print("Usage: python3 skill_package_to_base64.py <skill_dir>", file=sys.stderr)
sys.exit(1)

skill_dir = sys.argv[1].rstrip(os.sep)
if not os.path.isdir(skill_dir):
print(f"Not a directory: {skill_dir}", file=sys.stderr)
sys.exit(1)

zip_bytes = pack_skill_dir(skill_dir)
content_hash = hashlib.sha256(zip_bytes).hexdigest()

print("ContentHash:", content_hash)
print("FileData (Base64):")
print(base64.b64encode(zip_bytes).decode("ascii"))


if __name__ == "__main__":
main()

Other Languages

If you use another programming language, see the following table for the corresponding ZIP library and compression level settings, and strictly comply with the Packaging Specifications.
Language
ZIP Library
Method for Setting Compression Level
Node.js
fflate
zipSync(data, { level: 6 })
Java
java.util.zip
ZipOutputStream.setLevel(6)
Rust
zip crate + flate2 crate
ZipWriter::start_file(name, FileOptions::default().compression_level(Some(6)))

Operation Step

Skill security detection is an asynchronous detection. The overall process is as follows:
1. Package the Skill directory into a ZIP file generated according to the Specifications.
2. Call the UploadSkillSecScan API to upload the ZIP file (Base64 encoding is required first). After a successful upload, the API immediately returns the ContentHash (SHA256) of the file, and the backend performs the scan asynchronously.
Note:
The UploadSkillSecScan API currently limits the size of a single Skill ZIP file to 10 MB. Files exceeding this limit will be rejected. We recommend that you streamline the Skill package content, for example by removing unnecessary binary resources and model weights, to keep the file within 10 MB.
3. Use the ContentHash returned in the previous step to call the DescribeSkillSecScanResult API to poll for the detection result.
In general, a single detection can be completed within 5 minutes. We recommend that you set the polling interval to 5 to 10 seconds.
For suspicious or malicious samples, detection typically takes 5 to 10 minutes due to the need for deeper analysis, and can take up to approximately 90 minutes in the worst case.
If the detection fails, you can trigger the detection again.
4. After the detection is completed, the system will return:
Risk Level: malicious / suspicious / benign.
Matched Rule Details: Displays specific information for each risk, such as file locations and behavior characteristics, grouped by detection engine.
Remediation Suggestions: Comprehensive remediation suggestions based on the detection results.

Must-Knows

Skill security detection addresses specific risks in the AI Agent Skill ecosystem. It differs from traditional Web vulnerability scanning (SAST/DAST) in positioning, and it is recommended to use both in combination.
Detection results provide a basis for security admission. We recommend that you develop remediation policies in conjunction with your organization's own security standards.
Detection rules, models, and sandbox capabilities will be continuously upgraded. We recommend that you periodically rescan existing Skills with versioning.

References

ヘルプとサポート

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

フィードバック