bilhej/backend
Hermes Agent 68cb20edba
Some checks failed
CI / Lint, type check, unit tests, coverage (pull_request) Successful in 2m49s
CI / E2E browser tests (pull_request) Failing after 1m45s
feat(security): add per-IP rate limiting on guest-order endpoints
POST /api/guest-orders is fully public (permitAll) with no captcha,
throttling, or IP-based limiting. An attacker can flood the orders table
(DB bloat / DoS) and mass-generate self-confirmed paid orders.

Changes:
  - GuestOrderRateLimitFilter: in-memory sliding-window rate limiter
    (OncePerRequestFilter + @Component). Per-IP limits:
      POST /api/guest-orders: 5 req/min (configurable)
      Other /api/guest-orders/**: 20 req/min (configurable)
    Returns 429 with Swedish JSON error when exceeded.
    Respects X-Forwarded-For and X-Real-IP headers.
  - SecurityConfig: register the filter before JWT filter
  - GuestOrderControllerTest: set high limits (1000) and reset filter
    state in @BeforeEach to avoid cross-test interference

Config via application properties:
  app.rate-limit.guest-create (default 5)
  app.rate-limit.guest-default (default 20)

Phase 0 interim: in-memory, per-JVM, resets on restart. For production,
use Bucket4j + Redis or nginx limit_req.

Closes #19
2026-07-18 11:45:13 +00:00
..
src feat(security): add per-IP rate limiting on guest-order endpoints 2026-07-18 11:45:13 +00:00
.gitattributes feat: scaffold Spring Boot 4 backend with Gradle, Flyway, and H2 2026-05-01 00:28:10 +02:00
.gitignore feat: scaffold Spring Boot 4 backend with Gradle, Flyway, and H2 2026-05-01 00:28:10 +02:00
build.gradle Add account settings dropdown and verified email change flow. 2026-05-22 14:33:06 +02:00
gradlew.bat feat: scaffold Spring Boot 4 backend with Gradle, Flyway, and H2 2026-05-01 00:28:10 +02:00