-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#51 #70
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
Feat/#51 #70
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,11 @@ | ||
| pluginManagement { | ||
| repositories { | ||
| gradlePluginPortal() | ||
| } | ||
| } | ||
|
|
||
| plugins { | ||
| id("org.gradle.toolchains.foojay-resolver") version "1.0.0" | ||
| } | ||
|
|
||
| rootProject.name = 'CLUE-Backend' |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,10 @@ | ||||||||||||||||||||||||||||||
| package hello.cluebackend.domain.user.presentation; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| import org.springframework.hateoas.EntityModel; | ||||||||||||||||||||||||||||||
| import org.springframework.hateoas.Link; | ||||||||||||||||||||||||||||||
| import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; | ||||||||||||||||||||||||||||||
| import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| import hello.cluebackend.global.config.JWTUtil; | ||||||||||||||||||||||||||||||
| import hello.cluebackend.global.security.jwt.RefreshTokenService; | ||||||||||||||||||||||||||||||
| import jakarta.servlet.http.HttpServletResponse; | ||||||||||||||||||||||||||||||
|
|
@@ -19,11 +24,16 @@ public class TestController { | |||||||||||||||||||||||||||||
| private final JWTUtil jwtUtil; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| @PostMapping("/test") | ||||||||||||||||||||||||||||||
| public ResponseEntity<?> issueToken(@RequestParam UUID userId, @RequestParam String username, @RequestParam String role, HttpServletResponse response) { | ||||||||||||||||||||||||||||||
| public ResponseEntity<EntityModel<String>> issueToken(@RequestParam UUID userId, @RequestParam String username, @RequestParam String role, HttpServletResponse response) { | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chaindev 전용 엔드포인트 보호 실서버 노출을 방지하기 위해 프로파일/플래그로 가드하세요(클래스 레벨 권장). @RestController
@RequiredArgsConstructor
+@org.springframework.context.annotation.Profile("dev")
public class TestController {🏁 Script executed: #!/bin/bash
# Locate TestController.java and display its first 200 lines
fd "TestController.java" -e java -x sed -n '1,200p' {}
echo ""
echo "Existing @Profile annotations in the repo:"
rg -n '@Profile' -n srcLength of output: 1789 🏁 Script executed: #!/bin/bash
# locate application config files
echo "Config files:"
fd -t f -g 'application*.yml' -g 'application*.properties'Length of output: 208 🏁 Script executed: #!/bin/bash
# 프로젝트 루트에서 Spring Boot 설정 파일 검색
find . -type f \( -name "application*.yml" -o -name "application*.properties" \)Length of output: 245 dev 전용 엔드포인트 보호: @Profile("dev") 클래스 레벨 적용 @RestController
@RequiredArgsConstructor
+@org.springframework.context.annotation.Profile("dev")
public class TestController {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| String access = jwtUtil.createJwt("access", userId, username, role, 100 * 60 * 60 * 1000L); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| EntityModel<String> entityModel = EntityModel.of("JWT access token and refresh token issued for dev use."); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Comment on lines
+30
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 응답 메시지가 실제 동작과 불일치(리프레시 토큰 미발급) 현재 access 토큰만 발급합니다. 메시지를 정확히 수정하거나 실제로 refresh 토큰을 발급·쿠키로 설정하세요. (간단 수정안) - EntityModel<String> entityModel = EntityModel.of("JWT access token and refresh token issued for dev use.");
+ EntityModel<String> entityModel = EntityModel.of("JWT access token issued for dev use.");📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||
| Link selfLink = linkTo(TestController.class).slash("test").withSelfRel(); | ||||||||||||||||||||||||||||||
| entityModel.add(selfLink); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| return ResponseEntity.ok() | ||||||||||||||||||||||||||||||
| .header("Authorization", "Bearer " + access) | ||||||||||||||||||||||||||||||
| .body("JWT access token and refresh token issued for dev use."); | ||||||||||||||||||||||||||||||
| .body(entityModel); | ||||||||||||||||||||||||||||||
|
Comment on lines
35
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Authorization 헤더는 캐시 금지 헤더와 함께 반환 토큰이 캐시/프록시에 남지 않도록 - return ResponseEntity.ok()
- .header("Authorization", "Bearer " + access)
- .body(entityModel);
+ return ResponseEntity.ok()
+ .headers(h -> {
+ h.setBearerAuth(access);
+ h.add("Cache-Control", "no-store");
+ h.add("Pragma", "no-cache");
+ })
+ .body(entityModel);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,12 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| spring: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| datasource: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| url: jdbc:postgresql://localhost:5432/testdb | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| username: testuser | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| password: testpass | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| driver-class-name: org.postgresql.Driver | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| jpa: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| hibernate: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ddl-auto: create-drop # 테스트 끝나면 테이블 삭제 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| properties: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| hibernate: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| dialect: org.hibernate.dialect.PostgreSQLDialect | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 테스트 DB를 PostgreSQL로 강제하고 있어 H2 의존성과 충돌 H2를 사용할 계획이면 다음처럼 변경하세요: spring:
datasource:
- url: jdbc:postgresql://localhost:5432/testdb
- username: testuser
- password: testpass
- driver-class-name: org.postgresql.Driver
+ url: jdbc:h2:mem:testdb;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
+ driver-class-name: org.h2.Driver
+ username: sa
+ password:
jpa:
hibernate:
ddl-auto: create-drop # 테스트 끝나면 테이블 삭제
properties:
hibernate:
- dialect: org.hibernate.dialect.PostgreSQLDialect
+ dialect: org.hibernate.dialect.H2DialectPostgreSQL을 유지하려면 build.gradle에서 H2를 제거하고(또는 Testcontainers를 추가) 테스트 인프라에서 로컬 DB 가용성을 보장해야 합니다. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 YAMLlint (1.37.1)[error] 12-12: no new line character at the end of file (new-line-at-end-of-file) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
💡 Verification agent
🧩 Analysis chain
테스트 DB 설정 불일치(H2 추가 vs 테스트 YML은 PostgreSQL 사용)
둘 중 하나로 정리하세요. 아래 두 가지 옵션 중 선택 권장.
옵션 A: PostgreSQL로 일원화(권장: Testcontainers 사용)
옵션 B: H2 인메모리로 일원화
CI/로컬 모두에서 재현성 높은 Testcontainers 사용을 권장합니다.
검증을 위해 아래 스크립트를 실행합니다.
🏁 Script executed:
Length of output: 775
테스트 DB 설정 통일 필요
build.gradle 44행에서 H2를 추가하셨지만, src/test/resources/application.yml은 PostgreSQL을 사용하고 있습니다. 둘 중 하나로 정리하세요:
옵션 A (권장 – Testcontainers 사용)
옵션 B (H2 인메모리 사용 일원화)
CI/로컬 양쪽에서 재현성 높은 Testcontainers 기반 옵션 A를 권장합니다.
📝 Committable suggestion
🤖 Prompt for AI Agents