Skip to content

Refactor: application.yml 설정 수정, Spring Security 설정 - #14

Merged
LimJinKeon merged 5 commits into
devfrom
refactor/queue
May 11, 2026
Merged

Refactor: application.yml 설정 수정, Spring Security 설정#14
LimJinKeon merged 5 commits into
devfrom
refactor/queue

Conversation

@LimJinKeon

@LimJinKeon LimJinKeon commented May 6, 2026

Copy link
Copy Markdown
Collaborator

📎 관련 이슈

  • close #

📌 작업 내용

  • application.yml 설정 수정
  • Spring Security 설정
  • Dockerfile 수정
  • .gitignore 수정

✨ 변경 사항

  • 주요 변경 내용 정리

📝 리뷰 포인트 (선택)

  • 집중해서 봐줬으면 하는 부분

🧠 기타 참고 사항

(참고 문서, 스크린샷 등)

Summary by CodeRabbit

  • Chores

    • Introduced a stateless security filter chain (CSRF/form-login/HTTP Basic disabled; requests permitted).
    • Added comprehensive Kafka consumer and JSON handling settings.
    • Enabled distributed tracing with sampling controls and management tracing/metrics.
    • Minor .gitignore additions.
  • Operations

    • Made Docker/runtime settings environment-driven and tuned server thread/connection limits.
    • Switched container logging to JSON and updated containerized build to use Gradle base image.

@LimJinKeon LimJinKeon self-assigned this May 6, 2026
@LimJinKeon LimJinKeon added the enhancement New feature or request label May 6, 2026
@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 901b99d6-e6bd-4df8-bd85-02ad7cec866b

📥 Commits

Reviewing files that changed from the base of the PR and between 7e64def and 386cec8.

📒 Files selected for processing (1)
  • src/main/resources/application-docker.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/resources/application-docker.yml

📝 Walkthrough

Walkthrough

Adds a Spring Security config that permits all requests (stateless) and disables CSRF/form-login/HTTP Basic. Updates runtime and build configuration: Kafka, Redis, Tomcat, tracing/Zipkin, JSON logging, Docker build image, and .gitignore.

Changes

Queue service runtime & security

