Skip to content

Commit 94ebd33

Browse files
Oliver B. Fischerwilkinsona
authored andcommitted
Issue a warning from launch script when app will run as root
See gh-10275
1 parent 1204294 commit 94ebd33

File tree

1 file changed

+3
-0
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools

1 file changed

+3
-0
lines changed

spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ log_file="$LOG_FOLDER/$LOG_FILENAME"
128128
# shellcheck disable=SC2012
129129
[[ $(id -u) == "0" ]] && run_user=$(ls -ld "$jarfile" | awk '{print $3}')
130130

131+
# Issue an warning if the application will run as root
132+
[[ $(id -u ${run_user}) == "0" ]] && { echoYellow "Application is running as root (UID 0). This is considered insecure."; }
133+
131134
# Find Java
132135
if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
133136
javaexe="$JAVA_HOME/bin/java"

0 commit comments

Comments
 (0)