Skip to content

fix(hardening): security headers, rate limiting on /oauth2/token, env-var issuer URI#7

Merged
stupidly-logical merged 1 commit intomainfrom
fix/hardening
Apr 4, 2026
Merged

fix(hardening): security headers, rate limiting on /oauth2/token, env-var issuer URI#7
stupidly-logical merged 1 commit intomainfrom
fix/hardening

Conversation

@stupidly-logical
Copy link
Copy Markdown
Owner

Summary

  • Security response headers added: HSTS (1yr, includeSubDomains), Content-Security-Policy, Referrer-Policy, X-Content-Type-Options
  • RateLimitingFilter added using Bucket4j: 20 requests/min per IP on POST /oauth2/token; responds with HTTP 429 and RFC 6749-compliant JSON on exhaustion
  • ProviderConfig now reads issuer URI from OAUTH2_ISSUER_URI env var (was hardcoded to http://localhost:9000)
  • oauth2.issuer-uri property added to application.properties
  • bucket4j-core 8.10.1 added to pom.xml

Fixes

Issues #16, #17, #18 from the production checklist.

Test plan

  • Response headers include Strict-Transport-Security, Content-Security-Policy, Referrer-Policy, X-Content-Type-Options
  • More than 20 rapid POST /oauth2/token requests from same IP returns HTTP 429
  • 429 body is {"error":"too_many_requests","error_description":"Rate limit exceeded"}
  • Setting OAUTH2_ISSUER_URI=https://auth.example.com reflects in /.well-known/oauth-authorization-server response

🤖 Generated with Claude Code

…v-var issuer URI

- Add HSTS, CSP, referrer policy, content-type-options response headers
- Add Bucket4j rate limiter filter: 20 req/min per IP on POST /oauth2/token, returns 429
- Fix ProviderConfig to read issuer URI from OAUTH2_ISSUER_URI env var
- Add oauth2.issuer-uri property to application.properties
- Add bucket4j-core 8.10.1 dependency

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stupidly-logical stupidly-logical merged commit 8a56e64 into main Apr 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant