T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:78- Finding
Unrestricted OCR Endpoint Can Expose Financial 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 needs Review because it uploads sensitive bank-transfer documents to a configurable external OCR endpoint without clear consent or destination controls.
Install only if you intend to send bank-transfer voucher files to Scnet's cloud OCR service and you trust that provider with the document contents. Verify config/.env before use, keep SCNET_API_BASE pointed at the intended HTTPS Scnet endpoint, avoid uploading unredacted payment passwords or unnecessary financial data, and install dependencies in an isolated environment with pinned versions where possible.
scripts/main.py:78Unrestricted OCR Endpoint Can Expose Financial Documents and API Credentials
SKILL.md:66Unpinned Third-Party Dependency Installation
The documentation explains API token setup and OCR usage but does not clearly warn that voucher images and extracted banking information are transmitted to an external OCR service. Since the data includes names, account numbers, amounts, and bank details, omission of this disclosure can cause users to unknowingly exfiltrate highly sensitive financial information.
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 documents capabilities that imply local file access, outbound network access, and shell execution, but it does not declare any tool scope restrictions such as permissions or allowed-tools. This creates an overbroad execution surface where an agent may invoke the skill with more authority than intended, increasing the risk of unauthorized file access or command execution if the skill is mis-triggered or modified.
The skill description is written as a Chinese-only user-facing capability statement, and the rest of the instructions likewise assume Chinese interaction. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern unless the locale restriction is explicitly justified, which is not stated here.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
SCNET_API_KEY=your_scnet_api_key_here
SCNET_API_BASE=https://api.scnet.cn/api/llm/v1
2. 添加:`SCNET_API_KEY=你的密钥`
3. 设置文件权限为 600(仅所有者可读写)
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
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 says the AI may trigger the skill based on broad description keywords, but it does not define strict activation conditions, confirmation requirements, or sensitive-data handling rules. Because this skill processes banking voucher images and local file paths, vague triggering can lead to unintended OCR submission of sensitive financial documents to a third-party service.
This markdown file documents OCR output fields for bank transfer vouchers, including remitter/payee account numbers and a payment password. The description provides no warning about the sensitivity of these fields, privacy implications, or the need for careful handling/redaction, which is required for markdown files when behavior could affect user data or privacy.
The skill is designed to send uploaded OCR documents to an external network endpoint, which creates a real data-exfiltration surface for personal and financial records. In the context of telegraphic transfer voucher OCR, the transmitted content likely includes names, account numbers, amounts, dates, and bank details, making the external transmission materially sensitive even if it is core functionality.
# Sugon-Scnet OCR API 文档摘要
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
The documentation describes uploading identity and financial documents containing highly sensitive personal data to a third-party OCR endpoint, but it provides no privacy, consent, retention, or data-handling warning. In this skill context, that omission matters because users may submit bank transfer vouchers and IDs without understanding that the data leaves the local environment and is transmitted to a remote 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 code is hardwired to transmit data to an external HTTPS endpoint at api.scnet.cn for OCR processing. In this skill's context, the uploaded files are bank transfer vouchers, so the external transmission includes potentially highly sensitive financial information and should be treated as a meaningful security/privacy exposure.
)
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 the user-supplied document to a third-party OCR API, but there is no explicit runtime consent or warning at the point of transmission. Because telegraphic transfer vouchers contain sensitive financial and personal data, silent exfiltration to a remote service creates a real privacy and data-handling risk even if this is the intended product behavior.
The manifest description is presented solely in Chinese, which can impose a specific language on users without any opt-in or indication that the skill is intentionally region-specific. The policy requires either offering language choice or clearly documenting and justifying locale constraints.
This markdown file contains user-facing natural language entirely in Chinese, including the title and change description. Under the policy rule for language/locale, forcing a specific language without offering a choice or documenting a justified locale constraint can be a policy violation.
The file's natural-language content is entirely in Chinese and does not indicate that this language restriction is optional, user-selected, or justified by a region-specific requirement. Per policy, forcing a specific language without user opt-in can be a natural-language policy violation.
All headings, notes, and examples in the file are presented only in Chinese, which can amount to a language policy issue when no user opt-in or locale limitation is stated. The file does not indicate that the skill is intended exclusively for a Chinese-speaking or region-specific audience.