Layer / File(s) Summary
Security Implementation
src/main/java/org/ticketing/queue/infrastructure/config/QueueSecurityConfig.java
New QueueSecurityConfig class exposing SecurityFilterChain queueFilterChain(HttpSecurity); disables CSRF, form login, HTTP Basic; sets session policy to STATELESS; permits all requests.
Config Server import
src/main/resources/application.yml
Replaced environment-backed config-server import with fixed http://localhost:10002.
Kafka & consumer shape
src/main/resources/application.yml
Added kafka block: bootstrap-servers, consumer.group-id, auto-offset-reset, deserializers, JSON deserializer delegate and trusted-packages/value type settings.
Management tracing flags
src/main/resources/application.yml
Added management.tracing.enabled, management.tracing.sampling.probability, and management.zipkin.tracing.export.enabled.
Docker / env-driven runtime
src/main/resources/application-docker.yml
Added server.tomcat tuning; parameterized Redis host/port; switched datasource schema to ${DB_SCHEMA:queue}; made Kafka bootstrap env-driven; adjusted tracing sampling; added queue.token.secret.
Logging format
src/main/resources/logback.xml
Added CONSOLE_JSON LogstashEncoder appender and switched Docker profile to use JSON appender.
Build image / Dockerfile
Dockerfile
Build stage now uses gradle:8.12-jdk17, copies Gradle files directly and runs gradle to produce the JAR; runtime stage artifact copy updated; entrypoint unchanged.
Repository ignores
.gitignore
Added ignore rules for out and .vscode.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through configs, soft and spry,
Stateless sessions waving hi,
Kafka crumbs hum down the track,
JSON logs glowing on the stack,
Gradle builds packed in my sack.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title addresses application.yml configuration modifications and Spring Security setup, which are primary changes in this PR, making it relevant and specific to the main objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/queue

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/main/java/org/ticketing/queue/infrastructure/config/QueueSecurityConfig.java`:
- Around line 11-29: The QueueSecurityConfig class currently exposes a
permissive SecurityFilterChain (securityMatcher("/**"),
anyRequest().permitAll()) in all environments; restrict it to tests by adding
the Spring profile annotation to the class (e.g., annotate QueueSecurityConfig
with `@Profile`("test")) or remove the entire class if it's no longer needed;
update imports to include org.springframework.context.annotation.Profile and
ensure the bean remains only active under the intended profile so production
authentication is not bypassed.

In `@src/main/resources/application.yml`:
- Line 6: Replace the hardcoded Config Server URI in the import declaration so
deployments can override it at runtime: update the line that currently reads
"import: optional:configserver:http://localhost:10002" to reference an
environment/property placeholder (e.g. use ${CONFIGSERVER_URI} or a Spring
property) and keep the same "import: optional:configserver:" prefix so the
effective URL is resolved from CONFIGSERVER_URI (with a sensible default if
desired) instead of being fixed to localhost.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9d5bce66-4dae-4eb7-89f6-12f749eac952

📥 Commits

Reviewing files that changed from the base of the PR and between b811ae4 and f1c14fc.

📒 Files selected for processing (2)
  • src/main/java/org/ticketing/queue/infrastructure/config/QueueSecurityConfig.java
  • src/main/resources/application.yml

Comment on lines +11 to +29
@Configuration
public class QueueSecurityConfig {

// MVP 통합 테스트용 임시 SecurityConfig
@Bean
@Order(1)
public SecurityFilterChain queueFilterChain(HttpSecurity http) throws Exception {
return http
.securityMatcher("/**")
.csrf(AbstractHttpConfigurer::disable)
.formLogin(AbstractHttpConfigurer::disable)
.httpBasic(AbstractHttpConfigurer::disable)
.sessionManagement(session ->
session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
)
.authorizeHttpRequests(auth -> auth
.anyRequest().permitAll()
)
.build();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether permissive chain is profile-gated and whether other security chains/method-security exist.
rg -n --type=java '@Profile\(|@EnableMethodSecurity|@EnableWebSecurity|SecurityFilterChain|@Order\(' src/main/java
rg -n --type=java 'securityMatcher\("/\*\*"\)|anyRequest\(\)\.permitAll\(' src/main/java

Repository: 3s-ticketing/queue-service

Length of output: 740


🏁 Script executed:

# Check the full QueueSecurityConfig file
cat -n src/main/java/org/ticketing/queue/infrastructure/config/QueueSecurityConfig.java

Repository: 3s-ticketing/queue-service

Length of output: 1547


🏁 Script executed:

# Search for all SecurityFilterChain beans in the project to understand the overall security setup
rg -n --type=java 'public SecurityFilterChain' src/main/java

Repository: 3s-ticketing/queue-service

Length of output: 240


🏁 Script executed:

# Check if there are any Spring application properties or YAML configs that gate profiles
fd -e properties -e yml -e yaml src/main/resources | head -20

Repository: 3s-ticketing/queue-service

Length of output: 448


🏁 Script executed:

# Search for any conditional annotations or profile-based configurations
rg -n --type=java '@ConditionalOnProperty|@ConditionalOnProfile|@Profile|spring\.config\.activate' src/main/java

Repository: 3s-ticketing/queue-service

Length of output: 52


🏁 Script executed:

# Correct fd syntax to find properties files
fd . 'src/main/resources' -e properties -e yml -e yaml

Repository: 3s-ticketing/queue-service

Length of output: 147


🏁 Script executed:

# Search for any profile or conditional properties in config files
find src/main/resources -type f \( -name "*.properties" -o -name "*.yml" -o -name "*.yaml" \) 2>/dev/null | xargs grep -l "spring.config.activate\|spring.profiles" 2>/dev/null || echo "No profile config files found"

Repository: 3s-ticketing/queue-service

Length of output: 100


🏁 Script executed:

# Also check if there are any other Java config classes that might conditionally disable/replace this config
rg -n --type=java 'QueueSecurityConfig|@ConditionalOnMissingBean|@Primary' src/main/java

Repository: 3s-ticketing/queue-service

Length of output: 189


Gate this permissive filter chain to test environments only; it currently allows unauthenticated access in all environments.

The QueueSecurityConfig class lacks a @Profile annotation despite the comment indicating it is temporary for MVP integration tests. With @Order(1), securityMatcher("/**"), and anyRequest().permitAll(), this is the only SecurityFilterChain bean in the codebase and will be active in production, effectively disabling authentication globally.

Add @Profile("test") to the class to restrict it to test environments, or remove it entirely if no longer needed.

Suggested patch direction
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
 ...
 `@Configuration`
+@Profile("test")
 public class QueueSecurityConfig {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/org/ticketing/queue/infrastructure/config/QueueSecurityConfig.java`
