Skip to content

[Bug]: randId() uses Math.random() — collision risk across devices and messages #1273

Description

@danditomaso

apps/web/src/core/utils/randId.ts:2 generates IDs with Math.floor(Math.random() * 1e9) — ~30 bits of entropy, no crypto guarantees. Used for device IDs and other identifiers where collisions cause silent state corruption.

Switch to crypto.getRandomValues() or crypto.randomUUID().

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions