Skip to content

HIGH: Passwordless magic link token returned in API response #46

@Senthil455

Description

@Senthil455

Summary

The passwordless magic link token is returned in the API response body. Anyone who intercepts the response can authenticate as that user without a password.

Affected File

services/auth-service/index.js:1618

Root Cause

// The passwordless token (allows password-free login) is returned in JSON response
res.json({
    token: passwordlessToken,  // Anyone with this token can log in as this user
    expiresIn: 300
});

The magic link token should be sent via email/SMS only, never returned in the API response. Returning it in the response means:

  • Anyone who can read network traffic (proxy, logging middleware, browser dev tools) gets a permanent access token
  • The token bypasses password authentication entirely

Impact

  • Anyone who intercepts the API response can authenticate as any user
  • The "passwordless" feature is reduced to "no password needed if you can read the response"
  • Makes a mockery of the authentication system

Fix Required

Remove the token from the API response. Instead:

  1. Send the token via email only (the actual magic link)
  2. Return only { success: true, message: "Check your email for the login link" }
  3. Never expose the token in any API response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghighHigh severitysecuritySecurity

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions