T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:50- Finding
Unrestricted API Endpoint Override Exposes Credentials and Sensitive Documents
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill performs its stated OCR job, but it uploads sensitive ticket files with an API key and lets the upload endpoint be changed without clear safeguards.
Install only if you are comfortable sending bus ticket images or PDFs, including names, routes, dates, invoice numbers, and amounts, to Scnet's OCR service. Keep config/.env writable only by trusted users, do not override SCNET_API_BASE unless you control and trust the endpoint, and ask the agent to confirm before uploading each document.
scripts/main.py:50Unrestricted API Endpoint Override Exposes Credentials and Sensitive Documents
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 文件加载配置,环境变量优先"""
config = {}
# 1. 如果 config/.env 存在,先加载其中的变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# --------------------
def load_config():
"""从环境变量或 .env 文件加载配置,环境变量优先"""
config = {}
# 1. 如果 config/.env 存在,先加载其中的变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# --------------------
def load_config():
"""从环境变量或 .env 文件加载配置,环境变量优先"""
config = {}
# 1. 如果 config/.env 存在,先加载其中的变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# --------------------
def load_config():
"""从环境变量或 .env 文件加载配置,环境变量优先"""
config = {}
# 1. 如果 config/.env 存在,先加载其中的变量
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# --------------------
def load_config():
"""从环境变量或 .env 文件加载配置,环境变量优先"""
config = {}
# 1. 如果 config/.env 存在,先加载其中的变量
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 declares capabilities that imply file access, environment-variable use, shell execution, and outbound network access, but it does not explicitly constrain or document tool permissions. In an agent setting, missing scope declarations reduce visibility and make it easier for the skill to access sensitive local files or send data externally without clear guardrails.
The skill asks users to provide local image/document paths for OCR but does not clearly warn that the file contents will be uploaded to a third-party external service for processing. This creates a real privacy and data-handling risk because users may submit sensitive travel documents or personal information without informed consent.
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 file references a third-party HTTPS API endpoint for OCR processing, which confirms external transmission of user-supplied documents to a remote service. In this skill's context, that matters because the uploaded bus tickets and OCR output may include personally identifiable and travel-related data, so the external dependency increases confidentiality and governance risk even if the transport is encrypted.
# Sugon-Scnet OCR API 文档摘要
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
The document instructs users to upload ticket images to an external OCR endpoint and shows that extracted personal and financial fields are returned, but it does not clearly warn that sensitive files and parsed data leave the local environment. For a bus-ticket OCR skill, this is materially risky because tickets can contain personal data, travel details, and invoice information, creating privacy, compliance, and data-handling concerns if users are not explicitly informed.
The script uploads a user-supplied local file to an external OCR API endpoint by default. In an agent skill context, this creates a real data exfiltration risk because sensitive ticket images and their extracted contents are transmitted off-host to a third-party service, and the destination can also be overridden via environment or .env configuration.
config['SCNET_API_BASE'] = env_api_base
# 3. 设置默认值
config.setdefault('SCNET_API_BASE', 'https://api.scnet.cn/api/llm/v1')
# 4. 检查必要配置
api_key = config.get('SCNET_API_KEY', '')
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
"2. 配置文件:\n"
f" mkdir -p {SKILL_ROOT}/config\n"
f" echo 'SCNET_API_KEY=你的真实密钥' > {ENV_FILE}\n"
f" chmod 600 {ENV_FILE}\n"
)
sys.exit(error_msg)
This markdown file uses Chinese for the primary user-facing changelog text, including the title and feature descriptions, but does not indicate that the skill is region-specific or that users can choose another language. Under the policy, forcing a specific language without opt-in can be a natural-language policy violation.
The documentation says the AI will automatically trigger the skill based on keywords, without mentioning user approval or a confirmation step. In this skill's context, that can lead to unintended uploads of local files to an external OCR provider when the user may not realize remote processing will occur.
The manifest description is written only in Chinese ("支持识别汽车票票据。"), which indicates a language-specific presentation without offering any user language choice or opt-in. Under the policy, forcing a specific language or locale without user choice is a natural-language policy violation.