T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:78- Finding
Unrestricted API Endpoint Override Can Expose Credentials and Identity Documents
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill appears to perform driver-license OCR as advertised, but it needs review because it uploads sensitive identity documents and an API key to a configurable remote endpoint without strong runtime safeguards.
Install only if you are comfortable sending driver's license images to Scnet's remote OCR service. Before use, verify `config/.env` points only to the intended HTTPS Scnet API endpoint, avoid processing documents without the subject's permission, and consider requiring an explicit confirmation before each upload.
scripts/main.py:78Unrestricted API Endpoint Override Can Expose Credentials and Identity Documents
SKILL.md:89Unpinned Third-Party Dependency Installation
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# 获取技能根目录(脚本所在目录的上一级)
SKILL_ROOT = Path(__file__).parent.parent.absolute()
ENV_FILE = SKILL_ROOT / "config" / ".env"
# --- 新增:重试配置 ---
MAX_RETRIES = 3 # 最大重试次数
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# --------------------
def load_config():
"""从 .env 文件加载配置,若文件不存在则抛出友好错误"""
if not ENV_FILE.exists():
error_msg = (
"\n===============================================\n"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# --------------------
def load_config():
"""从 .env 文件加载配置,若文件不存在则抛出友好错误"""
if not ENV_FILE.exists():
error_msg = (
"\n===============================================\n"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# --------------------
def load_config():
"""从 .env 文件加载配置,若文件不存在则抛出友好错误"""
if not ENV_FILE.exists():
error_msg = (
"\n===============================================\n"
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
* [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/)
* [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
* [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
* [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
* [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
The skill documentation indicates capabilities that include reading local files, invoking Python from the shell, and sending data over the network, but it does not declare any explicit tool scope or permissions boundary. That omission can lead to overbroad execution in agent environments, especially because the skill handles highly sensitive identity documents and transmits them to a third-party API.
L054 的功能特性明确写的是“支持识别行驶证主页和副页信息”,并列出号牌号码、所有人、车架号、发动机号等机动车行驶证字段,这与清单 L003 及其余文档中声明的驾驶证(驾驶人证件)识别用途直接矛盾。这不是简单的信息缺失,而是把目标证件类型和提取字段写成了另一类证件,属于文档意图与技能定位的主动冲突。
The skill explicitly sends driver's license images to an external endpoint at api.scnet.cn, which constitutes transmission of highly sensitive personal information outside the local environment. Even though the documentation warns about this behavior, the security risk remains significant because identity data, license numbers, and photos may be exposed through third-party handling, retention, breach, or misconfiguration.
SCNET_API_KEY=your_scnet_api_key_here
SCNET_API_BASE=https://api.scnet.cn/api/llm/v1
2. 添加:`SCNET_API_KEY=你的密钥`
3. 设置文件权限为 600(仅所有者可读写)
The auto-trigger guidance is broad enough that an agent may invoke this skill based on vague conversational references to an image path, without strong confirmation of user intent or sensitivity review. In this context, that is risky because the skill processes driver's license images containing highly sensitive personal data and sends them off-device to a third party.
This configuration section reiterates that the OCR workflow depends on a remote API base URL, confirming that processing requires external transmission of sensitive driver's license data. Because the skill context involves government-issued identity documents, external transfer materially elevates privacy and compliance risk even if the endpoint is legitimate.
| 变量名 | 默认值 | 说明 |
|--------|--------|------|
| SCNET_API_KEY | 必需 | Scnet API 密钥 |
| SCNET_API_BASE | https://api.scnet.cn/api/llm/v1 | API 基础地址(一般无需修改) |
### 输出
The skill depends on transmitting uploaded document images to an external domain (api.scnet.cn) for OCR processing. In a driver-license OCR use case, this creates a real data-exposure risk because the payload includes sensitive identity information and document images, even though the external call itself may be functionally necessary.
# Sugon-Scnet OCR API 文档摘要
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
The documentation describes uploading driver license images and related identity documents to a third-party OCR endpoint but does not warn that highly sensitive personal data will be transmitted off-platform. In the context of a driver-license OCR skill, this omission is material because the documents contain regulated PII and users may not realize their files are being sent to an external service.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
" b) 配置文件:\n"
f" mkdir -p {SKILL_ROOT}/config\n"
f" echo 'SCNET_API_KEY=你的密钥' > {ENV_FILE}\n"
f" chmod 600 {ENV_FILE}\n"
"\n配置完成后重新运行。"
)
sys.exit(error_msg)
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
" b) 配置文件:\n"
f" mkdir -p {SKILL_ROOT}/config\n"
f" echo 'SCNET_API_KEY=你的密钥' > {ENV_FILE}\n"
f" chmod 600 {ENV_FILE}\n"
"\n配置完成后重新运行。"
)
sys.exit(error_msg)
The skill is designed to send documents to an external endpoint at api.scnet.cn, which constitutes external transmission of sensitive driving-license data. In this skill context, that increases privacy and compliance risk because the uploaded files may contain names, license numbers, and other regulated personal data.
)
sys.exit(error_msg)
config.setdefault('SCNET_API_BASE', 'https://api.scnet.cn/api/llm/v1')
return config
def recognize_with_retry(ocr_type, file_path, config, retry_count=0):
The script uploads a user-provided driving-license image to a third-party OCR service, which is a real privacy and data-handling risk because the file likely contains sensitive personal information. Although the transmission appears intentional for OCR functionality and uses HTTPS, there is no explicit consent step or transmission warning at the moment the upload occurs, so users may unknowingly send PII off-host.
The manifest description is written entirely in Chinese and provides no indication that other languages are supported or that the skill is intentionally limited to a Chinese-speaking or region-specific audience. Under the policy, forcing a specific language without user opt-in or documented justification is a natural-language policy concern.
This markdown file uses Chinese headings and entries exclusively, which may violate a language/locale policy if the organization expects neutral or user-selectable language. There is no indication that the skill is region-specific or that users can opt into this locale.
The file presents the skill description, warnings, and usage guidance entirely in Chinese, which can amount to forcing a specific language without user opt-in. The document does not offer alternative language support or explain that the skill is intentionally limited to a Chinese-speaking or region-specific audience.
This markdown file presents all user-facing documentation in Chinese only, including headings and field descriptions. The policy requires flagging language or locale constraints when a specific language is forced without user opt-in or documented justification.
The docstring, usage text, and error/help messages are written exclusively in Chinese, with no option for another language. This can violate language/locale policy where skills should not force a specific language without user opt-in.