v1.0.0
Breaking: security.trustXForwardedFor now defaults to false
Previously true, which allowed IP spoofing on directly internet-facing apps. If behind a trusted proxy, explicitly set security: { trustXForwardedFor: true }.
π Features
- delayOnBan β 1-second delay before 429 when user is banned (was documented but not implemented)
- Standard rate-limit headers β
X-RateLimit-Limit,X-RateLimit-Remaining,X-RateLimit-Reseton all responses - JSON 429 response body β Returns
{ error, retryAfter }instead of plain text for easier client handling skipRoutesoption β exempt paths from rate limiting without listing every protected route- Fail2ban export format β
log.fail2banwrites ban events in fail2ban-compatible format for firewall-level blocking - Cache route match result to avoid duplicate
findBestMatchingRoute()calls
π©Ή Fixes
- Default
trustXForwardedFortofalse(security hardening) - Prefix matching respects path segment boundaries (
/api/v3no longer matches/api/v3-secret) - IPv6 compatibility β sanitize colons in storage keys (
2001:db8::1β2001_db8__1) forfsdriver - Warn at build time if
nitro.storage.shieldis missing - Remove stray debug
console.logfrom shield middleware - Playground scheduled tasks use correct names (
shield:cleanBans,shield:cleanIpData) - Empty client plugin removed (no-op registration)
β‘ Performance
- Log buffering β batch shield log writes in memory, flush every 5s; fire-and-forget (no
awaiton hot path) - Reduce test ban duration 10sβ4s, cutting CI time by ~13s
π Documentation
- Production Deployment section β Redis vs memory/fs tradeoffs
- Fail2ban Integration section β full setup guide with filter and jail config
- README defaults aligned with module defaults
- Per-route
banoverride documented (was misleadingly marked as global-only)