File tree Expand file tree Collapse file tree
backend/src/main/java/com/back/global/security Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,12 +150,25 @@ private void authenticate(
150150 private boolean isWhitelistedPath (String requestUrl ) {
151151 for (String prefix : PATH_PREFIX_WHITELIST ) {
152152 if (requestUrl .startsWith (prefix )) {
153- // /api/v1/events로 시작하지만 /pre-registers를 포함하는 경우 제외
154- if (requestUrl .contains ("/pre-registers" )
155- || requestUrl .contains ("/seats" )) {
156- return false ;
153+ // Whitelist 방식: 명시적으로 허용할 패턴만 정의 (Default Deny)
154+
155+ // 1. 이벤트 목록 조회: /api/v1/events (쿼리 파라미터 허용)
156+ if (requestUrl .matches ("^/api/v1/events(\\ ?.*)?$" )) {
157+ return true ;
158+ }
159+
160+ // 2. 이벤트 상세 조회: /api/v1/events/{id}
161+ if (requestUrl .matches ("^/api/v1/events/\\ d+$" )) {
162+ return true ;
157163 }
158- return true ;
164+
165+ // 3. 사전등록 수 조회: /api/v1/events/{id}/pre-registers/count
166+ if (requestUrl .matches ("^/api/v1/events/\\ d+/pre-registers/count$" )) {
167+ return true ;
168+ }
169+
170+ // 위 패턴에 해당하지 않으면 인증 필요
171+ return false ;
159172 }
160173 }
161174 return false ;
You can’t perform that action at this time.
0 commit comments