Added /error in SecurityConfig.java - #119
Merged
Merged
Conversation
AnUbH75
requested review from
DenizAltunkapan,
GabrielBBaldez and
MaximilianRau04
as code owners
August 21, 2026 21:18
Contributor
Author
|
@DenizAltunkapan please have a look on did a few changes, but things are working well on local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
/errortoSecurityConfig'spermitAll()matcher list, and consolidates the app's unauthenticated path prefixes into a single sharedPublicPathsclass referenced by bothJwtAuthFilterandSecurityConfig, so the two can no longer drift apart.Without the
/errorfix, an anonymous request to/api/public/secure-sends/{token}for an unknown, expired, or revoked token had its real response (404/410 fromSecureSendService.resolve()) silently replaced during Spring's internal/errorre-dispatch, surfacing as a bare 403 instead.While verifying this fix end-to-end, found
JwtAuthFilter's own hardcoded skip-list was separately out of sync withSecurityConfig'spermitAll()list in two more places: the/s/{token}short-link route (introduced with thepublic-base-urlfix) and/docs/**//ws-chat/**, both permitted inSecurityConfigbut still rejected with 401 by the filter. Fixed by extracting one sharedPublicPaths.PREFIXESlist that both classes now derive from.The filter-level part of #109 (
JwtAuthFilterskipping/api/public/) and thepermitAllentry for/api/public/secure-sends/**were already present onmainprior to this change (landed with #104). This PR addresses the/errorgap the issue explicitly called out, plus the follow-on drift bugs found while verifying it.Linked issue
Closes #109
How to test
403empty body. After:404with bodySecure Send link is unavailable.401./s/{token}short link (withcloudpage.share.public-base-urlpointed at the frontend): no longer 401s at the filter./docs/**and/ws-chat/**: no longer 401 for anonymous requests./v3/api-docs,/swagger-ui/index.html→200.Notes / Risk
SecurityConfigalready declared.SecureSendControllerTestruns withaddFilters = false, which bypasses the exact filter/permitAllinteraction these fixes address. Verified manually via curl instead (above); flagging as a possible follow-up if a dedicated@SpringBootTestis wanted.