-
Notifications
You must be signed in to change notification settings - Fork 0
PR-Feat: week 3 checkout #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements backend authentication and session management hardening for Week 3, introducing password complexity enforcement, login rate limiting, and scheduled session pruning with comprehensive documentation updates.
Key Changes
- Added password complexity validation requiring minimum 8 characters with uppercase, lowercase, and digit requirements
- Implemented in-memory rate limiting for login attempts (5 failures per 5 minutes) returning HTTP 429 with RATE_LIMITED error code
- Added scheduled hourly session pruning job to automatically clean up expired sessions
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/main/java/com/sameboat/backend/auth/dto/RegisterRequest.java |
Enhanced password validation with complexity requirements using Bean Validation pattern |
src/main/java/com/sameboat/backend/auth/RateLimiterService.java |
New in-memory rate limiting service with sliding window implementation |
src/main/java/com/sameboat/backend/auth/AuthController.java |
Integrated rate limiting into login flow with proper error handling |
src/main/java/com/sameboat/backend/SameboatBackendApplication.java |
Enabled Spring scheduling for session pruning jobs |
src/test/java/com/sameboat/backend/auth/RateLimitingIntegrationTest.java |
Integration test for rate limiting behavior |
src/test/java/com/sameboat/backend/auth/PasswordComplexityValidationTest.java |
Test for password complexity validation |
docs/RISKS.md |
New risk documentation cataloging security considerations and mitigations |
docs/spikes/jwt-session-tradeoffs.md |
Architecture spike comparing JWT vs opaque session strategies |
docs/api.md |
Updated API documentation with new error codes and password requirements |
docs/Architecture.md |
Updated architecture documentation reflecting authentication changes |
| Various other files | Documentation updates and project tracking changes |
src/main/java/com/sameboat/backend/auth/dto/RegisterRequest.java
Outdated
Show resolved
Hide resolved
src/main/java/com/sameboat/backend/auth/RateLimiterService.java
Outdated
Show resolved
Hide resolved
src/main/java/com/sameboat/backend/auth/RateLimiterService.java
Outdated
Show resolved
Hide resolved
|
Coverage (Instructions): 100% |
The regex pattern duplicates the minimum length constraint already enforced by @SiZe(min = 8). The pattern should be simplified to remove the redundant length check: ^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).*$ Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
src/main/java/com/sameboat/backend/auth/RateLimiterService.java
Outdated
Show resolved
Hide resolved
src/test/java/com/sameboat/backend/auth/RateLimitingIntegrationTest.java
Outdated
Show resolved
Hide resolved
The comment 'not dev' references a hardcoded stub password assumption. This creates a dependency on knowing internal test configuration. Consider making the test password selection more explicit or document the dev auto-create behavior. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
src/test/java/com/sameboat/backend/auth/RateLimitingIntegrationTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
src/test/java/com/sameboat/backend/auth/RateLimitingIntegrationTest.java
Outdated
Show resolved
Hide resolved
The variable email is not defined in this test class. This should use a hardcoded email address like 'ratelimit@example.com' as mentioned in the comment on line 25. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
src/main/java/com/sameboat/backend/auth/session/SessionPruner.java
Outdated
Show resolved
Hide resolved
src/test/java/com/sameboat/backend/auth/RateLimitingIntegrationTest.java
Show resolved
Hide resolved
Using fixedDelayString means the next execution waits 1 hour after the previous execution completes. For a cleanup job, fixedRateString might be more appropriate to ensure consistent hourly execution regardless of processing time. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.
The use of ObjectProvider<SessionPruner> self to obtain a proxy for @transactional method calls is a complex pattern. Consider using @async with @EnableAsync or extracting the transactional logic to a separate service to improve maintainability and reduce the need for self-injection. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
…gration test to use prune service
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
This pull request introduces several backend hardening features focused on authentication, session management, and documentation. The most important changes are the addition of password complexity enforcement during registration, in-memory login rate limiting with a new error code, scheduled session pruning, and comprehensive documentation updates reflecting these improvements. Integration tests have been added for all major new features.
Authentication & Security Enhancements
VALIDATION_ERROR. Documentation and sample requests have been updated accordingly. [1] [2] [3] [4] [5] [6]RATE_LIMITEDerror code. This is reflected in error code documentation and integration tests. [1] [2] [3] [4] [5] [6] [7]Session Management
Documentation & Error Handling
docs/RISKS.md) and JWT session tradeoff spike added. [1] [2] [3] [4]RATE_LIMITED; sample requests and responses now demonstrate new behaviors. [1] [2] [3] [4] [5]Configuration & CI
Reference: See
CHANGELOG.md,docs/RISKS.md, and updated API documentation for a full narrative of changes.This pull request focuses on backend authentication and session management hardening. It introduces password complexity enforcement for registration, login rate limiting with a new error code, scheduled session pruning, and updates documentation to reflect these changes. Risk mitigations and architectural tradeoffs are also documented to guide future improvements.Authentication & Security Enhancements
RATE_LIMITEDerror code (HTTP 429), with documentation and error code catalog updated. [1] [2] [3] [4] [5] [6]Session Management
Documentation & Risk Tracking
docs/RISKS.mdfile catalogs current backend risks and mitigations. (F5230f71L2R2, [1] [2]docs/spikes/jwt-session-tradeoffs.md) discusses JWT vs. opaque session token strategies for future reference.Project Tracking
TTD.mdupdated to reflect the new features and their implementation status.These changes collectively improve authentication robustness, error handling clarity, and operational security for the backend.
Closes #35
Closes #34
Closes #31
Closes #30
Closes #29
Closes #28
Closes #25
Closes #23