T09 · Insecure Skill Coding Practices
- Location
scripts/extract_business_info.py:49- Finding
Sensitive business and identity information is stored in plaintext
- Content
View full analysis
Vulnerability Details
File Location:
scripts/extract_business_info.py:49-74, 220-224;scripts/generate_geo_content.py:895-911
Vulnerability Type: Plaintext storage of sensitive business and identity data
Risk Level: HighVulnerable Code
python result = { "enterprise_name": None, "credit_code": None, "legal_person": None, "registered_capital": None, "establishment_date": None, "business_scope": None, "address": None, "extraction_confidence": 0.0, "raw_text": [] } # ... result["raw_text"] = text_lines result.update(self._parse_business_license(text_lines))python def save_to_file(self, info: dict, output_path: str): """Save information to a JSON file""" with open(output_path, 'w', encoding='utf-8') as f: json.dump(info, f, ensure_ascii=False, indent=2) print(f"Saved to: {output_path}")python elif args.interactive: config = interactive_setup() generator.set_config(config) config_path = "business_config.json" with open(config_path, 'w', encoding='utf-8') as f: json.dump(config, f, ensure_ascii=False, indent=2)Technical Analysis
The OCR workflow extracts and retains the complete recognized text from business-license images, including legal representative names, unified social credit codes, registered addresses, business scope, and potentially unrelated text captured from the image. The entire result, including
raw_text, is then written to an unencrypted JSON file.The interactive content generator similarly writes legal representative details, telephone numbers, addresses, and website information to a predictable
business_config.jsonfile in the current working directory. Neither implementation:- Restricts file permissions.
- Encrypts sensitive fields.
- Minimizes retained OCR data.
- Defines a retention period.
- Deletes data after conten ...[truncated 1779 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not retain
raw_textby default. Parse required fields in memory and immediately discard the full OCR response. - Collect only fields required for the requested content. Make credit codes, legal representative names, registered capital, and license images opt-in.
- Add explicit consent describing which fields will be stored and published.
- Store temporary profiles in a securely created private directory with owner-only permissions, such as mode
0600for files and0700for directories. - Use encrypted storage when persistence is explicitly requested.
- Generate non-predictable filenames instead of always using
business_config.json. - Add automatic expiry and secure deletion after generation or publication.
- Implement a documented deletion command that removes profiles, OCR output, drafts, and uploaded material.
- Redact sensitive identifiers in logs, previews, and generated articles.
- Separate public merchant fields from private verification fields so verification data can never flow into promotional output accidentally.
- Do not retain
