arcjet / arcjet-js

Arcjet JS SDKs. Rate limiting, bot protection, email verification & attack defense for Node.js, Next.js, Bun & SvelteKit.
https://arcjet.com
Apache License 2.0
241 stars 5 forks source link

Validate characteristics #1801

Open blaine-arcjet opened 3 hours ago

blaine-arcjet commented 3 hours ago

If we fail to build a fingerprint from characteristics, we should immediately return an error decision saying the fingerprint could not be built.

This should happen before we build the fingerprint at the beginning of the protect() function.

davidmytton commented 3 hours ago

It would be useful to have error codes or some way to check what the error was so different responses can be constructed depending on the error. For example if the user agent header is missing you might want to handle it differently from if the IP is missing (or some other custom header).

blaine-arcjet commented 3 hours ago

It would be useful to have error codes or some way to check what the error

Structured errors were brought up previously by @e-moran but I'm not sure if we captured it as an issue. I think that's a very large topic and project though.

davidmytton commented 3 hours ago

Fair enough - doesn't need to be part of this issue.