Fix/remove validate path false - #91
Merged
Merged
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.
Description
Replace the
validate_path=Falsebypass inBaseService._export_result()with an explicitallowed_baseparameter.The previous implementation allowed callers to skip path validation entirely when they had previously validated the path against a different security boundary. This was used by
ConfigService, which validates configuration exports againstget_config_base_dir()rather than the normal export directory.This change preserves that distinction while making validation mandatory:
allowed_base=Nonepreserves the existing export-base behavior.allowed_base.resolve_and_validate_path()is now always executed before the filesystem is accessed.ConfigServicepasses its already-selected configuration base explicitly instead of disabling validation.Additional regression tests verify:
validate_path=Falseis no longer accepted.allowed_baseis actually used.ConfigServicecan export within its configuration directory while remaining outside the normal export sandbox.The purpose of this PR is also to verify the resulting CodeQL analysis. No CodeQL suppressions, custom models, or exporter-level security changes are introduced in this PR.
Related Issue
Fixes # (issue number)
Type of Change
Testing
Local validation completed:
pytest -m "not integration"— 1413 passed, 2 skipped, 80 deselectedruff check .— passedruff format --check .— passedpyright— 0 errors, 0 warnings, 0 informationsgit diff --check— passedLocal tests were executed on Python 3.12.
CodeQL is expected to run through GitHub Actions. The result will be used to determine whether the existing CodeQL findings are correctly resolved by the service-layer change or whether additional CodeQL modeling is required.