Policy: resolve cache paths inside Windows AppContainer #310

Open
melon0918 wants to merge 1 commit from upstream-pr/310 into main
melon0918 commented 2026-11-24 02:13:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by melon0918 on 2026-11-24T02:13:46Z.


What changed

A Windows AppContainer can read, write and enumerate its cache directory while the DOS-volume lookup used by std::fs::canonicalize fails with access denied. In that configuration VIctory exits while checking the cache path, before it can map the title.

When DOS path resolution hits a permission error, retry using the normalized native volume path returned by the open file handle. The fallback checks both paths in the same namespace and still checks the resolved ancestors for .victory-root.

Verification

  • Windows 10 22H2 (19045), rustc 1.98.1. A standalone probe reproduced the access denied from GetFinalPathNameByHandleW with the DOS volume flag and confirmed that the normalized native name was available.
  • In the same zero-network-capability AppContainer, the unpatched build failed before mapping. The patched build completed image mapping and import binding with zero missing imports. Adding a synthetic .victory-root marker to the cache parent still caused the expected rejection.
  • cargo test --locked -p victory-core (9 tests), cargo fmt -p victory-core --check and cargo xtask policy passed. On the unmodified base the workspace test run hit the known WinHTTP export failure and seven graphics tests failed on this host.

This patch is independent of the Agility SDK changes in #175. AI-assisted (Codex).

<!-- greyfinch-sync:Marvisak/VIctory:issue:6573056111 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/310). Originally posted by [melon0918](https://github.com/melon0918) on 2026-11-24T02:13:46Z. --- ### What changed A Windows AppContainer can read, write and enumerate its cache directory while the DOS-volume lookup used by `std::fs::canonicalize` fails with access denied. In that configuration VIctory exits while checking the cache path, before it can map the title. When DOS path resolution hits a permission error, retry using the normalized native volume path returned by the open file handle. The fallback checks both paths in the same namespace and still checks the resolved ancestors for `.victory-root`. ### Verification - Windows 10 22H2 (19045), rustc 1.98.1. A standalone probe reproduced the access denied from `GetFinalPathNameByHandleW` with the DOS volume flag and confirmed that the normalized native name was available. - In the same zero-network-capability AppContainer, the unpatched build failed before mapping. The patched build completed image mapping and import binding with zero missing imports. Adding a synthetic `.victory-root` marker to the cache parent still caused the expected rejection. - `cargo test --locked -p victory-core` (9 tests), `cargo fmt -p victory-core --check` and `cargo xtask policy` passed. On the unmodified base the workspace test run hit the known WinHTTP export failure and seven graphics tests failed on this host. This patch is independent of the Agility SDK changes in #175. AI-assisted (Codex).
jeremygold02 commented 2026-11-24 06:55:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T04:18:55Z.


Tested PR #310 at head 1ea6427f05078f9771d724ba180c8a826c9bf009 (state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at 1ea6427f05078f9771d724ba180c8a826c9bf009.

  • cargo test --locked -p victory-core native_paths_still_check_repository_markers — passed (ok. 1 passed; 0 failed; 0 ignored; 0 measured; 8 filtered out; finished in 0.00s ); cases: policy::tests::native_paths_still_check_repository_markers.

Behavior covered: Checks native cache paths still enforce repository markers after Windows AppContainer path resolution.
Code: crates/victory-core/src/policy.rs

<!-- greyfinch-sync:Marvisak/VIctory:comment:7121905022 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/310#issuecomment-7121905022). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T04:18:55Z. --- Tested PR #310 at head `1ea6427f05078f9771d724ba180c8a826c9bf009` (state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at `1ea6427f05078f9771d724ba180c8a826c9bf009`. - `cargo test --locked -p victory-core native_paths_still_check_repository_markers` — passed (ok. 1 passed; 0 failed; 0 ignored; 0 measured; 8 filtered out; finished in 0.00s ); cases: policy::tests::native_paths_still_check_repository_markers. Behavior covered: Checks native cache paths still enforce repository markers after Windows AppContainer path resolution. Code: [crates/victory-core/src/policy.rs](https://github.com/Marvisak/VIctory/blob/1ea6427f05078f9771d724ba180c8a826c9bf009/crates/victory-core/src/policy.rs)
mercuryVM commented 2026-11-24 10:11:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T10:11:37Z.

Review: APPROVED


Tested 1ea6427 on Windows 11, RTX 5070, MSVC: cargo test -p victory-core 9 passed, including native_paths_still_check_repository_markers. cargo clippy -p victory-core --all-targets is clean. Not run inside an AppContainer here.

  • Dependency check: windows-sys is already a workspace dependency, and this only adds the Win32_Storage_FileSystem feature under cfg(windows). Nothing new comes into Cargo.lock apart from the edge.
  • The fallback stays safe: the workspace root and the target are both resolved through canonicalize_native, so starts_with compares \?\GLOBALROOT\Device\... against the same form. The ancestor walk for .victory-root still runs on the resolved path.
  • Behaviour change to be aware of: on Windows, resolve now stops at the first PermissionDenied instead of moving up to the parent. A path that exists but cannot be canonicalized now goes through the native retry, where it used to be resolved from its parent. access_mode(0) with backup semantics opens almost anything, so I don't expect regressions, but if the native open also fails the error now surfaces instead of the old fallback.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6037311775 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/310#pullrequestreview-6037311775). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T10:11:37Z. **Review:** APPROVED --- Tested 1ea6427 on Windows 11, RTX 5070, MSVC: `cargo test -p victory-core` 9 passed, including `native_paths_still_check_repository_markers`. `cargo clippy -p victory-core --all-targets` is clean. Not run inside an AppContainer here. - Dependency check: `windows-sys` is already a workspace dependency, and this only adds the `Win32_Storage_FileSystem` feature under `cfg(windows)`. Nothing new comes into `Cargo.lock` apart from the edge. - The fallback stays safe: the workspace root and the target are both resolved through `canonicalize_native`, so `starts_with` compares `\?\GLOBALROOT\Device\...` against the same form. The ancestor walk for `.victory-root` still runs on the resolved path. - Behaviour change to be aware of: on Windows, `resolve` now stops at the first `PermissionDenied` instead of moving up to the parent. A path that exists but cannot be canonicalized now goes through the native retry, where it used to be resolved from its parent. `access_mode(0)` with backup semantics opens almost anything, so I don't expect regressions, but if the native open also fails the error now surfaces instead of the old fallback. AI-assisted (Claude Code).
Marvisak commented 2026-11-25 01:07:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:29:47Z.


Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-core/src/policy.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148568707 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/310#issuecomment-7148568707). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:29:47Z. --- <!-- victory-triage v1 head=1ea6427f05078f9771d724ba180c8a826c9bf009 verdict=needs-rebase at=2026-11-25T01:15:39Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-core/src/policy.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/310:upstream-pr/310'
git switch 'upstream-pr/310'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/310'
git switch 'upstream-pr/310'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/310'
git switch 'upstream-pr/310'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/310'
git switch 'main'
git merge --squash 'upstream-pr/310'
git switch 'main'
git merge --ff-only 'upstream-pr/310'
git switch 'main'
git merge 'upstream-pr/310'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!310
No description provided.