Repository navigation
@checodo/better-auth-blocklist@0.3.0
·
28 commits
to main
since this release
Minor Changes
-
51408d6: Add
passwordandiptargets.password: rules for new passwords on sign-up, change, set (server-onlysetPassword), reset (link, email OTP, phone OTP), and admin create-user/set-password, compared case-insensitively and with leetspeak folded. With thepasswordoption set, a context check also blocks passwords that contain the email's local part, the username, orappName(checkContext). Passwords are never passed toonBlockedor the audit log: the value and the matched password rule's value are"[redacted]", since anexactrule is the password itself (only the context check's"[email]","[username]","[appName]"are kept). New error codesPASSWORD_NOT_ALLOWEDandPASSWORD_CONTAINS_CONTEXT_WORD.ip: block sign-ups and sign-ins from IP addresses, CIDR ranges (IPv4 and IPv6, newcidrrule type), and countries (newcountryrule type, viagetCountry; an error thrown bygetCountryis logged and the country counts as unknown), with a403 IP_ADDRESS_NOT_ALLOWED.scopepicks"sign-up","sign-in", or both. The address is read like better-auth's rate limiter reads it (advanced.ipAddress).- The rule endpoints accept the new targets and rule types (new error codes
RULE_TYPE_NOT_SUPPORTED_FOR_TARGET,INVALID_IP_RULE,COUNTRY_RULES_REQUIRE_GET_COUNTRY).
Note:
BlocklistTargetandBlocklistMatchTypegain new members, so an exhaustiveswitchover them in anonBlockedcallback needs the new cases. Rules stored forpasswordandipapply even without the new options, like for the other targets.