T09 · Insecure Skill Coding Practices
- Location
scripts/delegate_task.py:287- Finding
Unredacted Task Descriptions Persisted in Plaintext Cost Logs
- Content
View full analysis
Vulnerability Details
File Location:
scripts/delegate_task.py, lines 287-311
Vulnerability Type: Plaintext storage of potentially sensitive user-controlled data
Risk Level: MediumVulnerable Code
python def log_cost(self, task_id: str, result: TaskResult): """Log actual vs estimated costs to tracking file.""" log_entry = { "timestamp": time.time(), "task_id": task_id, "description": self.tasks[task_id].description, "model": result.model_used.value, "estimated_cost": self.tasks[task_id].estimated_cost, "actual_cost": result.actual_cost, "accuracy": result.actual_cost / self.tasks[task_id].estimated_cost if self.tasks[task_id].estimated_cost > 0 else 1.0 } try: # Read existing log try: with open("taskmaster-costs.json", "r") as f: costs = json.load(f) except FileNotFoundError: costs = [] # Append new entry costs.append(log_entry) # Write back with open("taskmaster-costs.json", "w") as f: json.dump(costs, f, indent=2)Technical Analysis
The cost logger stores the full task description in
taskmaster-costs.json. Task descriptions are arbitrary user-controlled content and may include proprietary source code, customer records, incident details, internal URLs, access tokens, or other confidential information.The data is written without redaction, encryption, an explicit user opt-in, retention controls, or restrictive file permissions. The path is relative to the process working directory, making its location dependent on how the Skill is launched. The resulting permissions also depend on the process umask.
This storage exceeds the minimum data required for cost tracking. Cost accounting only requires identifiers, model information, token counts, and monetary t ...[truncated 1145 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the
descriptionfield from cost logs by default. Store only a non-sensitive task identifier, model name, token counts, timestamp, and cost totals. - If descriptions are required for diagnostics, require explicit opt-in and provide a prominent warning that task content will be retained.
- Add configurable redaction for credentials, authorization headers, URL query tokens, email addresses, and other sensitive patterns.
- Store logs in a dedicated application data directory rather than the current working directory.
- Create the log with owner-only permissions, such as mode
0600, and verify existing file permissions before appending. - Use atomic file replacement to prevent partial writes and apply appropriate locking for concurrent writers.
- Define retention limits and provide a deletion mechanism.
- Add
taskmaster-costs.jsonto source-control ignore rules where appropriate.
- Remove the
