T09 · Insecure Skill Coding Practices
- Location
ocr_cli.py:95- Finding
OCR Results Are Persisted in Plaintext by Default
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This appears to be a real online OCR utility, but it sends images or image URLs to OCR.space and caches extracted text locally by default without strong privacy controls.
Install only if you are comfortable sending images or image URLs to OCR.space. Do not use it for secrets, IDs, medical, financial, legal, or internal-only documents unless that third-party processing is approved. Prefer running with --no-cache for sensitive content, avoid passing private API keys directly on the command line, and consider pinning dependencies in a virtual environment.
ocr_cli.py:95OCR Results Are Persisted in Plaintext by Default
ocr_cli.py:45Private API Keys Can Be Exposed Through Command-Line Arguments
SKILL.md:22Third-Party Dependencies Are Installed Without Version or Integrity Pinning
The skill performs file reads, file writes, and outbound network requests but does not declare any tool scope or permissions boundary. This can cause an agent or user to invoke the skill without clear visibility into its capabilities, increasing the chance of unintended data access or transmission.
The description presents the skill as a simple OCR utility but does not clearly warn that images and resulting text are sent to a third-party OCR service. In this context, users may unknowingly upload sensitive documents, screenshots, IDs, or credentials to an external processor, creating confidentiality and compliance risk.
The code sends image data or image URLs to an external service at api.ocr.space, which is an intentional feature but still a security-relevant data exfiltration path. In an OCR skill, this is contextually expected, yet it remains dangerous when users process private or regulated content because third-party transmission changes the trust boundary.
class OnlineOCR:
def __init__(self, api_key='helloworld'): # 免费API密钥
self.api_key = api_key
self.api_url = 'https://api.ocr.space/parse/image'
def ocr_from_file(self, image_path, language='chs'):
"""
The file’s docstring, argument descriptions, help examples, and runtime messages are written in Chinese, and the default OCR language is also set to Chinese Simplified. This imposes a specific language/locale on all users without any documented opt-in or alternative interface, which matches the language/locale policy violation criteria.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
- cache_dir: 缓存目录,如果为None则不使用缓存
"""
self.api_key = api_key
self.api_url = 'https://api.ocr.space/parse/image'
self.cache_dir = cache_dir
# 创建缓存目录
The URL-based OCR path submits a user-supplied image URL to an external service, disclosing both the URL and causing third-party retrieval of the referenced content. This can leak sensitive or internal resource locations and is especially risky if users may pass private, signed, or intranet-accessible URLs without understanding that a third party will receive them.
The skill sends raw image content to a third-party OCR service, which can expose sensitive data contained in screenshots, IDs, receipts, or documents to an external provider. In this skill context, external transmission is the core feature, but the code provides no explicit user-facing consent, warning, or privacy controls before disclosure, making this a real privacy/security issue rather than a false positive.
The examples write recognized text to local files without warning that OCR output may contain sensitive information extracted from documents or screenshots. This can leave confidential data persisted on disk unexpectedly, where it may be exposed through backups, shared directories, or later processing.
This Python file contains user-facing natural language that is exclusively Chinese, starting with the module docstring and continuing throughout printed status messages. Under the language/locale policy rule, forcing a specific language without user choice can be a policy violation when the skill does not document that it is intentionally region-specific.