Summary
The Reddit API response parser in .claude/skills/setup-agent-team/reddit-fetch.ts casts untrusted API responses to Record<string, unknown> and accesses nested properties without validating against prototype pollution keys.
Location
- File:
.claude/skills/setup-agent-team/reddit-fetch.ts
- Function:
extractPosts()
- Lines: 184-213
Vulnerability
The function receives JSON from Reddit's API and directly casts it:
const listing = data as Record<string, unknown>;
const listingData = listing.data as Record<string, unknown> | undefined;
const children = listingData?.children;
// ... iterates over children and accesses .data properties
If the API response contains __proto__, constructor, or prototype keys, they could be inadvertently spread into objects elsewhere in the codebase, potentially polluting Object.prototype.
Impact
- MEDIUM severity — The function uses safe string coercion (
String(d.title ?? "")) and doesn't directly assign to user-controlled keys, reducing practical risk
- If combined with other vulnerable code that spreads these objects, prototype pollution could occur
- Reddit's API is not expected to return such keys, but defense-in-depth is prudent
Recommendation
- Add explicit checks against prototype pollution keys before accessing/spreading API response objects:
const DANGEROUS_KEYS = ['__proto__', 'constructor', 'prototype'];
for (const key of DANGEROUS_KEYS) {
if (key in listing) delete listing[key];
}
- Use valibot schemas for strict validation of API responses (consistent with the rest of the codebase)
- Consider using
Object.create(null) for intermediate objects that hold API data
Summary
The Reddit API response parser in
.claude/skills/setup-agent-team/reddit-fetch.tscasts untrusted API responses toRecord<string, unknown>and accesses nested properties without validating against prototype pollution keys.Location
.claude/skills/setup-agent-team/reddit-fetch.tsextractPosts()Vulnerability
The function receives JSON from Reddit's API and directly casts it:
If the API response contains
__proto__,constructor, orprototypekeys, they could be inadvertently spread into objects elsewhere in the codebase, potentially polluting Object.prototype.Impact
String(d.title ?? "")) and doesn't directly assign to user-controlled keys, reducing practical riskRecommendation
Object.create(null)for intermediate objects that hold API data