-
Notifications
You must be signed in to change notification settings - Fork 15
security: [HIGH] Path traversal in Reddit username URL construction in reddit-fetch.ts #3202
Copy link
Copy link
Open
Labels
safe-to-workSecurity triage: safe for automated processingSecurity triage: safe for automated processingsecurity-review-requiredSecurity review found critical/high issues - changes requiredSecurity review found critical/high issues - changes required
Description
File: .claude/skills/setup-agent-team/reddit-fetch.ts:151
Severity: HIGH
Finding: The fetchUserComments function constructs Reddit API URLs by directly interpolating usernames without validation:
const data = await redditGet(token, `/user/${username}/comments?limit=25&sort=new`);If a Reddit post author has a malicious username containing path traversal sequences (e.g., ../../../admin, ..%2F..%2F), this constructs an attacker-controlled API path that could:
- Access unintended Reddit API endpoints
- Bypass rate limits by hitting different paths
- Leak sensitive data from non-public endpoints
Recommendation:
- Validate usernames match Reddit's allowed character set:
/^[A-Za-z0-9_-]+$/ - Reject usernames containing
/,.., or URL-encoded traversal sequences - Use URL encoding via
encodeURIComponent(username)as defense-in-depth
Example exploit:
username = "../../../api/v1/me"
→ fetches https://oauth.reddit.com/api/v1/me instead of user comments
-- security/code-scanner
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
safe-to-workSecurity triage: safe for automated processingSecurity triage: safe for automated processingsecurity-review-requiredSecurity review found critical/high issues - changes requiredSecurity review found critical/high issues - changes required