T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:78- Finding
Unrestricted OCR Endpoint Can Expose Credentials and Sensitive Documents
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is mostly transparent about uploading tax documents for OCR, but its configurable upload endpoint can redirect sensitive files and the API token without validation.
Review before installing if you will process real tax or business registration documents. Only upload files you are authorized to share with SCNET, keep the API key out of chat, use a locked-down config/.env, and do not change SCNET_API_BASE unless you fully trust the endpoint and transport security. Prefer a pinned dependency environment and treat OCR outputs as sensitive.
scripts/main.py:78Unrestricted OCR Endpoint Can Expose Credentials and Sensitive Documents
SKILL.md:83Unpinned 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"
The project name suggests OCR of tax registration certificates, which likely involves sensitive personal or business data, but the README provides no warning about data handling, privacy implications, storage, or transmission. For markdown files, user-facing documentation should disclose behaviors that could affect user data or privacy.
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 data over the network, but it declares no explicit tool scope such as permissions or allowed-tools. That omission weakens least-privilege controls and makes it easier for an agent runtime to grant broader access than necessary, especially since the skill handles sensitive local documents and transmits them externally.
The skill explicitly uploads user-specified local images, PDFs, or archives containing tax registration information to an external OCR service. Because the transmitted content can include highly sensitive personal and business data, this creates a real exfiltration/privacy risk if users do not fully understand or authorize the transfer, even though the warning is disclosed.
> **⚠️ 重要隐私提示**
>
> 使用本技能时,您指定的本地图片/PDF/压缩包会被上传到 **SCNET OCR API(默认 `https://api.scnet.cn/api/llm/v1/ocr/recognize`)** 进行识别。
>
> 上传的内容及识别结果中可能包含以下敏感信息:
> - 纳税人名称、证件编号
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
> **⚠️ 隐私提示**:调用本接口时,您上传的文件内容将离开本地环境并传输至 SCNET 服务器进行处理。请确保您有权共享该文件,并了解 SCNET 的数据处理与保留策略。
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
> **⚠️ 隐私提示**:调用本接口时,您上传的文件内容将离开本地环境并传输至 SCNET 服务器进行处理。请确保您有权共享该文件,并了解 SCNET 的数据处理与保留策略。
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
> **⚠️ 隐私提示**:调用本接口时,您上传的文件内容将离开本地环境并传输至 SCNET 服务器进行处理。请确保您有权共享该文件,并了解 SCNET 的数据处理与保留策略。
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
This code file contains user-facing natural-language descriptions and runtime messages in Chinese, but there is no indication that the skill is region-specific or that users can opt into another language. The policy requires avoiding forced language or locale constraints unless they are optional or clearly justified.
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)
This skill uploads a local file to an external OCR service at api.scnet.cn. Because the skill processes tax registration certificates, the transmitted content likely contains sensitive personal or business information; sending it off-host introduces privacy, data handling, and third-party exposure risk even though HTTPS is used.
)
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 description is written only in Chinese ("支持税务登记证的票据识别。"), and the tags are likewise Chinese-specific, with no indication that the skill supports other languages or that Chinese-only use is an intentional region-scoped constraint. Under the policy, forcing a specific language or locale without user opt-in is a natural-language policy violation.
The file's natural-language content, including the title and entries, is presented exclusively in Chinese. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation, and this file does not indicate any language choice or justification.
This markdown file is a generic GitLab/template README and does not describe when the skill should activate, what phrases invoke it, or any exclusions. For skill metadata or documentation, the absence of specific trigger scope can lead to ambiguous or unintended invocation because there are no explicit activation boundaries.
The manifest description is written entirely in Chinese and presents the skill as Chinese-language-only, with no indication that users may interact in another language or choose a locale. Under the policy criteria, a skill that forces a specific language without user opt-in is a natural-language policy concern.