-
Notifications
You must be signed in to change notification settings - Fork 24
[q] Fix bash syntax error by escaping parentheses in Copilot shell commands #2493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Check failure
Code scanning / CodeQL
Size computation for allocation may overflow High
Copilot Autofix
AI 17 days ago
The best solution is to introduce a length check in
shellEscapeCommandStringbefore making the allocation forresult. We should defensively check thatlen(escaped)is below a reasonable safe maximum (e.g., 64MB, which is standard for preventing overflow like in the CodeQL example), and fail gracefully if it exceeds that value. The check should return an empty quoted shell string or some visually obvious error string if the length is excessive, or, better, panic with a clear, descriptive error (or perhaps log and return a safe error). Since onlypkg/workflow/shell.gois shown and permitted for editing, these checks must be implemented there.Specifically:
shellEscapeCommandStringinpkg/workflow/shell.goto check thatlen(escaped)is below a threshold (e.g., 6410241024); otherwise, return an error string.constfor the threshold for clarity and future maintainability.