fix: prompt before executing test/lint commands from repo config (issue #5254)#5365
Open
chrislazar25 wants to merge 1 commit into
Open
fix: prompt before executing test/lint commands from repo config (issue #5254)#5365chrislazar25 wants to merge 1 commit into
chrislazar25 wants to merge 1 commit into
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.
Summary: Fix arbitrary command execution at startup when a repository's
.aider.conf.ymlsetstest-cmdorlint-cmdby prompting the user for confirmation before executing.Technical Details:
default_config_filesincludes the git-repo-root.aider.conf.yml. When that file setstest: true+test-cmd, the command executes at startup withshell=Trueand no confirmation. Attackers can craft a repo that executes arbitrary code the moment aider runs inside the clone.get_repo_config_cmd_files()that scans config files (excluding user's~/.aider.conf.yml) fortest-cmd,lint-cmd,test:,lint:keys. Before executing test/lint, if dangerous keys are found in repo config and--yes-alwayswas not passed, the user is prompted. If declined, execution returns 0.Verification: Confirmed adherence to CONTRIBUTING.md. Ran
python -m pytest tests/. 455 passed, 1 pre-existing env failure (test_voice requires audio hardware). Pre-commit hooks (isort, black, flake8, codespell) all green. Manual E2E:test-cmd→ correctly detected as dangerousecho: trueonly → not flaggedtest-cmd→ excluded from scan--test-cmd→ no prompt (trusted source)Blast Radius:
.aider.conf.ymlcontains test/lint command keys those now require confirmation before executing.--yes-alwaysskips the prompt.Fixes #5254