From 8867a1dc2d2a2270fb57ef873000f5d99670f678 Mon Sep 17 00:00:00 2001 From: namgigun Date: Mon, 13 Oct 2025 15:37:26 +0900 Subject: [PATCH 1/5] =?UTF-8?q?Fix:=20Oauth2LoginSuccessHandler=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 하드코딩 되어 있던 리다이렉트 부분 수정 "localhost:3000/login/oauth2" -> FRONTEND_BASE_URL + "/login/oauth2" --- .../global/security/oauth/OAuth2LoginSuccessHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/back/global/security/oauth/OAuth2LoginSuccessHandler.java b/src/main/java/com/back/global/security/oauth/OAuth2LoginSuccessHandler.java index 7c0ba157..a5fff504 100644 --- a/src/main/java/com/back/global/security/oauth/OAuth2LoginSuccessHandler.java +++ b/src/main/java/com/back/global/security/oauth/OAuth2LoginSuccessHandler.java @@ -15,6 +15,7 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.stereotype.Component; @@ -40,6 +41,8 @@ public class OAuth2LoginSuccessHandler implements AuthenticationSuccessHandler { private final UserTokenRepository userTokenRepository; private final ObjectMapper objectMapper; + @Value("${frontend.base-url}") + private String FRONTEND_BASE_URL; @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, @@ -73,7 +76,7 @@ public void onAuthenticationSuccess(HttpServletRequest request, ); // 프론트엔드 리다이렉트 - response.sendRedirect("http://localhost:3000/login/oauth2"); + response.sendRedirect(FRONTEND_BASE_URL + "/login/oauth2"); } catch (CustomException e) { handleException(response, e); } catch (Exception e) { From 4618c3aa0af23006f8d1ecfd610a2265ce4b0d5f Mon Sep 17 00:00:00 2001 From: namgigun Date: Mon, 13 Oct 2025 15:49:32 +0900 Subject: [PATCH 2/5] =?UTF-8?q?Infra:=20AWS=20=EC=9D=B8=EB=B0=94=EC=9A=B4?= =?UTF-8?q?=EB=93=9C=20=EA=B7=9C=EC=B9=99=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 기존: 모든 프로토콜에 대해서 허용 - 변경: SSH, HTTP, HTTPS, UDP에 대해서만 허용 --- infra/terraform/main.tf | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/infra/terraform/main.tf b/infra/terraform/main.tf index 1817677f..2882f0b8 100644 --- a/infra/terraform/main.tf +++ b/infra/terraform/main.tf @@ -125,17 +125,43 @@ resource "aws_security_group" "sg_1" { Name = "team5-sg-1" } + # SSH ingress { - from_port = 0 - to_port = 0 - protocol = "all" # 모든 프로토콜 - cidr_blocks = ["0.0.0.0/0"] # 모든 IP 허용 + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] # 필요 시 특정 IP로 제한 가능 + } + + # HTTP + ingress { + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] } + # HTTPS + ingress { + from_port = 443 + to_port = 443 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + # WebRTC UDP + ingress { + from_port = 10000 + to_port = 20000 + protocol = "udp" + cidr_blocks = ["0.0.0.0/0"] + } + + # 모든 프로토콜 egress { from_port = 0 to_port = 0 - protocol = "all" # 모든 프로토콜 + protocol = "all" cidr_blocks = ["0.0.0.0/0"] # 모든 IP 허용 } } From 2dae7d5ae66912aef84be24ef45423db7f6afeeb Mon Sep 17 00:00:00 2001 From: namgigun Date: Mon, 13 Oct 2025 16:09:10 +0900 Subject: [PATCH 3/5] =?UTF-8?q?Fix:=20File=20=EB=8F=84=EB=A9=94=EC=9D=B8?= =?UTF-8?q?=20EntityType=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - COMMENT 제거 - AVATAR, PROFILE 추가 --- src/main/java/com/back/domain/file/entity/EntityType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/back/domain/file/entity/EntityType.java b/src/main/java/com/back/domain/file/entity/EntityType.java index 3c5a4f49..9f4bf77a 100644 --- a/src/main/java/com/back/domain/file/entity/EntityType.java +++ b/src/main/java/com/back/domain/file/entity/EntityType.java @@ -1,5 +1,5 @@ package com.back.domain.file.entity; public enum EntityType { - POST, COMMENT + POST, AVATAR, PROFILE } \ No newline at end of file From e6a5abdf27b2b2dc5bde4d44dae9912563ef120d Mon Sep 17 00:00:00 2001 From: namgigun Date: Mon, 13 Oct 2025 16:16:40 +0900 Subject: [PATCH 4/5] =?UTF-8?q?Infra:=20=EC=9D=B8=EB=B0=94=EC=9A=B4?= =?UTF-8?q?=EB=93=9C=20=EA=B7=9C=EC=B9=99=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 81포트(NPM) 허용 --- infra/terraform/main.tf | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/infra/terraform/main.tf b/infra/terraform/main.tf index 2882f0b8..2ef40255 100644 --- a/infra/terraform/main.tf +++ b/infra/terraform/main.tf @@ -157,7 +157,15 @@ resource "aws_security_group" "sg_1" { cidr_blocks = ["0.0.0.0/0"] } - # 모든 프로토콜 + # NPM (port 81) + ingress { + from_port = 81 + to_port = 81 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + # 아웃바운드 모든 프로토콜 egress { from_port = 0 to_port = 0 From ec95dfd70bd04e82e100b4e9889ee0df95918066 Mon Sep 17 00:00:00 2001 From: namgigun Date: Mon, 13 Oct 2025 17:34:57 +0900 Subject: [PATCH 5/5] =?UTF-8?q?Fix:=20EntityValidator=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../back/domain/file/service/FileService.java | 6 ---- .../domain/file/util/EntityValidator.java | 31 ------------------- 2 files changed, 37 deletions(-) delete mode 100644 src/main/java/com/back/domain/file/util/EntityValidator.java diff --git a/src/main/java/com/back/domain/file/service/FileService.java b/src/main/java/com/back/domain/file/service/FileService.java index 74b03023..dd55d6a5 100644 --- a/src/main/java/com/back/domain/file/service/FileService.java +++ b/src/main/java/com/back/domain/file/service/FileService.java @@ -7,12 +7,8 @@ import com.back.domain.file.dto.FileReadResponseDto; import com.back.domain.file.dto.FileUpdateResponseDto; import com.back.domain.file.dto.FileUploadResponseDto; -import com.back.domain.file.entity.AttachmentMapping; -import com.back.domain.file.entity.EntityType; import com.back.domain.file.entity.FileAttachment; -import com.back.domain.file.repository.AttachmentMappingRepository; import com.back.domain.file.repository.FileAttachmentRepository; -import com.back.domain.file.util.EntityValidator; import com.back.domain.user.entity.User; import com.back.domain.user.repository.UserRepository; import com.back.global.exception.CustomException; @@ -21,8 +17,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; diff --git a/src/main/java/com/back/domain/file/util/EntityValidator.java b/src/main/java/com/back/domain/file/util/EntityValidator.java deleted file mode 100644 index 7167bc1c..00000000 --- a/src/main/java/com/back/domain/file/util/EntityValidator.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.back.domain.file.util; - -import com.back.domain.board.comment.repository.CommentRepository; -import com.back.domain.board.post.repository.PostRepository; -import com.back.domain.file.entity.EntityType; -import com.back.global.exception.CustomException; -import com.back.global.exception.ErrorCode; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -/** - * EntityType, EntityId를 통해 매핑되는 데이터 존재 확인 - */ -@Component -@RequiredArgsConstructor -public class EntityValidator { - private final PostRepository postRepository; - private final CommentRepository commentRepository; - - public void validate(EntityType entityType, Long entityId) { - switch (entityType) { - case POST: - if(!postRepository.existsById(entityId)) throw new CustomException(ErrorCode.POST_NOT_FOUND); - break; - - case COMMENT: - if(!commentRepository.existsById(entityId)) throw new CustomException(ErrorCode.COMMENT_NOT_FOUND); - break; - } - } -}