-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 로그아웃 로직 중복 수정 #115
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
fix: 로그아웃 로직 중복 수정 #115
Changes from all commits
320d799
3dd250b
a261c6b
b3df814
709e1f6
150b439
0eaaa4a
8e92556
3c527fe
e5b0ce1
c9e0921
fa96985
8d8026d
0820ecd
3c50ed7
c602e4f
b04081c
166e9c0
7c046c1
9442721
f0252be
11ba9c2
6023d99
4ceb289
3055b56
32dfe9d
76a153a
e268b25
7e691cf
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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,26 @@ | ||||||||||||||||||
| services: | ||||||||||||||||||
| dev-capturecat-db: | ||||||||||||||||||
| image: postgres | ||||||||||||||||||
| environment: | ||||||||||||||||||
| POSTGRES_DB: capturecat | ||||||||||||||||||
| POSTGRES_USER: capturecat | ||||||||||||||||||
| POSTGRES_PASSWORD: capturecat77 | ||||||||||||||||||
| MYSQL_ROOT_PASSWORD: | ||||||||||||||||||
| MYSQL_DATABASE: | ||||||||||||||||||
| volumes: | ||||||||||||||||||
| - /home/ubuntu/capturecat/database/docker-postgresql/postgresql_data:/var/lib/postgresql/data | ||||||||||||||||||
| ports: | ||||||||||||||||||
| - 5432:5432 | ||||||||||||||||||
| healthcheck: | ||||||||||||||||||
| test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB} -h 127.0.0.1 -p 5432"] | ||||||||||||||||||
| interval: 5s | ||||||||||||||||||
| retries: 10 | ||||||||||||||||||
| dev-capturecat-cache-server: | ||||||||||||||||||
| image: redis | ||||||||||||||||||
| command: ["redis-server", "--requirepass", "capturecat77"] | ||||||||||||||||||
| ports: | ||||||||||||||||||
| - 6379:6379 | ||||||||||||||||||
| healthcheck: | ||||||||||||||||||
| test: [ "CMD", "redis-cli", "ping" ] | ||||||||||||||||||
| interval: 5s | ||||||||||||||||||
| retries: 10 | ||||||||||||||||||
|
Comment on lines
+23
to
+26
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. Redis healthcheck will always fail due to missing auth; authenticate in the check. You’ve enabled requirepass on Redis, but the healthcheck runs Apply this diff to authenticate in the healthcheck (and avoid noisy auth warnings): - healthcheck:
- test: [ "CMD", "redis-cli", "ping" ]
- interval: 5s
- retries: 10
+ healthcheck:
+ test: [ "CMD-SHELL", "redis-cli -a \"$REDIS_PASSWORD\" --no-auth-warning ping" ]
+ interval: 5s
+ retries: 10📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
|
|
||
| import com.capturecat.core.api.user.dto.UserReqDto.LoginReqDto; | ||
| import com.capturecat.core.domain.user.UserRole; | ||
|
|
@@ -32,6 +33,7 @@ | |
| * 소셜 로그인/회원가입이 아닌, | ||
| * 일반 회원가입 후 /login 경로로, id, password로 로그인한 경우 (개발 용도) | ||
| */ | ||
| @Slf4j | ||
|
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 chainLogging enabled: avoid token leakage elsewhere.
Scan for any logging that outputs tokens: 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Find log lines that might include "token" in their message
rg -nP --type=java -C1 'log\.(trace|debug|info|warn|error)\s*\(.*token' capturecat-core || true
# A few more token-specific strings commonly logged
rg -nP --type=java -C1 'Refresh Token:|Blacklist Token:' capturecat-core || trueLength of output: 1681 Critical: Remove all logging of sensitive token values The scan confirms that several log statements are exposing raw token and secret values. These must be removed or masked immediately to prevent security risks: • capturecat-core/src/main/java/com/capturecat/core/service/auth/SocialService.java:162 log.info("Apple /token params: {}", params.get("client_secret")); // exposes client_secret• capturecat-core/src/main/java/com/capturecat/core/service/auth/TokenService.java:75 log.info("Refresh Token: {}", refreshToken); // exposes raw refresh token• capturecat-core/src/main/java/com/capturecat/core/service/auth/TokenService.java:148 log.info("Blacklist Token: {}", accessToken); // exposes raw access tokenThe debug log on line 123 of TokenService (“Deleting refresh token for user {}”) is acceptable, since it only logs the username. All other logs that print token or secret values must be removed or replaced with non-sensitive identifiers (e.g., user IDs, token hashes). Sensitive token values should never appear in any log output. 🤖 Prompt for AI Agents |
||
| @RequiredArgsConstructor | ||
| public class JwtLoginFilter extends UsernamePasswordAuthenticationFilter { | ||
|
|
||
|
|
@@ -64,6 +66,7 @@ protected void successfulAuthentication(HttpServletRequest request, HttpServletR | |
|
|
||
| //토큰 발급 | ||
| Map<TokenType, String> tokenMap = tokenIssueService.issue(username, UserRole.fromRoleString(role)); | ||
| log.info("[JwtLoginFilter.successfulAuthentication] 사용자 로그인({}), 토큰 발급", username); | ||
|
|
||
| //Header에 실어 응답 | ||
| response.setHeader(HttpHeaders.AUTHORIZATION, JwtUtil.BEARER_PREFIX + tokenMap.get(TokenType.ACCESS)); | ||
|
|
||
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.
🛠️ Refactor suggestion
Avoid hardcoding the Redis password in command; pass via env and expand at runtime.
Keeps the password out of the command line and fixes the healthcheck change above (uses $REDIS_PASSWORD).
Apply this diff:
Follow-up (recommended): move the secret to an .env file and reference it, so it isn’t committed:
REDIS_PASSWORD=your-local-only-secretenvironment: { REDIS_PASSWORD: ${REDIS_PASSWORD} }command: ["sh","-c","redis-server --requirepass \"$REDIS_PASSWORD\""]📝 Committable suggestion
🤖 Prompt for AI Agents