You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add shared path-under-base helper and migrate Path.Combine test usages #452
PR #449 added TestPathUtils.PathUnder(...) and TestPathUtils.RelativePath(...) in Web/ForgeTrust.AppSurface.Docs.Tests to avoid recurring CodeQL feedback where Path.Combine(...) may silently drop earlier arguments when a later segment is rooted.
This follow-up should find the existing test usages that still compose paths with multi-argument Path.Combine(...), decide the right shared home for the helper, and migrate the obvious call sites.
Why
The same review feedback has come back multiple times:
Path.Combine(base, dynamicSegment, child) can reset to dynamicSegment if it is rooted.
Review fixes are easy one-offs, but repeated one-offs make tests inconsistent.
A named helper expresses intent better: “build this known-relative path under this base”.
Suggested Scope
Inventory Path.Combine(...) usage in test projects first.
Promote the docs-test helper into a broader shared test utility if multiple test assemblies need it.
Use the helper for “path under base + relative segments” cases.
Leave legitimate Path.Combine(...) calls alone when they are not susceptible to rooted dynamic segments or when production code intentionally relies on framework semantics.
Add/keep tests that prove rooted relative segments are rejected rather than silently resetting the base.
Starting Point
Current helper: Web/ForgeTrust.AppSurface.Docs.Tests/TestPathUtils.cs
Activity