T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:64- Finding
Unrestricted OCR Endpoint Can Expose Sensitive Documents and API Credentials
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill openly performs bill OCR by uploading user files, but its configurable upload endpoint can send sensitive documents and the API token outside the declared Scnet destination.
Review before installing. Only use this skill if you are allowed to send the selected bill documents to Scnet, keep config/.env private, and verify SCNET_API_BASE remains exactly the intended HTTPS Scnet API base before every use. Prefer a pinned dependency install in an isolated environment.
scripts/main.py:64Unrestricted OCR Endpoint Can Expose Sensitive Documents and API Credentials
SKILL.md:96Unpinned 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"
# 允许使用的 ocrType 枚举值,避免任意字符串被传到服务端
ALLOWED_OCR_TYPES = {'INTERNATIONAL_BILL'}
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"
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 states that file read, network upload, shell execution, and environment-variable access are required, but the file lacks an actual machine-readable tool scope such as permissions or allowed-tools. This creates a policy/permission ambiguity where a host may not be able to enforce least privilege reliably, increasing the chance of overbroad execution or silent capability expansion.
The skill explicitly uploads local financial documents to a third-party OCR API, which is an external data transmission of sensitive content. Even though the transfer is disclosed and gated by an acknowledgment flag, it still creates confidentiality, privacy, regulatory, and retention risks if users upload sensitive bills or if the third party mishandles the data.
| 权限 | 范围 | 用途 |
|------|------|------|
| files | read | 读取用户提供的本地图片、PDF 或压缩包文件 |
| network | upload | 将文件上传至 Scnet OCR API(`https://api.scnet.cn/api/llm/v1/ocr/recognize`) |
| shell | execute (python3/python) | 执行 Python 脚本以调用 OCR 服务 |
**数据外传说明**:
The configurable SCNET_API_BASE allows the upload destination to be changed from the documented API endpoint, which can broaden the exfiltration risk beyond the intended provider if altered maliciously or accidentally. Because uploaded files may contain sensitive financial data, redirectable network destinations materially increase exposure.
SCNET_API_KEY=your_scnet_api_key_here
# API 基础地址(一般无需修改)
SCNET_API_BASE=https://api.scnet.cn/api/llm/v1
# 确认已了解隐私风险并同意上传文件(设为 1 表示同意)
SCNET_OCR_UPLOAD_CONFIRMED=1
The documentation again exposes that the upload endpoint is externally configurable and that user files are sent off-device, reinforcing the same external transmission risk. In this context, the skill handles international bill images/PDFs containing sensitive financial identifiers, making third-party transfer more consequential than generic OCR content.
| 变量名 | 默认值 | 说明 |
|--------|--------|------|
| SCNET_API_KEY | 必需 | Scnet API 密钥 |
| SCNET_API_BASE | https://api.scnet.cn/api/llm/v1 | API 基础地址(一般无需修改) |
| SCNET_OCR_UPLOAD_CONFIRMED | 未设置 | 设置为 `1` 表示您已了解并同意文件将被上传至第三方 Scnet 服务 |
### 输出
The documentation explicitly states that local bill images/PDFs containing sensitive financial data are uploaded to a third-party cloud OCR endpoint. Even though this appears to be the intended product behavior, it creates a real data exfiltration/privacy risk because highly sensitive documents leave the local environment and are transmitted to an external service.
> **隐私提示**:调用本接口会将您提供的本地文件上传至 Scnet 云服务器进行处理。上传内容可能包含汇票号码、收款人、付款行、信用证号码、金额等敏感金融信息,请确保您已了解相关隐私与合规风险。
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-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 uploads user-supplied bill images/PDFs to a third-party OCR endpoint at api.scnet.cn. Although it includes a consent gate and transparency notice, this is still a real data exfiltration path for potentially sensitive financial documents if users misconfigure consent or do not fully understand the privacy implications.
)
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 manifest’s user-facing description, permission reasons, risk disclosures, and consent instructions are entirely in Chinese, with no indication that users may choose another language. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified, which this file does not do.
This skill explicitly uploads local financial document images/PDFs to a third-party OCR endpoint, which creates a real data exfiltration path for sensitive banking and payment information. Even though the transmission is declared and gated by consent, the exposed data includes bill details, parties, amounts, and bank information, so compromise, misconfiguration, or uninformed consent could lead to significant confidentiality loss.
- scope: network
access: upload
endpoints:
- https://api.scnet.cn/api/llm/v1/ocr/recognize
reason: 将用户文件上传至第三方 Scnet OCR API 进行识别
- scope: shell
access: execute
The data_handling section confirms that sensitive financial files leave the local environment and may be transmitted to Scnet cloud services, potentially across borders. In the context of international drafts and OCR of financial instruments, this materially increases risk because the files can contain regulated or highly sensitive financial data whose exposure could enable fraud, privacy violations, or compliance issues.
leaves_local_environment: true
external_services:
- name: Scnet OCR API
url: https://api.scnet.cn/api/llm/v1/ocr/recognize
purpose: 上传用户文件并获取 OCR 识别结果
data_types:
- 票据图像
This markdown file presents its user-facing natural-language content entirely in Chinese, including the title and change descriptions, with no indication that the user opted into that language or that the skill is limited to a Chinese-language context. Under the language/locale policy rule, forcing a single language without opt-in can be a policy concern.
This markdown file contains user-facing natural-language instructions entirely in Chinese, including the description and operational guidance. Under the language/locale policy rule, forcing a specific language without giving the user a choice or documenting a justified locale restriction is a policy concern.
This markdown file presents all user-facing instructional content exclusively in Chinese, with no indication that the user can choose another language or that the skill is limited to a Chinese-language audience. Under the stated policy, forcing a specific language without opt-in is a natural-language policy concern.