Skip to content

[Security]: Hardcoded JWT secret and authentication bypass vulnerabilities #342

@vipul674

Description

@vipul674

Summary

Two critical security vulnerabilities exist in the authentication layer:

  1. Hardcoded JWT Secret (src/middleware/authMiddleware.js:3): The JWT signing secret is hardcoded as "jwt_secret_key" in source code. Anyone with repo access can forge valid tokens and bypass authentication entirely.

  2. Authentication Bypass (server.js:716-738): The requireSupabaseAuth middleware skips JWT verification when SUPABASE_JWT_SECRET is not set. An attacker can send any arbitrary Bearer token and the request is accepted without cryptographic validation.

Steps to reproduce

  1. Start the server without setting SUPABASE_JWT_SECRET environment variable
  2. Send a POST request to /process-from-url with header Authorization: Bearer any-random-string
  3. The request is accepted and processed without valid JWT verification

Expected behavior

The server should reject requests with invalid or missing JWT tokens, even when SUPABASE_JWT_SECRET is not configured. The hardcoded JWT secret should be read from environment variables, not source code.

Actual behavior

When SUPABASE_JWT_SECRET is not set, the middleware accepts any Bearer token without verification. The hardcoded JWT secret is committed to the repository, making it accessible to anyone with read access.

Additional context

  • Severity: Critical (CVSS 9.1 - Network/Low/None/Changed/High/High)
  • CWE: CWE-798 (Use of Hard-coded Credentials), CWE-287 (Improper Authentication)
  • Affected files: src/middleware/authMiddleware.js, server.js

GSSoC '26 Assignment Request

"I'd like to work on this — contributing under GSSoC'26"

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions