Issue 1229 fix: Application Insights connection string shell splitting on semicolon#1275
Open
stokpop wants to merge 1 commit into
Open
Conversation
…tring When APPLICATIONINSIGHTS_CONNECTION_STRING contains a semicolon (e.g., InstrumentationKey=...;IngestionEndpoint=...), the start command: eval exec $JAVA_HOME/bin/java $JAVA_OPTS -jar app.jar splits on the semicolon because $JAVA_OPTS is unquoted. Bash treats the semicolon as a command separator, so java runs without -jar, prints usage, and exits 1. Fix: single-quote the connection string value in the opts file: -Dapplicationinsights.connection.string='KEY;Endpoint=...' This is safe because connection strings never contain single quotes. The JVM receives the full value correctly after eval.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
APPLICATIONINSIGHTS_CONNECTION_STRINGcontains a semicolon (e.g.,InstrumentationKey=...;IngestionEndpoint=https://...), the application fails to start.The start command uses:
Because
$JAVA_OPTSis unquoted, bash'sevaltreats the semicolon as a command separator. Java runs without-jar app.jar, prints usage output, and exits 1. The agent starts correctly but the application never launches.Fixes #1229.
Root cause
The
-Dapplicationinsights.connection.string=KEY;Endpoint=...token is split byevalat the;.Fix
Single-quote the connection string value in the opts file:
Single quoting is safe here because Azure connection strings never contain single quotes. The JVM receives the full value correctly after
evalexpands the shell command.Tests
Added/updated 4 tests in
azure_application_insights_agent_test.gocovering: