fix(file-transfer): expand Windows-style tilde policy globs#101698
fix(file-transfer): expand Windows-style tilde policy globs#101698VectorPeak wants to merge 2 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 16, 2026, 7:18 AM ET / 11:18 UTC. Summary PR surface: Source 0, Tests +29. Total +29 across 2 files. Reproducibility: yes. at source level. The current helper demonstrably leaves Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Define Do we have a high-confidence way to reproduce the issue? Yes at source level. The current helper demonstrably leaves Is this the best way to solve the issue? Yes, conditionally. Updating the existing shared normalization helper is the narrowest maintainable fix; only acceptance of the stored-policy interpretation remains unresolved. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d5eebf02e238. Label changesLabel justifications:
Evidence reviewedPR surface: Source 0, Tests +29. Total +29 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (5 earlier review cycles)
|
|
@clawsweeper re-review I added the requested redacted live Windows file-transfer proof to the PR body. Summary of the added proof:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review Re-triggering after rewriting the PR body as UTF-8 without a leading BOM so the proof checker can parse the authored |
9659e19 to
90919ff
Compare
|
@clawsweeper re-review Branch refreshed on latest upstream/main and the PR body now ties the live Windows proof directly to the production
Two current red checks ( |
|
🦞🧹 I asked ClawSweeper to review this item again. |
283ca30 to
c682efe
Compare
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
c682efe to
48ad39f
Compare
|
Closing this for now since it has not received human maintainer/reviewer engagement. Happy to revisit or reopen if maintainers want to take this direction forward. |
What Problem This Solves
Fixes a Windows file-transfer policy edge case where home-relative globs written with Windows path separators, such as
~\Downloads\**, were treated as literal glob text instead of being expanded to the user's home directory.The file-transfer policy already supports home-relative patterns through
~/...and bare~. However, Windows users naturally tend to write local paths with backslashes, and~\...looked like the Windows equivalent of~/...in configuration. Before this change, that form was not recognized byexpandTilde(), so the policy matcher received a pattern that still began with a literal~\prefix.That created two confusing outcomes:
allowReadPathsorallowWritePathsentries such as~\Downloads\**could fail to match files that are actually under the user's home directory.denyPathsentries such as~\Downloads\**\*.pemcould fail to enforce the intended hard-deny rule, because the deny glob never resolved to the real home-directory path.In practice, a Windows operator could configure a policy that appears to allow or deny the correct local folder, while file-transfer policy evaluation behaves differently because only the forward-slash tilde form was expanded.
Why This Change Was Made
This change extends the existing tilde expansion helper to recognize
~\as the Windows-style equivalent of~/.The fix is intentionally small and stays inside the shared policy normalization path.
normalizeGlobs()is already used before matchingallowReadPaths,allowWritePaths, anddenyPaths, so updatingexpandTilde()gives all three policy surfaces the same home-relative behavior without duplicating logic or changing the matcher itself.Existing behavior is preserved for:
~/...home-relative globs~The change only makes a previously unexpanded Windows-style home prefix behave like the already-supported POSIX-style home prefix. This keeps the policy model consistent while avoiding a broader rewrite of path handling or glob evaluation.
User Impact
Windows users can now configure file-transfer policy globs using familiar Windows separators, for example:
and have them resolve against the same home directory target as:
This also makes Windows-style hard-deny rules behave as configured, for example
~\Downloads\**\*.pemnow denies matching files under the user's Downloads directory instead of remaining a non-matching literal pattern.Live Windows Behavior Proof
Redacted live proof was run on Windows against the production file-transfer policy evaluator, not a mock or an isolated helper test. The proof calls
evaluateFilePolicy(), which is the shared policy path used by file-transfer node-invoke checks before file fetch/list/write execution. That path normalizes configured globs throughnormalizeGlobs(), expands home prefixes throughexpandTilde(), and then applies deny-before-allow matching.This proves both requested behaviors from a real Windows run:
~\Downloads\**resolves as a home-relative allow glob and permits a matching non-denied file.~\Downloads\**\*.pemresolves as a home-relative deny glob and still wins over the broader allow rule.Compatibility / Security-Boundary Note
This PR intentionally changes how existing file-transfer policy strings beginning with
~\are interpreted. Before this fix, those entries were effectively literal non-matches; after this fix, they become active home-relative policy globs.That is the intended Windows policy interpretation: a stored config entry such as
~\Downloads\**already expresses operator intent to target the user's Downloads directory. The change does not add a new wildcard class or bypass deny precedence; it only makes the Windows-style home prefix behave like the already-supported~/home prefix.Because this is a file-access policy surface, the PR includes both allow and hard-deny proof. The deny proof demonstrates that broad Windows-style allow rules still remain constrained by
denyPathsafter expansion.Evidence
Live proof command:
Focused validation passed using the repository Vitest runner with hydrated dependencies:
Diff hygiene also passed for the touched files:
The added regression cases cover both directions:
AI-assisted: Yes, prepared with Codex GPT-5.5 xhigh review assistance.