test(gdu): constrain the fixture export write to tmp_path - #20
Merged
Merged
Conversation
tzzs
force-pushed
the
test/gdu-fixture-path-containment
branch
from
September 13, 2026 14:34
47706f8 to
10511a6
Compare
fake_run() wrote the simulated gdu export to whatever path showed up in the parsed subprocess args. Resolve it, assert it stays inside the test's own tmp tree, and only then write it -- same fixture behavior, explicit containment.
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.
What changed
test_gdu_backend.py'sfake_run()(the mockedgdusubprocess used by the captured-export regression test) wrote the simulated export to whatever path showed up in the parsed subprocess args:It now resolves the path, asserts it stays inside the test's own
tmp_pathtree, and only then writes via the resolvedPath:Same fixture behavior, explicit containment. Defense-in-depth for a test helper, plus it satisfies repository security scanning that flags unvalidated dynamic paths passed to
open().Split out of #19 (where it originally rode along) so that PR stays a pure performance change.
Test plan
tests/unit/test_gdu_backend.pycollects and passes/skips exactly as on master (the affected test runs on Linux CI where the mocked subprocess path is exercised; on Windows runners it skips, unchanged).