fix: remove --exec-script entrypoint to eliminate arbitrary code execution#690
Closed
arne-aignx wants to merge 1 commit into
Closed
fix: remove --exec-script entrypoint to eliminate arbitrary code execution#690arne-aignx wants to merge 1 commit into
arne-aignx wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
|
This entrypoints might give LLMs or attackers the possibility to run arbitrary code in the client
6eb7c2e to
e8f605c
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.

Why
The
--exec-scriptflag insrc/aignostics.pyaccepted arbitrary Python source code as a CLI argument and passed it directly toexec(). This was flagged by SonarCloud as a security risk: any process that can controlsys.argvof the frozen desktop binary — including a compromised LLM agent running inside the app — could escape the process sandbox by injecting arbitrary Python.The flag existed solely so the dataset module could spawn a subprocess that runs IDC download logic inside the PyInstaller-frozen binary (where
python -c "..."is unavailable). The same need can be met withoutexec().How
New worker module (
src/aignostics/dataset/_download_worker.py): a dedicated subprocess entry point that reads its parameters from a JSON temp file and callsIDCClient.download_from_selectiondirectly. No code generation, noexec.Updated caller (
src/aignostics/dataset/_service.py): instead of building a Python script string and passing it via--exec-script, the service now:NamedTemporaryFileas JSON--run-module aignostics.dataset._download_worker <config_file>(frozen) or-m aignostics.dataset._download_worker <config_file>(normal Python)finallyRemoved entrypoint (
src/aignostics.py): the--exec-scriptbranch and itsexec()call are deleted entirely. The existing--run-modulemechanism (which only invokes a module by name, not arbitrary code) is sufficient.The attack surface is now: an attacker controlling
sys.argvcan name a module to run — they can no longer inject arbitrary Python source code.