Predictable results in nanoid generation when given non-integer values
- Severity:
- Medium
Description
When nanoid is called with a fractional value, there were a number of undesirable effects:
- in browser and non-secure, the code infinite loops on while (size–)
- in node, the value of poolOffset becomes fractional, causing calls to nanoid to return zeroes until the pool is next filled 3.
Recommendation
Update the nanoid
package to the latest compatible version. Followings are version details:
Affected version(s): **< 3.3.8 >= 4.0.0, < 5.0.9** Patched version(s): **3.3.8 5.0.9**
References
Related Issues
- HackMD MCP Server has Server-Side Request Forgery (SSRF) vulnerability - CVE-2025-59155
- tarteaucitron.js allows UI manipulation via unrestricted CSS injection - CVE-2025-31138
- Potential DoS when using ContextLines integration (GHSA-r5w7-f542-q2j4) - Vulnerability
- happy-dom allows for server side code to be executed by a <script> tag - CVE-2024-51757
- Tags:
- npm
- nanoid
Anything's wrong? Let us know Last updated on December 13, 2024