-
Notifications
You must be signed in to change notification settings - Fork 2
[refactor] 사용자 초기주입 및 gateway 권한 role 비교문제 #52
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
base: develop
Are you sure you want to change the base?
Changes from all commits
a9346d5
87c76a6
b712031
a31c446
3c90f2b
5d0e1e5
7de072b
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,8 @@ | ||
| .git | ||
| .gradle | ||
| **/build | ||
| **/target | ||
| node_modules | ||
| .idea | ||
| .vscode | ||
| *.log |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,20 @@ | ||
| POSTGRES_DB= | ||
| POSTGRES_USER= | ||
| POSTGRES_PASSWORD= | ||
|
|
||
| DB_HOST= | ||
| DB_PORT= | ||
| DB_NAME= | ||
| DB_USER= | ||
| DB_PASSWORD= | ||
|
|
||
| KEYCLOAK_REALM= | ||
| KEYCLOAK_REALM_USER= | ||
| KEYCLOAK_ADMIN_USERNAME= | ||
| KEYCLOAK_ADMIN_PASSWORD= | ||
| KEYCLOAK_LOGIN_CLIENT_ID= | ||
| KEYCLOAK_ADMIN_CLIENT_ID= | ||
| KEYCLOAK_DB_PASSWORD= | ||
|
|
||
| RABBITMQ_USERNAME= | ||
| RABBITMQ_PASSWORD= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,8 +58,12 @@ public User(UUID id, String username, String name, String slackId) { | |
| this.name = name; | ||
| this.slackId = slackId; | ||
| this.status = UserStatus.PENDING; | ||
| this.createdAt = LocalDateTime.now(); | ||
|
|
||
| LocalDateTime now = LocalDateTime.now(); | ||
| this.createdAt = now; | ||
| this.createdBy = id; | ||
| this.updatedAt = now; | ||
| this.updatedBy = id; | ||
|
Comment on lines
+61
to
+66
Contributor
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# AuditorAware 구현체 확인
echo "=== AuditorAware 구현 검색 ==="
rg -n "AuditorAware" --type java
# JpaAuditingConfig 상세 확인
echo "=== JpaAuditingConfig 내용 ==="
fd -t f "JpaAuditingConfig.java" --exec cat {}Repository: Ship-Flow/ship-flow Length of output: 3471 🏁 Script executed: #!/bin/bash
# Find BaseEntity in user-service
echo "=== Searching for BaseEntity in user-service ==="
fd -t f "BaseEntity.java" user-service --exec cat {}
# Look at User.java around lines 61-66 with more context
echo "=== User.java constructor context (lines 50-85) ==="
sed -n '50,85p' user-service/src/main/java/com/shipflow/userservice/domain/entity/User.javaRepository: Ship-Flow/ship-flow Length of output: 1138 🏁 Script executed: #!/bin/bash
# Search for BaseEntity across entire repository
echo "=== Searching for BaseEntity class ==="
fd -t f -i "baseentity.java" --exec echo "File: {}" \; --exec cat {} \;
# Read User.java class declaration and field definitions (lines 1-60)
echo "=== User.java class declaration and fields (lines 1-60) ==="
head -60 user-service/src/main/java/com/shipflow/userservice/domain/entity/User.javaRepository: Ship-Flow/ship-flow Length of output: 4444 JPA 감사 자동화와 수동 설정의 충돌 문제
더욱이, 생성자에서의 수동 설정을 제거하고, 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| public User(UUID id, String username, String name, String slackId, UUID hubId, UUID companyId) { | ||
|
|
@@ -68,6 +72,12 @@ public User(UUID id, String username, String name, String slackId, UUID hubId, U | |
| this.companyId = companyId; | ||
| } | ||
|
|
||
| public User(UUID id, String username, String name, String slackId, UserRole role, UserStatus status) { | ||
| this(id, username, name, slackId); | ||
| this.status = status; | ||
| this.role = role; | ||
| } | ||
|
|
||
| public void approve(UserRole role){ //승인 | ||
| if (this.status != UserStatus.PENDING) { | ||
| throw new BusinessException(UserErrorCode.INVALID_USER_STATUS); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.shipflow.userservice.infrastructure.config; | ||
|
|
||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
|
|
||
| @Configuration | ||
| @EnableJpaAuditing | ||
| public class JpaAuditingConfig { | ||
| } |
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.
시크릿을 job 전역
env에 두지 말고 필요한 step 범위로 축소하세요.Line 19-28의 신규 시크릿이 job 전체(step 전부)에 노출됩니다. 외부 액션까지 포함해 노출면이 넓어져 최소 권한 원칙에 어긋납니다.
Build and start servicesstep의env로 이동해 범위를 줄이는 게 안전합니다.권장 수정안 (step 범위로 env 축소)
jobs: docker-compose-test: runs-on: ubuntu-latest timeout-minutes: 30 env: POSTGRES_DB: ${{ secrets.POSTGRES_DB }} POSTGRES_USER: ${{ secrets.POSTGRES_USER }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} RABBITMQ_USERNAME: ${{ secrets.RABBITMQ_USERNAME }} RABBITMQ_PASSWORD: ${{ secrets.RABBITMQ_PASSWORD }} - KEYCLOAK_DB_PASSWORD: ${{ secrets.KEYCLOAK_DB_PASSWORD }} - KEYCLOAK_ADMIN_USERNAME: ${{ secrets.KEYCLOAK_ADMIN_USERNAME }} - KEYCLOAK_ADMIN_PASSWORD: ${{ secrets.KEYCLOAK_ADMIN_PASSWORD }} - KEYCLOAK_REALM: ${{ secrets.KEYCLOAK_REALM }} - KEYCLOAK_REALM_USER: ${{ secrets.KEYCLOAK_REALM_USER }} - KEYCLOAK_ADMIN_CLIENT_ID: ${{ secrets.KEYCLOAK_ADMIN_CLIENT_ID }} - KEYCLOAK_LOGIN_CLIENT_ID: ${{ secrets.KEYCLOAK_LOGIN_CLIENT_ID }} - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} steps: - name: Checkout uses: actions/checkout@v4 @@ - name: Build and start services + env: + KEYCLOAK_DB_PASSWORD: ${{ secrets.KEYCLOAK_DB_PASSWORD }} + KEYCLOAK_ADMIN_USERNAME: ${{ secrets.KEYCLOAK_ADMIN_USERNAME }} + KEYCLOAK_ADMIN_PASSWORD: ${{ secrets.KEYCLOAK_ADMIN_PASSWORD }} + KEYCLOAK_REALM: ${{ secrets.KEYCLOAK_REALM }} + KEYCLOAK_REALM_USER: ${{ secrets.KEYCLOAK_REALM_USER }} + KEYCLOAK_ADMIN_CLIENT_ID: ${{ secrets.KEYCLOAK_ADMIN_CLIENT_ID }} + KEYCLOAK_LOGIN_CLIENT_ID: ${{ secrets.KEYCLOAK_LOGIN_CLIENT_ID }} + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} run: docker compose up -d --build --wait --wait-timeout 500 timeout-minutes: 25🤖 Prompt for AI Agents