Repository navigation
Conversation
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.
Restrict direct
os.execvpassthrough inlean_buildtools/shim.pyto read-only compiler metadata flags and enforceElab.async=falseacross CLI,moreLeanArgs, and--setupoptions.Root cause
lean_buildtools/shim.py::mainpreviously checkedif not any(a.endswith(".lean") for a in args)and calledos.execv(real, [real, *args])before mergingextra_argsor checking unsupported modes (--run,--server,--worker,--stdin). Because--stdin,--server,--worker, and non-.leanscript paths carry no.leansuffix, invoking the shimmedleanbinary in those modes executed the real compiler directly without-j/-Mcaps,--deny-sorry, orchildren.jsonlsupervision.lean_buildtools/process.py::capped_argsprepended-DElab.async=falsewithout stripping caller-DElab.async=true,-Dweak.Elab.async=true, or-D Elab.async=trueflags, andBuildMonitor.monitoronly setElab.async=falseinsidesynchronousDispatchrather than on top-level command scopes whenlakefile.tomlset[leanOptions] Elab.async = truevia--setup.Changes
lean_buildtools/shim.py::main: allow directos.execvonly whenargsis a non-empty subset of read-only metadata flags (METADATA_FLAGS), mergeextra_argsbefore mode checks, and exit with an error if no.leansource path is present.lean_buildtools/process.py::capped_argsandcaps_match: stripElab.asyncandweak.Elab.async-Doverrides (both attached and separated forms) during normalization and reject non-falseoverrides during childargvverification.lean_buildtools/lean/BuildMonitor.lean::monitor: applymodifyScopewithElab.async = falsebeforeelabCommandso--setupmodule options cannot re-enable asynchronous command elaboration while preservingnamespace/sectionscopes.tests/test_supervisor.pyandtests/test_integration.py: add unit and real-compiler Lake integration coverage forshimmode rejection andElab.asyncoverride stripping.Validation
shim --stdinwithdeny_sorry=trueonsorryinput0,0children.jsonlentries1(unsupported compiler mode)lake buildwithmoreLeanArgs = ["-DElab.async=true"]and[leanOptions] Elab.async = trueElab.async = true,caps_verified = trueElab.async = false,caps_verified = truepython3 -m unittest discover -s tests -v(Lean 4.35.0)42/42pass45/45passNativeProof.Smoke+profile-batch Tests/rules.json --deny-sorry