T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:86- Finding
Unrestricted OCR Endpoint Can Receive Sensitive Documents and API Credentials
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This OCR skill is coherent, but it sends sensitive payment voucher files and an API token to a configurable external endpoint without strong endpoint limits or clear per-use consent.
Review before installing. Use only with payment documents you are allowed to send to Scnet, verify config/.env has the intended HTTPS Scnet endpoint, protect and rotate the API key as needed, and avoid automatic invocation on sensitive files unless the user explicitly approves the upload.
scripts/main.py:86Unrestricted OCR Endpoint Can Receive Sensitive Documents and API Credentials
SKILL.md:66Unpinned 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 to read local files, invoke Python from the shell, and send file contents to an external OCR API, but it does not declare any explicit tool scope or permission boundaries. This creates an authorization gap where an agent may invoke the skill with broader-than-necessary file and execution access, increasing the chance of unintended file exposure or misuse.
The skill is explicitly configured to transmit document images and extracted text to an external Scnet API endpoint. In the context of payment vouchers, this may involve sensitive financial or personal information, so external transmission materially increases confidentiality and compliance risk if users are not clearly warned and consent is not obtained.
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 trigger guidance says the AI may auto-trigger this skill based on broad descriptive keywords, without strong constraints on when invocation is appropriate or what user consent is required for uploading a local file. Because the skill reads a local path and sends data to a third-party API, ambiguous triggering can cause unintended execution and external transmission of sensitive documents.
The configuration section reiterates use of an external API endpoint, confirming that operation depends on sending locally sourced voucher content outside the host environment. Because the skill processes payment vouchers, the context makes this more sensitive than generic OCR due to likely exposure of names, amounts, signatures, and purpose fields.
| 变量名 | 默认值 | 说明 |
|--------|--------|------|
| SCNET_API_KEY | 必需 | Scnet API 密钥 |
| SCNET_API_BASE | https://api.scnet.cn/api/llm/v1 | API 基础地址(一般无需修改) |
### 输出
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# Sugon-Scnet OCR API 文档摘要
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
The documentation includes OCR output containing highly sensitive personal data such as name, address, birth date, gender, and ID number, but provides no privacy, minimization, retention, or lawful-processing guidance. In a payment voucher OCR skill, this increases the risk that integrators will transmit regulated personal information to a third-party OCR service without appropriate user consent or data-handling safeguards.
The documentation states that uploaded compressed archives are automatically decompressed and recognized, but does not warn about privacy, file-handling, or upload-scope risks. This can lead users to submit bulk document sets containing many sensitive records, increasing accidental over-collection and third-party exposure of personal or financial data.
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 script sends user-supplied document files to an external OCR service at api.scnet.cn. Because this skill processes payment vouchers, the transmitted data likely contains sensitive financial and personal information, creating confidentiality and compliance risk if users are unaware or if the endpoint is not explicitly approved for such 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):
This markdown file contains user-facing natural language entirely in Chinese, including the title and change description. Under the stated policy, forcing a specific language without offering user choice or documenting a justified locale constraint can be a language/locale policy violation.
This markdown file is a generic template README and does not describe the skill's actual behavior, limitations, or any warnings about actions that could affect user data, privacy, or system integrity. Because it includes operational sections such as adding files, CI/CD, and deployment without any skill-specific disclosure, users are not warned about what the skill may do.
The natural-language description and usage guidance are entirely in Chinese and do not indicate that the user may choose another language. Per policy, forcing a specific language without opt-in can be a locale/language policy issue unless the regional constraint is explicitly justified.
The document is written entirely in Chinese and does not indicate that users may choose another language or locale. Under the policy rule for natural-language violations, this can be treated as a language constraint without explicit opt-in or justification.
The manifest description is written only in Chinese and provides no indication that users can choose another language or that the skill is intentionally limited to a Chinese-speaking context. Under the policy, language or locale constraints should be opt-in or explicitly justified.