Harden CLI-Hub preview compatibility and installs#299
Harden CLI-Hub preview compatibility and installs#299dragonnite1221-lgtm wants to merge 3 commits into
Conversation
|
The trust-boundary framing is correct, but a couple of items before this lands:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86c19c129f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if quote: | ||
| if ch == quote: | ||
| quote = None | ||
| elif quote == '"' and (ch == "`" or (ch == "$" and i + 1 < len(cmd) and cmd[i + 1] == "(")): | ||
| return True | ||
| i += 1 | ||
| continue |
There was a problem hiding this comment.
Block shell syntax hidden behind sh -c
For install commands that invoke a shell explicitly, e.g. sh -c 'curl -s https://example/cli | bash' or bash -c 'echo ok; rm -rf /tmp/x', this quote branch treats the operator-containing payload as a literal argument, so _run_command runs it with shell=False instead of returning the new block. shlex.split then strips the quotes and the invoked shell executes the pipe/semicolon anyway, allowing registry entries without requires_shell to bypass the hardening this commit adds.
Useful? React with 👍 / 👎.
86c19c1 to
edadb6c
Compare
Summary
<script>blocks to avoid HTML/script breakoutsexcept:handlers in the touched unimol harness codeRoot cause
cli-hub/cli_hub/preview.pyused a Python 3.12-only f-string expression form even though the project supports Python 3.10+. The same preview surface also embedded artifact URLs and JSON data with too little validation/escaping.Validation
PYTHONDONTWRITEBYTECODE=1 python3.11 -m py_compile cli-hub/cli_hub/preview.py cli-hub/tests/test_cli_hub.py unimol_tools/agent-harness/cli_anything/unimol_tools/utils/weights.py unimol_tools/agent-harness/cli_anything/unimol_tools/tests/test_full_e2e.pyPYTHONDONTWRITEBYTECODE=1 python3 -m pytest -q cli-hub/tests/test_cli_hub.py(106 passed)git diff --check upstream/main...HEADgitleaks protect --staged --redact --no-bannerFull
gitleaks detectstill reports existing findings in files outside this PR's changed set (cc-switch, generated docs,cli-hub/analytics.py,n8n,zotero). None overlap this diff.