Back to skill

Security audit

TokenBooks Cross-Provider AI Spend Dashboard

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent local AI spending dashboard, but unsafe HTML report generation means a malicious or tampered billing file could run browser code when the report is opened.

Install only if you are comfortable reviewing and controlling the billing files used as input. Do not generate or open dashboards from billing exports you did not create or trust until the HTML escaping issue is fixed, and treat exported JSON and generated dashboards as sensitive financial and operational records.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
token_report.py:251
Finding

Stored HTML and Script Injection in Generated Dashboard

Content
View full analysis
{provider} ${breakdown.total_cost:.2f} ({percentage:.1f}%)
""" ``` Model names are also inserted directly: ```python bars_html += f"""
{model} ${breakdown.total_cost:.2f} ({breakdown.request_count} requests)
""" ``` Dates derived from imported timestamps are placed inside an HTML attribute: ```python bars_html += f'
' ``` Waste alerts embed the unescaped model name: ```python alerts_html += f"""
⚠️ {case['model']}
Cost: ${case['total_cost']:.2f} across {case['request_count']} requests
{case['suggestion']}
""" ``` The affected values originate from imported, potentially attacker-controlled CSV or JSON records. Relevant source assignments include: ```python timestamp = row.get('Timestamp') or row.get('timestamp') or row.get('Date') model = row.get('Model') or row.get('model') ``` and: ```python timestamp = item.get('timestamp') or item.get('created_at') model = item.get('model') ``` No HTML escaping or contextual output encoding is applied before these ...[truncated 2968 chars]
Remediation
View remediation
{safe_provider} ``` ```python {safe_model} ``` ```python bars_html += ( f'
' ) ``` 4. Validate imported records before report generation: - Require provider and model fields to be strings. - Set reasonable maximum lengths. - Reject control characters. - Parse timestamps into a strict accepted format and regenerate their display representation from the parsed date. - Reject non-finite or negative numeric values where they are not meaningful. 5. Prefer a template engine with automatic HTML escaping if external dependencies become acceptable. Keep auto-escaping enabled and avoid marking imported content as safe. 6. Add a restrictive Content Security Policy to provide defense in depth. For example: ```html ``` Output encoding remains necessary because a policy does not prevent all HTML-based report spoofing. 7. Add regression tests using payloads in every imported text field, including: - `` - `` - `" onmouseover="aler ...[truncated 218 chars]
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (11)

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · README.md (reported line 1)May include surrounding context.

md
---
name: "TokenBooks Cross-Provider AI Spend Dashboard"
description: "See where your AI money goes. Track spending across OpenAI, Anthropic, Google, and more. Per-provider breakdowns, per-model costs, budget tracking, waste detection."
author: "@TheShadowRose"

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 1)May include surrounding context.

md
---
name: "TokenBooks Cross-Provider AI Spend Dashboard"
description: "See where your AI money goes. Track spending across OpenAI, Anthropic, Google, and more. Per-provider breakdowns, per-model costs, budget tracking, waste detection."
author: "@TheShadowRose"

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The text states that all costs are assumed to be in USD and instructs users to convert their data beforehand. This imposes a specific currency/locale convention on all users without offering a choice or clearly justifying the restriction as a region-specific tool.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

This code writes detailed provider usage records, including timestamps, models, task labels, token counts, and costs, to an output file. Although the operation is implemented and later acknowledged with a success message, there is no prior disclosure or caution that the export may persist sensitive billing or usage metadata to disk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown file documents handling billing exports from OpenAI, Anthropic, Google Cloud, and custom sources, which can contain potentially sensitive operational or financial metadata. While the README states that processing is local, it does not give a user-facing warning to review, protect, or sanitize imported/exported data files before sharing or storing generated outputs.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
51% confidence
Finding

The FAQ says the tool 'analyzes exported billing data, not live API usage,' which sets an expectation that inputs are local exports only. Later, the Python API example uses manager.import_openai('openai.csv'); while this may still read a local CSV, the naming creates mild intent ambiguity against the earlier documentation and could mislead readers about the actual import model.

Content

No source excerpt is available for this finding.

Scope Creep

Low
Category
Excessive Agency
Confidence
70% confidence
Finding

Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Content

Scanner excerpt · README.md (reported line 364)May include surrounding context.

md
**USE AT YOUR OWN RISK.**

- The author(s) are NOT liable for any damages, losses, or consequences arising from 
  the use or misuse of this software — including but not limited to financial loss, 
  data loss, security breaches, business interruption, or any indirect/consequential damages.
- This software does NOT constitute financial, legal, trading, or professional advice.
- Users are solely responsible for evaluating whether this software is suitable for

Scope Creep

Low
Category
Excessive Agency
Confidence
70% confidence
Finding

Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Content

Scanner excerpt · SKILL.md (reported line 377)May include surrounding context.

md
**USE AT YOUR OWN RISK.**

- The author(s) are NOT liable for any damages, losses, or consequences arising from 
  the use or misuse of this software — including but not limited to financial loss, 
  data loss, security breaches, business interruption, or any indirect/consequential damages.
- This software does NOT constitute financial, legal, trading, or professional advice.
- Users are solely responsible for evaluating whether this software is suitable for

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The skill description emphasizes that everything is local and explicitly states there are no network calls. However, the same file contains numerous outbound web links later in the document, which contradicts the absolute wording in the documentation, even though the contradiction is in documentation content rather than executable code.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

This is a direct contradiction within the skill documentation: one section makes an absolute statement that there are no network calls, while later content provides web links to external services. While the core scripts may still be local-only, the documentation as written overstates the absence of network use.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The top-level docstring frames the module as an import parser for provider billing data. However, the code also implements export_json and CLI --output behavior that writes aggregated records back out to disk, which is additional behavior not reflected in the documentation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.