Keats / validator

Simple validation for Rust structs
MIT License
2.03k stars 147 forks source link

Always first perform least expensive validations #234

Open Glitchy-Tozier opened 2 years ago

Glitchy-Tozier commented 2 years ago

Basically, first perform length-checks (especially for arrays) and only then perform all other checks. Perform custom checks last.

This is to aid as an additional buffer against primitive DOS attacks.

jmjoy commented 9 months ago

Maybe throw a compile-time warning when length-checks aren't defined firstly in #[validate] is a good idea.