fix(js-sdk): strip quotes from ENV values in fromDockerfile()#1176
Open
fix(js-sdk): strip quotes from ENV values in fromDockerfile()#1176
Conversation
The Dockerfile parser stored ENV values as raw strings without stripping surrounding quotes. This caused ENV GOPATH="/go" to produce "/go" (with literal quote characters) instead of /go. Add a stripQuotes() helper and apply it to all value extraction points in handleEnvInstruction(). Variable expansion is handled by the backend.
|
Contributor
Package ArtifactsBuilt from 32c7d9a. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.14.2-fix-env-quote-stripping.0.tgzCLI ( npm install ./e2b-cli-2.8.1-fix-env-quote-stripping.0.tgzPython SDK ( pip install ./e2b-2.15.1+fix.env.quote.stripping-py3-none-any.whl |
mishushakov
approved these changes
Mar 9, 2026
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.
Summary
fromDockerfile()parsesENVinstructions but stores values as raw strings without stripping quotes. This causesENV GOPATH="/go"to produce"/go"(with literal quote characters) instead of/go.Variable expansion (e.g.
${GOPATH}) is handled by the backend, so the SDK only needs to strip quotes.Changes
stripQuotes()helper — removes surrounding"or'from ENV valuesstripQuotes()to all value extraction points inhandleEnvInstruction()Before/After (tested)
ENV GOPATH="/go"/goENV GOPATH='/go'/goENV GOPATH="/go'"/go'(unchanged)ENV GOPATH=/go/go(unchanged)ENV PATH="/usr/bin:${GOPATH}/bin"/usr/bin:${GOPATH}/binENV A="hello" B="world"hello,worldARG MY_ARG="hello"helloARG MY_ARG""Only
packages/js-sdk/src/template/dockerfileParser.tsis modified (+97/-4 lines).Test plan
ENV GOPATH="/go"+RUN test "$GOPATH" = "/go"— build succeeded, confirming quotes are stripped and backend expands variablesfromDockerfile.test.tstests passpnpm run format,pnpm run lint,pnpm run typecheckall pass