Skip to content

harden: add output encoding in AuthController.js - #87

Open
anupamme wants to merge 1 commit into
murraco:masterfrom
anupamme:fix-repo-node-jwt-v003-uuid-v4-refresh-token
Open

harden: add output encoding in AuthController.js#87
anupamme wants to merge 1 commit into
murraco:masterfrom
anupamme:fix-repo-node-jwt-v003-uuid-v4-refresh-token

Conversation

@anupamme

@anupamme anupamme commented Aug 7, 2026

Copy link
Copy Markdown

Summary

Harden input handling in api/controllers/AuthController.js (flagged by multi_agent_ai).

Vulnerability

Field Value
ID V-003
Severity HIGH
Scanner multi_agent_ai
Rule V-003
File api/controllers/AuthController.js:49
Assessment Defensive hardening
CWE CWE-79

Description: The refresh token mechanism uses UUIDv1 tokens stored in the database. While the token is rotated when a new JWT is generated (line 38), there is no mechanism to invalidate refresh tokens on logout or password change. If an attacker obtains a valid refresh token (e.g., via network interception or XSS), they can use it to generate new JWTs indefinitely until the legitimate user happens to authenticate again (which rotates the token). Additionally, UUIDv1 is time-based and partially predictable.

Threat Model Context

This controller appears to be publicly accessible. This is a web service - vulnerabilities in request handlers are directly exploitable by remote attackers.

Changes

  • api/controllers/AuthController.js

Behavior Preservation

The change is scoped to 1 file on the vulnerable path; it only tightens handling of untrusted input and leaves valid inputs unaffected.


This patch removes an exploit primitive — a code pattern that, while not independently exploitable today, could be chained with other weaknesses by automated exploit-development tooling. Proactive removal of such primitives raises the bar against increasingly capable automated attack tools.


Automated security fix by OrbisAI Security

Automated security fix generated by OrbisAI Security
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant