T09 · Insecure Skill Coding Practices
- Location
api-gateway.js:385- Finding
Sensitive Request Bodies Are Persisted in Metadata-Only Cache Keys
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This API gateway is mostly purpose-aligned, but it can persist sensitive request bodies in cache keys despite claiming metadata-only caching and its network allowlist is narrower in the documentation than in the implementation.
Review this before installing. Use it only for endpoints you explicitly trust, avoid sending secrets or regulated data in request bodies, and clear cache/logs after sensitive work. Do not rely on the metadata-only cache claim in this version: request body contents may be written into cache.json by default. Prefer scoped environment variables or a secrets manager for keys, and treat the whole memory/api-gateway directory as sensitive local storage.
api-gateway.js:385Sensitive Request Bodies Are Persisted in Metadata-Only Cache Keys
api-gateway.js:171Provider Allowlist Does Not Restrict Network Destinations or Request-Body Transmission
Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
const entries = Object.entries(keys);
// Also detect env-var-only providers
const envProviders = Object.keys(process.env)
.filter(k => k.endsWith('_API_KEY') && process.env[k])
.map(k => k.replace(/_API_KEY$/, '').toLowerCase());
The README advertises external API calls, request logging, and response caching but does not warn that prompts, headers, request bodies, or provider responses may be transmitted to third parties and retained locally. In an agent skill context, users may pass sensitive data through the gateway, so missing disclosure and guidance increases the risk of inadvertent data exposure and retention.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
Make an HTTP request with automatic retry and timeout.
const result = await AG.makeRequest('https://api.openai.com/v1/models', 'GET', {}, null, 30000);
maskKey(key)Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
Make an HTTP request with automatic retry and timeout.
const result = await AG.makeRequest('https://api.openai.com/v1/models', 'GET', {}, null, 30000);
maskKey(key)Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
Make an HTTP request with automatic retry and timeout.
const result = await AG.makeRequest('https://api.openai.com/v1/models', 'GET', {}, null, 30000);
maskKey(key)Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
Make an HTTP request with automatic retry and timeout.
const result = await AG.makeRequest('https://api.openai.com/v1/models', 'GET', {}, null, 30000);
maskKey(key)Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
---
name: api-gateway
description: Smart proxy for external API calls with retry, caching, rate limiting, and fallback providers. PERSISTS: API keys (chmod 0600 plaintext in keys.json), request/response cache metadata, and request logs. Network: outbound HTTPS only, with a strict provider-domain allowlist. Caches metadata by default; full response bodies are opt-in per provider.
---
# API Gateway ⚡
The early description of persisted data understates the sensitivity of what can be written when full-body caching is enabled. Because users often rely on top-level summaries, this can cause them to enable or use the skill under a false assumption that only low-risk metadata is stored, when complete API responses may later be written to disk. For a gateway handling tokens, prompts, and provider responses, understated persistence is a meaningful security weakness.
The documentation is internally inconsistent about what data is persisted. Earlier sections say request logs do not store endpoints or request/response bodies and that cache is metadata-only by default, but the later security note states logs/cache may persist sensitive bodies and endpoints, which can mislead operators about actual data-retention risk. In a tool that handles secrets and forwards prompts to third-party APIs, inaccurate security disclosures materially increase the chance of accidental exposure.
The header says environment keys override disk storage and implies they are a supported credential path. In practice, shouldAttachAuth reads allowlists only from keys[provider] on disk (L135-L152), and env-only providers have no mechanism to supply an allowlist, so auth attachment is refused and calls proceed unauthenticated or fail logically. This contradicts the documented security model and the --keys output that advertises env-only providers as supported.
The tool claims endpoint paths are not stored, but both cache and rate-limit state persist keys derived from provider plus path-only endpoints. Even without query strings, API paths frequently reveal sensitive business context such as model names, tenant-specific routes, internal API structure, or resource identifiers, so this is a documentation/behavior mismatch that can cause unintended metadata leakage to disk.
The Agent Protocol uses imperative language such as Use the gateway and Add keys with allowlist as a general operating rule. While not a language/locale issue, this does not clearly violate the only policy example in scope, so confidence is limited; if interpreted as organizational natural-language policy, it is still weakly prescriptive rather than offering choice.
The top-level documentation advertises a retention-setting feature, but the only handling is parsing --retention into result.flags.retention at L738-L740. No later code uses that value to update TTLs, log retention, or persisted settings, so the documented behavior contradicts actual execution.
No suspicious patterns detected.