fix: default gorRoot to absolute CWD instead of the literal string "./" - #139
Open
gorfather wants to merge 1 commit into
Open
fix: default gorRoot to absolute CWD instead of the literal string "./"#139gorfather wants to merge 1 commit into
gorfather wants to merge 1 commit into
Conversation
When -gorroot is omitted, GorSessionFactory.updateCommonRoot() (and DriverBackedFileReader's own matching default) fell back to the literal string "./". Resolving a relative path against "./" is a no-op in this codebase's URI-based path resolution (PathUtils.resolve: resolving anything against a relative base just returns it unchanged), so any code path that needed real anchoring against this default silently got an un-anchored relative path back instead. This surfaces concretely in PGOR's dictionary-folder write path: a direct `pgor <sources> | write <target>.gord` (no -gorroot given) fails with a spurious Resource Error on a fabricated version_XXXX.gord name, even though the write's own underlying computation succeeds -- GeneralQueryHandler.getResultsLinkPath's .gord.link bookkeeping resolves the write target against this un-anchored root, produces a bare relative string with no directory information, and something downstream mis-resolves it against the wrong base. Supplying an explicit, absolute -gorroot has always worked around this; the actual bug is that the *default* was never a usable root to begin with. Verified this default is never consulted for access-control decisions: DriverBackedFileReader.validateAccess() is a no-op, and the real enforcement path (DriverBackedSecureFileReader) always sources its project root independently (raw PipeOptions.gorRoot()/ GORMORE_GOR_ROOT/GORMORE_PROJECTS_ROOT, never through updateCommonRoot()) -- so this change only affects path-resolution/ anchoring correctness, not security scoping. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Problem
When
-gorrootis omitted,GorSessionFactory.updateCommonRoot()(andDriverBackedFileReader's own matching default) falls back to the literal string"./". Resolving a relative path against"./"is a no-op in this codebase's URI-based path resolution (PathUtils.resolve: resolving anything against a relative base just returns it unchanged), so any code path that needed real anchoring against this default silently got an un-anchored relative path back instead.This surfaces concretely in PGOR's dictionary-folder write path: a direct
pgor <sources> | write <target>.gord(no-gorrootgiven) fails with a spurious Resource Error on a fabricatedversion_XXXX.gordname, even though the write's own underlying computation succeeds.GeneralQueryHandler.getResultsLinkPath's.gord.linkbookkeeping resolves the write target against this un-anchored root, produces a bare relative string with no directory information, and something downstream mis-resolves it against the wrong base.Repro (no
-gorroot,-cachedironly — the common case for any caller that doesn't explicitly pass a project root):Supplying an explicit, absolute
-gorroothas always worked around this; the actual bug is that the default was never a usable root to begin with.Fix
Default to the process's actual absolute CWD (
Paths.get("").toAbsolutePath()) instead of the literal string"./", in both places this default is computed.Verified
pgor <sources> | write <target>.gordwith only-cachedir(no-gorroot) now succeeds and returns correct data, matching a real caller's actual invocation shape.DriverBackedFileReader.validateAccess()is a no-op, and the real enforcement path (DriverBackedSecureFileReader) always sources its project root independently (rawPipeOptions.gorRoot()/deployment-specific env vars, never throughupdateCommonRoot()) — so this change only affects path-resolution/anchoring correctness, not security scoping.🤖 Generated with Claude Code