Skip to content

Cryptographically Weak #105

@prathamtagad

Description

@prathamtagad

File: userAuth.controller.js

OTPs are generated using Math.random(), which is not cryptographically secure. An attacker who can predict the RNG state could forge OTPs.

const otp = Math.floor(100000 + Math.random() * 900000).toString();

The dashboard-api already uses crypto.randomInt() in auth.controller.js,
The public-api should follow the same pattern for consistency and security.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions