Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
"/swagger-ui.html",
"/swagger-resources",
"/actuator",
"/api/v1/auth/refresh"
"/api/v1/auth/refresh",
"/api/test"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The addition of "/api/test" to EXCLUDED_PATHS combined with the startsWith matching logic in the shouldNotFilter method (line 113) creates a security vulnerability. This causes the JWT authentication filter to be skipped for any request URI starting with "/api/test", inadvertently including the protected /api/test-auth endpoint. Consequently, legitimate authenticated requests to /api/test-auth receive a 401 Unauthorized error, breaking access to protected test endpoints. This also highlights a broader maintainability issue: the EXCLUDED_PATHS list duplicates and is inconsistent with SecurityConfig's PERMIT_ALL_URL_ARRAY. For example, paths like /api/v1/tags/** and /api/v1/auth/signup are permitAll in SecurityConfig but are missing from EXCLUDED_PATHS, potentially leading to incorrect JWT authentication requirements. It is strongly recommended to use a more precise matching mechanism, such as equals() for exact matches or Spring's AntPathMatcher for pattern matching, to ensure only intended paths are excluded. For a more robust solution, consider refactoring to manage all security configurations in a single place, perhaps using WebSecurityCustomizer in SecurityConfig to completely bypass the filter chain for ignored paths, making EXCLUDED_PATHS unnecessary.

);

@Override
Expand Down
Loading