Skip to content

Fix potential unexpected current directory inclusion in Docker OAP classpath#13844

Merged
wu-sheng merged 1 commit intoapache:masterfrom
weixiang1862:fix/oap-docker-classpath
Apr 23, 2026
Merged

Fix potential unexpected current directory inclusion in Docker OAP classpath#13844
wu-sheng merged 1 commit intoapache:masterfrom
weixiang1862:fix/oap-docker-classpath

Conversation

@weixiang1862
Copy link
Copy Markdown
Member

Fix potential unexpected current directory inclusion in Docker OAP classpath

  • Add a unit test to verify that the fix works.
  • Explain briefly why the bug exists and how to fix it.

Problem

In docker/oap/docker-entrypoint.sh, the classpath is constructed as:

CLASSPATH="config:$CLASSPATH"

When the $CLASSPATH environment variable is unset or empty (which is the common case in container environments), this produces a classpath string ending with a trailing colon:

CLASSPATH="config:"

An empty path element in a colon-separated classpath (e.g., config: or dir1::dir2) is interpreted by the JVM as the current working directory (.).
This means the trailing colon in config: implicitly adds the OAP container's working directory (/skywalking) to the classpath.

Fix

Added a null check before concatenating the existing $CLASSPATH, aligning the Docker startup script with the existing dist-material/bin/ scripts:

if [ -z "$CLASSPATH" ]; then
  CLASSPATH="config"
else
  CLASSPATH="config:$CLASSPATH"
fi
  • If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #.
  • Update the CHANGES log.

@wu-sheng wu-sheng added this to the 10.5.0 milestone Apr 23, 2026
@wu-sheng wu-sheng added docker Docker build scripts or images related chore Chores about the project, like code cleaning up, typos, upgrading dependencies, etc. labels Apr 23, 2026
@wu-sheng wu-sheng merged commit 2319def into apache:master Apr 23, 2026
418 of 425 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Chores about the project, like code cleaning up, typos, upgrading dependencies, etc. docker Docker build scripts or images related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants