express-zod-api
Affected
- introduced
0, fixed10.0.0-beta1(semver)
Fixed versions
10.0.0-beta1
Fix
- Fixed version
10.0.0-beta1npm install [email protected]
Advisory
Also known as: None
Zod denial of service vulnerability during email validation
Impact
API servers running express-zod-api having:
express-zod-api below 10.0.0-beta1,z.string().email(),are vulnerable to a DoS attack due to:
zod versions up to 3.22.2,zod.Patches
The patched version of zod fixing the vulnerability is 3.22.3.
However, it's highly recommended to upgrade express-zod-api to at least version 10.0.0, which does not depend on zod strictly and directly, but requires its installation as a peer dependency instead, enabling you to install the patched zod version yourself.
Workarounds
When it's not possible to upgrade your dependencies, consider the following replacement in your implementation:
- z.string().email()
+ z.string().regex(
+ /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i
+ )
This regular expression is taken from the suggested patch of zod.
References
express-zod-api version 10.0.0-beta1: https://github.com/RobinTail/express-zod-api/blob/master/CHANGELOG.md#v1000-beta1High Basis: The source's own band: HIGH
0, fixed 10.0.0-beta1 (semver)10.0.0-beta1
10.0.0-beta1npm install [email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0