fix(compilers): sandbox native solc cwd to stop import path leaks - #2920
Open
0xoasis wants to merge 1 commit into
Open
fix(compilers): sandbox native solc cwd to stop import path leaks#29200xoasis wants to merge 1 commit into
0xoasis wants to merge 1 commit into
Conversation
0xoasis
force-pushed
the
solc-sandbox-cwd-import-leak
branch
from
August 6, 2026 10:33
989abb4 to
2615557
Compare
0xoasis
added a commit
to 0xoasis/sourcify
that referenced
this pull request
Aug 6, 2026
Add a useVyperCompiler smoke test that runs under the temp cwd sandbox and asserts sourcify-vyper-* dirs are cleaned up. Existing vyper suite still passes with the sandbox enabled.
Native solc --standard-json (notably >=0.8.8) resolves missing imports against process cwd (allowed base path "."). User contracts can import relative host files (e.g. ./.env, package.json); ParserError.formattedMessage then echoes file contents through compiler_error API responses. Run native solc in an empty temp directory and clean it up after compilation. Resolve the solc binary path before changing cwd. Vyper is unchanged: probes show standard-json does not load missing imports from cwd the same way.
0xoasis
force-pushed
the
solc-sandbox-cwd-import-leak
branch
from
August 6, 2026 12:07
aad3920 to
dba4d41
Compare
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
Native
solc --standard-jsonstill resolves missing imports against the process cwd (allowed base path"."). From solc 0.8.8 onward, a user-supplied contract canimportrelative host files (e.g../.env,package.json);ParserError.formattedMessagethen echoes file contents throughcompiler_errorAPI responses.solc <= 0.8.7rejects the same imports as outside allowed directories (no content leak)>= 0.4.10, so this path is reachable in normal verificationFix
solcRepostill worksOut of scope
Vyper is not changed. Probing
vyper --standard-json(0.3.7 / 0.3.10 / 0.4.0) with HOST cwd bait files vs empty cwd showed:ModuleNotFound/ cannot locate interface)Validation