Skip to content

fix: resolve both operands in metadata path-within-root checks - #47

Merged
groove-max merged 2 commits into
groove-max:mainfrom
mikehardy:fix/metadata-path-within-root
Sep 24, 2026
Merged

groove-max merged 2 commits into
groove-max:mainfrom
mikehardy:fix/metadata-path-within-root

Conversation

@mikehardy

Copy link
Copy Markdown
Contributor

Hey @groove-max 👋

I think this is the separate path-within-root fix you were hoping for when you said that change looked good but should not ride along with the short-ASCII work.

Why

_is_within_root was resolving only one side of the comparison, so symlink forms could disagree with the real containment check. This resolves both operands (path and root) via Path.resolve() + is_relative_to, and adds tests for:

  1. Symlink alias acceptance (same file, different path forms)
  2. Symlink escape rejection (in-root link pointing outside the root)

Touched only the three metadata helpers + tests/test_local_metadata.py. No short-ASCII in this PR.

Context

Just getting around to processing your MX3 / PR45 feedback and reshaping the stack into smaller pieces. I'm still qualifying the inverter-side work locally over more days of data collection, so the bigger short-ASCII slices will follow separately rather than landing as one blob.

Base is current main (2a945cc at open). Happy to adjust if you'd rather see this shaped differently.

Test plan

  • python -m unittest tests.test_local_metadata (15 OK)
  • CI green on this PR

Cheers

@groove-max
groove-max merged commit 25563af into groove-max:main Sep 24, 2026
@groove-max

Copy link
Copy Markdown
Owner

Thanks, Mike — I reproduced the error with a symlinked config directory and
verified your fix. I also added tests for draft creation/loading and rejecting
paths outside the metadata root.

Your commits are now included in main, separately from the inverter work in
#45. The fix will be part of the next release.

@mikehardy
mikehardy deleted the fix/metadata-path-within-root branch September 25, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants