T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:79- Finding
Unvalidated outbound destinations can expose credentials and access internal resources
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill appears to be a real Scnet OCR client, but its handling of external document processing, API credentials, and unvalidated network destinations needs user review before installation.
Install only if you are comfortable sending document URLs and their contents to Scnet for OCR. Do not use it for confidential, regulated, internal-only, or signed-URL documents unless external processing is approved. Keep the API base pointed at the official HTTPS Scnet endpoint, protect the `config/.env` token file, and consider pinning dependencies before use.
scripts/main.py:79Unvalidated outbound destinations can expose credentials and access internal resources
SKILL.md:67Unpinned third-party dependency installation creates supply-chain risk
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"
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 describes capabilities that involve local file access (.env/config), network access to an external API, and shell/Python execution, but it does not declare an explicit tool scope such as allowed-tools or permissions. This increases the chance that an agent invokes the skill with broader privileges than necessary, violating least-privilege and making misuse or prompt-triggered overreach more likely.
The skill clearly submits document URLs to a third-party OCR provider and returns externally generated results, but the documentation does not prominently warn users that document contents and metadata will leave the local environment. This can lead to inadvertent disclosure of confidential files, internal URLs, or regulated content to an external service.
This skill is designed to transmit user-supplied document URLs and related processing requests to an external endpoint at api.scnet.cn. In context, external transmission is expected functionality, but it is still security-relevant because documents may contain sensitive data and the skill encourages use of publicly accessible URLs, expanding the exposure surface.
SCNET_API_KEY=your_scnet_api_key_here
SCNET_API_BASE=https://api.scnet.cn/api/llm/v1
2.添加:SCNET_API_KEY=你的密钥
The activation guidance says the AI will automatically trigger the skill based on description keywords, but it does not clearly constrain when invocation is appropriate or require confirmation before sending data externally. Ambiguous triggering can cause accidental processing of user-provided links or sensitive documents and unintended transmission to the third-party OCR service.
This markdown file is natural-language documentation and begins with a Chinese-only title and continues entirely in Chinese. Under the policy, forcing a specific language without user opt-in or a documented regional justification is a natural-language policy violation.
The skill sends documents and related metadata to an external OCR API endpoint, which is a genuine external data transmission path. In this context, the danger is elevated because the service processes full document contents, including potentially sensitive text, tables, seals, and other structured data, yet the documentation does not include security boundaries or user consent/privacy warnings.
Scnet OCR 文档智能服务支持异步提交文档识别任务,适用于大批量文档处理。识别结果包含丰富的版面分析信息(文本、表格、图表、公式、页眉页脚、脚注、印章等)以及 Markdown 格式的全文。
## 接口地址
- **提交任务**: `POST https://api.scnet.cn/api/llm/v1/ocrdoc/submit`
- **查询结果**: `POST https://api.scnet.cn/api/llm/v1/ocrdoc/result`
## 请求头
The result-query endpoint is also part of the same third-party OCR workflow and returns downloadable result URLs, extending the external data flow beyond submission to retrieval of extracted document content. This increases exposure because recognized text and structure are made available through externally hosted result files with limited but real access windows.
## 接口地址
- **提交任务**: `POST https://api.scnet.cn/api/llm/v1/ocrdoc/submit`
- **查询结果**: `POST https://api.scnet.cn/api/llm/v1/ocrdoc/result`
## 请求头
- `Content-Type: application/json`
The documentation instructs users to submit publicly accessible document URLs to a third-party OCR service, but it does not warn that this exposes document contents and metadata to an external provider and requires the source file to be retrievable over the public internet. In a document-parsing skill, this is a real data-handling risk because users may send sensitive files without understanding the privacy, retention, or access implications.
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)
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
)
sys.exit(error_msg)
config.setdefault('SCNET_API_BASE', 'https://api.scnet.cn/api/llm/v1')
return config
def submit_task(api_base, api_key, file_url, ocr_type, retry_count=0):
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
)
sys.exit(error_msg)
config.setdefault('SCNET_API_BASE', 'https://api.scnet.cn/api/llm/v1')
return config
def submit_task(api_base, api_key, file_url, ocr_type, retry_count=0):
The code performs an outbound POST request containing the user-provided file URL and OCR parameters to an external API. Because documents may be sensitive and the skill is specifically designed to process arbitrary public URLs, this creates a real data-exposure boundary and should be treated as a security-relevant transmission.
payload['ocr_type'] = ocr_type
try:
response = requests.post(url, headers=headers, json=payload, timeout=30)
except Exception as e:
sys.exit(f"网络请求失败: {str(e)}")
The skill sends a user-supplied document URL to a third-party OCR provider, which causes user data to leave the local environment and be processed externally. In this skill's context, external processing is the core feature, but the code does not present an explicit privacy/disclosure warning or require affirmative consent before transmitting potentially sensitive documents.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
'task_ids': [task_id]
}
try:
response = requests.post(url, headers=headers, json=payload, timeout=30)
except Exception as e:
sys.exit(f"查询网络请求失败: {str(e)}")
The manifest description uses Chinese exclusively and does not indicate that the skill is region-specific or that users can opt into a preferred language. Under the stated policy, forcing a specific language without user choice is a natural-language policy concern.
This markdown file uses Chinese for its heading and entry text, but it does not indicate that the skill is Chinese-language only or offer any language/locale choice. Under the policy criteria, forcing a specific language without user opt-in can be a natural-language policy violation.
This markdown file includes actionable commands to add a remote, rename the branch, and push to origin, which can affect repository state and publish local content. The README provides no warning or disclosure about these side effects, and the file otherwise appears to be a generic template rather than a purpose-specific guide that would make the risk obvious.
The skill documentation is entirely in Chinese and provides only Chinese interaction examples, with no indication that users may choose another language. This can constitute a language/locale policy issue when a skill appears to prescribe a single language without explicit opt-in or justification.
All user-facing documentation is presented in Chinese, which can impose a language constraint without user opt-in. There is no note indicating that the skill or documentation is intentionally limited to a Chinese-speaking or region-specific audience.