T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:78- Finding
Arbitrary Local File and API Credential Transmission to a Configurable Endpoint
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This looks like a real flight-itinerary OCR skill, but it can upload sensitive local documents and the API key to a configurable external endpoint without strong scoping or consent controls.
Review before installing. Use this only for documents you are willing to send to Scnet or the configured OCR endpoint, keep SCNET_API_BASE set to the documented HTTPS Scnet API unless you fully trust another endpoint, and run it with access only to the specific files you intend to OCR. Store the API key carefully and prefer an isolated environment because the current script does not enforce endpoint allowlisting, file-type limits, or .env permissions.
scripts/main.py:78Arbitrary Local File and API Credential Transmission to a Configurable Endpoint
SKILL.md:64Unpinned Third-Party Dependency Installation
The skill reads an API credential from a plaintext '.env' file under the skill directory, which can expose secrets if the filesystem is shared, backed up insecurely, or the repository contents are mishandled. In this skill context, the credential enables transmission of sensitive OCR documents to the external provider, so credential compromise could facilitate unauthorized API use and indirect data exposure.
# 获取技能根目录(脚本所在目录的上一级)
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 documentation indicates capabilities that read local files, invoke Python from the shell, and send data to a remote OCR API, but it does not declare an explicit tool scope such as permissions or allowed-tools. In an agent environment, this can lead to over-broad execution privileges and make it harder to enforce least privilege around sensitive local file access and outbound network use.
The skill is designed to transmit user-supplied documents containing highly sensitive personal and financial data, such as names, ID numbers, ticket numbers, and itinerary details, to an external API endpoint. External transmission is expected for cloud OCR, but it still creates a real privacy and data exposure risk if users are not given strong consent, data handling disclosures, and destination restrictions.
SCNET_API_KEY=your_scnet_api_key_here
SCNET_API_BASE=https://api.scnet.cn/api/llm/v1
2. 添加:`SCNET_API_KEY=你的密钥`
3. 设置文件权限为 600(仅所有者可读写)
This repeated reference confirms that the skill depends on a remote API base URL, meaning document contents and OCR-derived data leave the local environment. Given the skill's purpose—processing airline itinerary documents with personal identifiers—the context increases privacy sensitivity even though the transmission itself is part of intended functionality.
| 变量名 | 默认值 | 说明 |
|--------|--------|------|
| SCNET_API_KEY | 必需 | Scnet API 密钥 |
| SCNET_API_BASE | https://api.scnet.cn/api/llm/v1 | API 基础地址(一般无需修改) |
### 输出
The file clearly identifies an external OCR service endpoint, confirming that uploaded documents are transmitted outside the local trust boundary. In this skill's context, the transmitted content can include sensitive travel and identity information, so external transmission increases privacy, data-handling, and third-party exposure risk even if the endpoint itself is legitimate.
# Sugon-Scnet OCR API 文档摘要
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
The documentation describes uploading files to a third-party OCR endpoint but does not warn that user-provided documents will be transmitted off-platform to an external service. Because this skill handles flight itinerary images that may contain names, ID numbers, ticket numbers, and travel details, the omission can mislead integrators or users about data exposure and create privacy/compliance risk.
The module docstring presents the skill interface and outputs entirely in Chinese, and the rest of the user-facing messages and usage text are also fixed to Chinese. There is no indication that the skill is region-specific by policy or that users may choose another language, which matches the language/locale policy violation criteria.
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 user-supplied files containing highly sensitive personal data from airline itineraries to an external third-party API endpoint. Even if expected for OCR functionality, external transmission of PII increases privacy and data exposure risk, especially because there is no visible consent flow, allowlist enforcement, or minimization/redaction before upload.
)
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 entirely in Chinese, which signals a fixed language presentation for the skill without any stated user opt-in or documented locale constraint. Under the policy for natural-language violations, a skill should not impose a language/locale unless it offers choice or clearly documents a justified region-specific limitation.
The file presents all user-facing changelog headings and most release notes in Chinese, with no indication that language choice is optional or that the skill is intentionally limited to a Chinese-speaking or region-specific audience. Under the stated policy, forcing a specific language without opt-in can be a natural-language policy violation.
At L129 the troubleshooting section states that the skill will automatically wait and retry up to 3 times on 429 responses. In the provided artifact, there is no corresponding implementation code to verify that behavior, so the documentation makes a concrete operational claim not supported by the actual file contents.
This markdown file presents all user-facing documentation in Chinese only, with no indication that users may choose another language or that the Chinese-only scope is intentional. Under the language/locale policy rule, forcing a specific language without user opt-in is a natural-language policy concern.
The file presents all natural-language instructions and labels exclusively in Chinese, with no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking or region-specific audience. Under SQP-3, forcing a specific language without user opt-in can be a policy concern unless the locale constraint is clearly documented and justified.
No suspicious patterns detected.