Vulnerabilities/

nanoid: custom generators can loop indefinitely when size is zero

Severity:
High

Description

nanoid (Nano ID) before 5.1.6 contains an infinite loop in the customAlphabet and customRandom functions. When these functions are configured with a size of 0, the internal generation loop never satisfies its exit condition and spins indefinitely, hanging the calling thread.

Recommendation

Update the nanoid package to the latest compatible version. Followings are version details:

References

Related Issues

Tags:
npm
nanoid
Anything's wrong? Let us know Last updated on August 13, 2026