around lines 11 - 29, The QueueSecurityConfig class currently exposes a
permissive SecurityFilterChain (securityMatcher("/**"),
anyRequest().permitAll()) in all environments; restrict it to tests by adding
the Spring profile annotation to the class (e.g., annotate QueueSecurityConfig
with `@Profile`("test")) or remove the entire class if it's no longer needed;
update imports to include org.springframework.context.annotation.Profile and
ensure the bean remains only active under the intended profile so production
authentication is not bypassed.


config:
import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:10002}
import: optional:configserver:http://localhost:10002

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid hardcoded Config Server endpoint in shared config.

Line 6 pins the Config Server to http://localhost:10002, which will fail in non-local environments and removes deployment-time override flexibility.

Suggested patch
-    import: optional:configserver:http://localhost:10002
+    import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:10002}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import: optional:configserver:http://localhost:10002
import: optional:configserver:${CONFIG_SERVER_URL:http://localhost:10002}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/resources/application.yml` at line 6, Replace the hardcoded Config
Server URI in the import declaration so deployments can override it at runtime:
update the line that currently reads "import:
optional:configserver:http://localhost:10002" to reference an
environment/property placeholder (e.g. use ${CONFIGSERVER_URI} or a Spring
property) and keep the same "import: optional:configserver:" prefix so the
effective URL is resolved from CONFIGSERVER_URI (with a sensible default if
desired) instead of being fixed to localhost.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/resources/application-docker.yml`:
- Line 42: The docker profile currently requires the
SPRING_KAFKA_BOOTSTRAP_SERVERS env var unconditionally which can cause
unresolved-placeholder startup failures; update the bootstrap-servers property
to provide a safe default using Spring’s property placeholder syntax (e.g.,
change bootstrap-servers: ${SPRING_KAFKA_BOOTSTRAP_SERVERS} to use a fallback
like ${SPRING_KAFKA_BOOTSTRAP_SERVERS:localhost:9092}) so the app can start when
the env var is missing; update the single property key bootstrap-servers
accordingly.

In `@src/main/resources/logback.xml`:
- Around line 49-61: The logging configuration file uses Spring Boot–specific
features like <springProfile> and converters (e.g., ColorConverter,
WhitespaceThrowableProxyConverter) so rename the resource file from logback.xml
to logback-spring.xml so Spring Boot will process these extensions and honor
profiles (e.g., the "docker" <springProfile> and the default/local profile)
without changing the file contents; after renaming, rebuild to verify the docker
profile activates and the JSON CONSOLE_JSON appender is used in that profile.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 19dc064c-0adf-4f05-b505-9ac320750815

📥 Commits

Reviewing files that changed from the base of the PR and between f1c14fc and d2d7199.

📒 Files selected for processing (2)
  • src/main/resources/application-docker.yml
  • src/main/resources/logback.xml


kafka:
bootstrap-servers: kafka:9092
bootstrap-servers: ${SPRING_KAFKA_BOOTSTRAP_SERVERS}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add a safe default for Kafka bootstrap servers to avoid unresolved-placeholder startup failure.

Line 42 currently requires SPRING_KAFKA_BOOTSTRAP_SERVERS unconditionally. If it’s missing, the docker profile can fail at startup before the app is usable.

🔧 Proposed fix
-    bootstrap-servers: ${SPRING_KAFKA_BOOTSTRAP_SERVERS}
+    bootstrap-servers: ${SPRING_KAFKA_BOOTSTRAP_SERVERS:ticketing-kafka:9092}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/resources/application-docker.yml` at line 42, The docker profile
currently requires the SPRING_KAFKA_BOOTSTRAP_SERVERS env var unconditionally
which can cause unresolved-placeholder startup failures; update the
bootstrap-servers property to provide a safe default using Spring’s property
placeholder syntax (e.g., change bootstrap-servers:
${SPRING_KAFKA_BOOTSTRAP_SERVERS} to use a fallback like
${SPRING_KAFKA_BOOTSTRAP_SERVERS:localhost:9092}) so the app can start when the
env var is missing; update the single property key bootstrap-servers
accordingly.

Comment on lines +49 to +61
<!-- 로컬: 텍스트, Docker: JSON -->
<springProfile name="default, local">
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
</springProfile>

<springProfile name="docker">
<root level="INFO">
<appender-ref ref="CONSOLE_JSON"/>
</root>
</springProfile>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify current logging config wiring and whether both logback variants exist
fd -i 'logback*.xml' src/main/resources
rg -n -C3 'logging\.config|springProfile|logback-spring\.xml|logback\.xml' src/main/resources

Repository: 3s-ticketing/queue-service

Length of output: 1084


🏁 Script executed:

#!/bin/bash
# Check if this is a Spring Boot project and verify dependencies
echo "=== Looking for Spring Boot dependencies ==="
find . -name "pom.xml" -o -name "build.gradle" | head -5

# Check pom.xml if it exists
if [ -f "pom.xml" ]; then
  echo -e "\n=== Spring Boot dependency in pom.xml ==="
  rg -i 'spring-boot' pom.xml | head -10
fi

# Check for application configuration files
echo -e "\n=== Application config files ==="
fd -i 'application.*\.(properties|yml|yaml)' src/

# Check if logging.config is specified anywhere
echo -e "\n=== Custom logging config references ==="
rg -i 'logging\.config' . --type properties --type yaml 2>/dev/null | head -10

Repository: 3s-ticketing/queue-service

Length of output: 318


🏁 Script executed:

#!/bin/bash
# Verify Spring Boot's behavior with logback.xml vs logback-spring.xml
# by checking Spring Boot documentation references in code or comments
echo "=== Checking for any Spring Boot version info ==="
if [ -f "pom.xml" ]; then
  rg -A2 'spring-boot-starter-parent|spring.boot.version' pom.xml
fi

# Check if there are any bootstrap or configuration files
echo -e "\n=== Bootstrap/Configuration setup ==="
find . -name "bootstrap*" -o -name "application-*" | grep -E '\.(properties|yml|yaml)$' | head -20

Repository: 3s-ticketing/queue-service

Length of output: 203


🏁 Script executed:

#!/bin/bash
# Check Spring Boot version in build.gradle
echo "=== Spring Boot version ==="
rg -i 'spring.boot|springboot' build.gradle -A2 -B2

# Check what profiles are defined
echo -e "\n=== Active profiles in application.yml ==="
rg -i 'profiles|spring:' src/main/resources/application.yml -A5 -B2

echo -e "\n=== Application docker profile ==="
cat src/main/resources/application-docker.yml

Repository: 3s-ticketing/queue-service

Length of output: 2457


🏁 Script executed:

#!/bin/bash
# Check if the current logback.xml is actually being processed with springProfile
echo "=== Full logback.xml content ==="
cat src/main/resources/logback.xml

# Check for any test that might verify logging behavior
echo -e "\n=== Looking for log configuration tests ==="
find . -path '*/test/*' -name '*Log*' -o -path '*/test/*' -name '*Appender*' | head -10

Repository: 3s-ticketing/queue-service

Length of output: 2498


Rename logback.xml to logback-spring.xml to enable <springProfile> processing.

The <springProfile> elements (lines 50 and 57) and Spring Boot–specific converters (ColorConverter, WhitespaceThrowableProxyConverter) are Spring Boot Logback extensions that require the file to be named logback-spring.xml. When named logback.xml, Spring Boot treats it as standard Logback and ignores these extensions. This silently breaks the profile-aware logging configuration: the docker profile will never activate, and both text and JSON appenders will be treated as standard elements.

Fix

Rename the file from src/main/resources/logback.xml to src/main/resources/logback-spring.xml. No content changes needed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/resources/logback.xml` around lines 49 - 61, The logging
configuration file uses Spring Boot–specific features like <springProfile> and
converters (e.g., ColorConverter, WhitespaceThrowableProxyConverter) so rename
the resource file from logback.xml to logback-spring.xml so Spring Boot will
process these extensions and honor profiles (e.g., the "docker" <springProfile>
and the default/local profile) without changing the file contents; after
renaming, rebuild to verify the docker profile activates and the JSON
CONSOLE_JSON appender is used in that profile.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile`:
- Around line 17-23: The final image runs as root because there is no USER
instruction; create a non-root user and switch to it before the ENTRYPOINT. In
the Dockerfile (around WORKDIR /app, COPY of app.jar, and ENTRYPOINT), add
commands to create a dedicated user/group (e.g., uid/gid 1000), chown the /app
directory and app.jar to that user, set a sane HOME, and add a USER instruction
to switch to that user so the jar (app.jar) runs without root privileges.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 69096148-a956-4984-9f06-61414389cea6

📥 Commits

Reviewing files that changed from the base of the PR and between d2d7199 and 7e64def.

📒 Files selected for processing (2)
  • .gitignore
  • Dockerfile
✅ Files skipped from review due to trivial changes (1)
  • .gitignore

Comment thread Dockerfile
Comment on lines 17 to 23
FROM eclipse-temurin:17-jre

WORKDIR /app

COPY --from=build /app/build/libs/*.jar app.jar

ENTRYPOINT ["java", "-jar", "app.jar"] No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify Dockerfiles that do not set a non-root USER
fd -i 'Dockerfile' -t f | while read -r f; do
  echo "== $f =="
  rg -n '^\s*USER\b' "$f" || echo "No USER instruction found"
done

Repository: 3s-ticketing/queue-service

Length of output: 113


🏁 Script executed:

cat -n Dockerfile

Repository: 3s-ticketing/queue-service

Length of output: 684


Run the runtime container as a non-root user.

Lines 17–23 define the final image but lack a USER instruction, causing the app to run as root. This weakens container isolation and violates security best practices.

Proposed fix
 FROM eclipse-temurin:17-jre

 WORKDIR /app
-
-COPY --from=build /app/build/libs/*.jar app.jar
+RUN useradd --system --create-home --uid 10001 appuser
+COPY --from=build /app/build/libs/*.jar /app/app.jar
+RUN chown -R appuser:appuser /app
+USER appuser

 ENTRYPOINT ["java", "-jar", "app.jar"]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
FROM eclipse-temurin:17-jre
WORKDIR /app
COPY --from=build /app/build/libs/*.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]
FROM eclipse-temurin:17-jre
WORKDIR /app
RUN useradd --system --create-home --uid 10001 appuser
COPY --from=build /app/build/libs/*.jar /app/app.jar
RUN chown -R appuser:appuser /app
USER appuser
ENTRYPOINT ["java", "-jar", "app.jar"]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` around lines 17 - 23, The final image runs as root because there
is no USER instruction; create a non-root user and switch to it before the
ENTRYPOINT. In the Dockerfile (around WORKDIR /app, COPY of app.jar, and
ENTRYPOINT), add commands to create a dedicated user/group (e.g., uid/gid 1000),
chown the /app directory and app.jar to that user, set a sane HOME, and add a
USER instruction to switch to that user so the jar (app.jar) runs without root
privileges.

@JungahGoak JungahGoak left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다👍

@LimJinKeon
LimJinKeon merged commit ccfc504 into dev May 11, 2026
2 checks passed
@LimJinKeon
LimJinKeon deleted the refactor/queue branch May 11, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants