T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/data_manager.md:9
- Finding
- Subscription Financial Metadata Is Persisted in an Unprotected Plaintext File## Vulnerability Details **File Location**: `scripts/data_manager.md:9-38` **Vulnerability Type**: Plaintext storage of sensitive financial metadata **Risk Level**: Medium ### Vulnerable Code ```markdown ## The State File All subscription facts must be stored in a file named `subscriptions.json` located in the current workspace directory. **Data Schema (`subscriptions.json`):** ```json { "last_scan_date": "YYYY-MM-DD", "active_subscriptions": [ { "service_name": "Netflix", "billing_amount": 15.99, "currency": "USD", "billing_cycle": "Monthly", "last_billing_date": "YYYY-MM-DD", "next_expected_billing_date": "YYYY-MM-DD" } ] } ``` ## Mandatory Procedures ### Procedure 1: Read State (Onboarding/Initialization) Whenever the user queries their subscriptions, you MUST first read the contents of `subscriptions.json` using your file reading tool (e.g., `read_file` or `cat` via `exec`). If the file does not exist, initialize an empty abstract state in your memory. ### Procedure 2: Write/Update State (Post-Inference) After you have successfully ingested new email receipts and inferred the latest billing dates (completed Phase 2 of SKILL.md), you MUST update the state: 1. Merge the newly inferred subscriptions with the existing data from Procedure 1. 2. Update the `last_scan_date`. 3. Overwrite `subscriptions.json` entirely with the new combined JSON structure using your file writing tool (e.g., `write_file` or `echo ... >` via `exec`). ``` ### Technical Analysis The instructions require the agent to persist subscription information—including service names, billed amounts, currencies, billing cycles, and billing dates—in `subscriptions.json` in the current workspace. These fields reveal sensitive aspects of the user's financial activity. No encryption, restrictive file permissions, private storage location, retention period, deletion mechanism, ...[truncated 1903 chars]
- Remediation
- ## Remediation Suggestions 1. Obtain explicit user consent before retaining any financial metadata, and provide a mode that performs analysis without persistence. 2. Store state in a dedicated per-user application-data directory rather than the current workspace or a source-controlled directory. 3. Create the storage directory and file with owner-only permissions, such as `0700` for the directory and `0600` for the file, where the platform supports them. 4. Encrypt persisted data at rest using a platform credential store or a key that is not stored alongside the state file. 5. Minimize retained data. Avoid storing exact payment amounts and dates unless they are necessary, and document why each retained field is required. 6. Define a retention period and provide clear deletion and state-reset procedures. 7. Replace shell redirection with a structured file-writing API. Write to a protected temporary file in the same directory, validate the resulting JSON, apply restrictive permissions, and atomically rename it into place. 8. Ensure that `subscriptions.json` and temporary state files are excluded from version control, synchronization, diagnostic bundles, and logs. 9. Document the local disclosure risk so users can make an informed decision before enabling persistent state.
