Skip to content

Use shlex.quote for shell argument escaping on POSIX#1198

Open
Asher- wants to merge 3 commits intooraios:mainfrom
Asher-:fix/shell-command-safety
Open

Use shlex.quote for shell argument escaping on POSIX#1198
Asher- wants to merge 3 commits intooraios:mainfrom
Asher-:fix/shell-command-safety

Conversation

@Asher-
Copy link

@Asher- Asher- commented Mar 21, 2026

Problem

quote_arg() only wrapped arguments containing spaces in double quotes. Shell metacharacters ($, backtick, ;, |, &, etc.) were left unescaped. If any path or argument in the LS command list contains these characters, arbitrary shell command execution could occur.

Fix

On POSIX systems, use shlex.quote() which properly handles all special characters via single-quoting. Retain the original Windows behavior since Windows cmd.exe does not interpret single-quoted strings.

Verification

  • Format/type-check clean
  • Re-audited — zero regressions

Asher- and others added 3 commits March 20, 2026 19:07
…kit-lsp

sourcekit-lsp was launched with no arguments, giving it no location to store
its background index. Without --scratch-path, textDocument/references always
returns empty because there is no index store for cross-file symbol resolution.

- Pass --scratch-path <repo>/.build/sourcekit-lsp when launching
- Increase local indexing delay from 5s to 10s (real projects need more time)
- Add retry logic for local runs when references are empty, not just CI

Fixes root cause of issue oraios#876.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On macOS, bare sourcekit-lsp resolves to Command Line Tools version which
has limited indexing capabilities. xcrun without DEVELOPER_DIR also
resolves to CLT. Setting DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
gives the full Xcode sourcekit-lsp with proper background indexing support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
quote_arg only wrapped arguments containing spaces in double quotes,
leaving shell metacharacters ($, backtick, ;, |, &, etc.) unescaped.
On POSIX systems, use shlex.quote() which properly handles all special
characters. Retain the original Windows behavior since Windows cmd.exe
does not interpret single-quoted strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant