Repository navigation
Closed
Labels
Description
What happened
Two security guards have no test that makes them refuse their input. The coverage run of CI at f4d7066 shows the refusal lines as missed, and git grep at b170358 finds no test that names them.
build_subprocess_envrefuses a caller override ofLD_PRELOAD,LD_LIBRARY_PATH,DYLD_INSERT_LIBRARIES,DYLD_LIBRARY_PATH,BASH_ENVandENV, and any key or value with a null byte. No test sends one of these overrides, so a change that removes the check passes the suite.find_repo_filesraisesSecurityErrorfor a target outside the repository root. It also skips a symlinked target file and a candidate that resolves outside the root. No test gives it such a target or candidate.- The second condition at
review/targets.py:83(not target_resolved.is_relative_to(root)) cannot be true, because line 79 already raised for that target.
What should happen
A test makes each guard refuse its input, and checks the error type and the message, or the empty result. The unreachable condition goes.
Evidence
At b170358:
src/devops_cli/core/process.py:182-194: the refused keys and the null-byte check. Lines 192 and 194 were not covered in CI at f4d7066 (.datacoverage data of the 2026-10-24 coverage audit).tests/test_subprocess_env_boundary.py:34-109: the four tests ofbuild_subprocess_envsend no refused key.src/devops_cli/review/targets.py:51-54,:79-80and:82-85: the outside-root error, the resolve check and the symlink skip. Lines 52-54, 80 and 83-85 were not covered.git grep -n "find_repo_files" origin/main -- testsprints nothing.
Acceptance criteria
- A test calls
build_subprocess_env(env=...)with each of the six refused keys, in upper and lower case, and getsSecurityErrorwith the message that names the key. - A test calls
build_subprocess_envwith a null byte in a key and in a value, and getsSecurityError. - A test calls
find_repo_fileswith a target outsiderepo_rootand getsSecurityError. - A test gives
find_repo_filesa symlinked target file and gets[]. A test gives it a directory that holds a symlink to a file outside the root, and the result does not hold that file. - The unreachable second condition at
review/targets.py:83is deleted. - The tests build their trees under
tmp_path, start no program and patch nodevops_cliname (docs/TESTING.md, ADR 0007). - Each new test fails when its guard is removed from
src/. The pull request shows this. -
uv run devops cipasses.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 24, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
The candidate adds new tests for security guards and does not change code behavior.Security guards must refuse unsafe input to prevent vulnerabilities in the tool.Tests ensure security checks work properly and protect against code injection attacks.Writing tests for multiple security guards requires moderate effort but no new code changes.Both items refactor review tools to avoid reading the working directory, but this item adds security tests while that one removes cwd reads.test(security): tests make the subprocess environment guard and the r…