Back to skill

Security audit

food-recall-radar

Security checks for vulnerabilities and agentic risk

Overview

This food-recall skill is coherent and local-first, with a limited caution that verbose mode can expose an optional openFDA API key in logs.

Before installing, be comfortable with a plaintext local pantry file that may contain purchase and household details. Prefer running without an openFDA API key for normal household use, or avoid --verbose when a key is configured; rotate the key if it has already appeared in logs or transcripts.

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

Warning
Location
scripts/recall_radar.py:95
Finding

OpenFDA API Key Exposed in Verbose Logs

Content
View full analysis

Vulnerability Details

File Location: scripts/recall_radar.py, lines 95–103
Vulnerability Type: Plaintext sensitive-data exposure through logging
Risk Level: Medium

Vulnerable Code:

python
def fetch_recalls(api_key=None, limit=1000, verbose=False):
    q = urllib.parse.quote('status:"Ongoing"')
    url = f"{OPENFDA}?search={q}&limit={limit}"
    if api_key:
        url += f"&api_key={api_key}"
    if verbose:
        print(f"# fetching {url}", file=sys.stderr)
    req = urllib.request.Request(url, headers={"User-Agent": "food-recall-radar/1.0"})
    with urllib.request.urlopen(req, timeout=30) as r:

Technical Analysis

The optional openFDA API key is appended to the request URL. When --verbose is enabled, the complete URL is printed to standard error without redacting the api_key query parameter.

Consequently, the credential can be copied into redirected logs, CI output, terminal captures, monitoring systems, or AI Agent execution transcripts. HTTPS protects the network request in transit but does not protect the key after the application emits it locally. Query-string credentials may also be retained in server or intermediary access logs.

The outbound request itself is consistent with the Skill's declared live-recall functionality. Pantry brands, products, UPCs, lots, notes, and local files are not included in the request. The vulnerability is the unnecessary disclosure of the authentication credential in verbose output, not undisclosed pantry-data exfiltration.

Attack Path

  1. A user supplies an openFDA key through --api-key or the OPENFDA_API_KEY environment variable.
  2. The user, an automation system, or an Agent invokes match or audit with --verbose.
  3. get_recalls() passes the key to fetch_recalls().
  4. fetch_recalls() inserts the key into the URL query string.
  5. The complete URL is written to standard error.
  6. An attacker with access to colle ...[truncated 672 chars]
Remediation
View remediation

Remediation Suggestions

  1. Never print the complete authenticated URL. Log only non-sensitive request metadata, such as the endpoint, search expression, and result limit.

  2. Redact the key before logging:

    python
    if verbose:
        safe_url = f"{OPENFDA}?search={q}&limit={limit}"
        if api_key:
            safe_url += "&api_key=***"
        print(f"# fetching {safe_url}", file=sys.stderr)
    
  3. Prefer an authentication header instead of a query parameter if openFDA supports that authentication method.

  4. Discourage command-line key submission because arguments can appear in shell history and process listings. Prefer OPENFDA_API_KEY or a protected configuration source.

  5. Add an automated test asserting that verbose output never contains the supplied API key.

  6. If exposure has already occurred, rotate the affected key and remove or restrict access to retained logs and transcripts containing it.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (4)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill documentation describes capabilities that access environment variables, write local files, and make live network requests, but it does not declare any explicit tool scope such as permissions or allowed-tools. That mismatch can lead to overbroad execution in agent platforms, where the runtime may grant more capability than a user expects for what appears to be a simple pantry-checking skill. The context makes this somewhat less suspicious because the stated functionality genuinely needs local storage and network access to query openFDA, but the undeclared scope still weakens least-privilege guarantees.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/recall-matching.md (reported line 15)May include surrounding context.

md
from difflib import SequenceMatcher

DEFAULT_PANTRY = os.path.join(os.path.expanduser("~"), ".pantry.json")
OPENFDA = "https://api.openfda.gov/food/enforcement.json"

# ---------------------------------------------------------------- normalize

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/recall_radar.py (reported line 25)May include surrounding context.

python
from difflib import SequenceMatcher

DEFAULT_PANTRY = os.path.join(os.path.expanduser("~"), ".pantry.json")
OPENFDA = "https://api.openfda.gov/food/enforcement.json"

# ---------------------------------------------------------------- normalize

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This code persists pantry contents, UPCs, lot numbers, and notes to a file in the user's home directory. While the file behavior is implied by the tool's purpose, there is no explicit privacy-oriented warning or disclosure in code comments, prompts, or output that this household inventory data will be stored locally.

Content

No source excerpt is available for this finding.