Skip to content

security: [HIGH] Missing input validation on Reddit credentials #3198

@louisgv

Description

@louisgv

Summary

Reddit OAuth credentials from environment variables are used directly in HTTP Basic auth without validation, which could lead to authentication bypass if credentials contain special characters.

Location

.claude/skills/setup-agent-team/reddit-fetch.ts:82-90getToken()

Vulnerability

The code constructs HTTP Basic auth by concatenating CLIENT_ID and CLIENT_SECRET with a colon:

const auth = Buffer.from(`${CLIENT_ID}:${CLIENT_SECRET}`).toString("base64");

If either credential contains a colon character, the Basic auth encoding is broken (the server will parse the wrong username/password). Additionally, if credentials contain newlines, they could inject headers.

Risk

  • Severity: HIGH
  • Impact: Authentication bypass or header injection
  • Probability: Low (requires malicious env vars)
  • Defense-in-depth: Validates the integrity of credential formatting

Recommendation

Add input validation before constructing the auth header:

if (CLIENT_ID.includes(':') || CLIENT_ID.includes('\n') ||
    CLIENT_SECRET.includes(':') || CLIENT_SECRET.includes('\n')) {
  console.error('Invalid Reddit credentials format');
  process.exit(1);
}

Context

Filed by automated security scan (2026-04-06)

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-human-reviewIssue needs human review before automated processingsafe-to-workSecurity triage: safe for automated processingsecuritySecurity vulnerabilities and concerns

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions