feat(windows): add global VPN policy - #5
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The Windows routing and lifecycle changes still require the acknowledged clean-reboot policy validation.
Pull request overview
Adds a strict global Windows VPN policy while preserving existing runtime and process boundaries.
Changes:
- Upgrades bridge/profile contracts to revisions 3/4.
- Adds Always On, local-network bypass, and CIDR exclusions.
- Aligns Windows VPN and Session Host MTU at 1400.
File summaries
| File | Description |
|---|---|
src/windows/vpn.rs |
Applies policy routes and MTU settings. |
src/windows/session.rs |
Sets Session Host netstack MTU. |
src/windows/profile.rs |
Persists and validates policy revision 4. |
src/windows/policy.rs |
Implements strict policy and CIDR validation. |
src/windows/mod.rs |
Exposes policy module and MTU constant. |
src/windows/host.rs |
Accepts policy through bridge revision 3. |
scripts/tests/test_scripts.py |
Updates artifact revision assertion. |
scripts/src/vcore_scripts/tun2socks.py |
Updates demo bridge requests and policy. |
scripts/src/vcore_scripts/builds.py |
Emits artifact contract revision 3. |
readme/README.zh_CN.md |
Documents the revised Windows contract. |
readme/README.ru.md |
Documents the revised Windows contract. |
README.md |
Documents policy and Windows MTU. |
include/vcore.h |
Updates bridge revision documentation. |
example/windows-uwp/README.md |
Documents policy integration. |
example/windows-uwp/demo.cpp |
Uses bridge revision 3 and default policy. |
docs/windows-vpn.md |
Defines routing, policy, and MTU behavior. |
docs/windows-session-runtime.md |
Updates profile and startup contracts. |
docs/tun-platform.md |
Documents Windows policy and MTU boundaries. |
docs/runtime-resource-policy.md |
Clarifies Windows resource limits. |
docs/invoke-api.md |
Documents bridge revision 3 payloads. |
CONTEXT.md |
Defines Windows VPN policy terminology. |
Review details
- Files reviewed: 21/21 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Windows 11 ARM64 clean-host policy gateValidated follow-up commit Root causes confirmed by same-source A/B packages
Final source-tree package results
Validation package SHA-256: ARM64 artifacts:
Local validation also passed Still not run: physical IPv6 destination exclusion (host has no physical IPv6/default gateway), Windows 10, native x64, WACK, restricted-capability approval, Partner Center, and production signing. |
There was a problem hiding this comment.
🟡 Changes recommended
Route construction can bypass intended policy semantics, and the acceptance record contradicts the reported validation status.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
src/windows/vpn.rs:1003
- These child inclusion routes are more specific than the physical prefix, but that also makes them more specific than an accepted exclusion covering the same local subnet. For example, with physical
198.51.100.0/24,allowLocalNetwork: false, and excluded198.51.100.0/24, the generated/25inclusions win and the exclusion does not bypass the VPN. Either reject this policy conflict or construct routes so explicit exclusions retain precedence.
if let (Some(address), Some(prefix @ 1..=31)) = (physical.ipv4, physical.ipv4_prefix) {
let child_prefix = prefix + 1;
let network = u32::from(address) & (u32::MAX << (32 - u32::from(prefix)));
let second = network | (1 << (32 - u32::from(child_prefix)));
for network in [network, second].map(Ipv4Addr::from) {
- Files reviewed: 22/22 changed files
- Comments generated: 2
- Review effort level: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The acceptance document claims a clean-reboot gate passed even though the PR description says it remains pending.
Review details
Suppressed comments (1)
docs/acceptance.md:124
- This records the clean-reboot lifecycle and policy gate as passed, but the PR description explicitly says that gate is still pending because the test host remains contaminated and
StartWithMainTransportreturns0x800704C7. Acceptance records are the source of truth for executed validation, so these unexecuted success claims must be removed or replaced with the pending status before merging.
### 全局 VPN policy 与 IPv4-only clean gate(2026-09-01)
当前 Windows 11 ARM64 build 26200.9278 主机重启后,先确认 package-owned route、interface 和进程均为零,再用同一源树构建、开发签名并安装单 Application MSIX。实际结果:
- Files reviewed: 23/23 changed files
- Comments generated: 0 new
- Review effort level: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The 1,400-byte netstack still advertises a 1,452-byte TUN UDP response budget, causing oversized replies to be dropped.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 23/23 changed files
- Comments generated: 2
- Review effort level: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The broad WinRT lifecycle, routing, and physical-network changes require final human review despite substantial test and device validation.
Review details
- Files reviewed: 26/26 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Summary
StartWithMainTransport, including the Windows Session Host netstackAutomated validation
cargo fmt --all -- --checkcargo build --locked --all-targetscargo test --locked --all-features --all-targetsFocused tests cover 1400-MTU TUN/XUDP and DNS response budgets, WinSock address conversion, link-local route inventory, multiple addresses, distinct and duplicate IPv4/IPv6 on-link prefixes, and explicit exclusions overlapping generated child prefixes.
Windows 11 ARM64 gate
On Windows 11 ARM64 build 26200.9278, the development-signed single-Application MSIX built from the current source passed:
ipv6: false/25VPN routeThe host has no non-link-local physical IPv6 address or IPv6 default gateway. Windows 10, native x64, physical IPv6 exclusion, production signing, WACK, restricted-capability approval, Partner Center, and Store submission remain release gates and are not claimed here.