╭ changed ───────╮ │src/test/net.zig│ ╰────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │15 const allocator = std.testing.allocator; │ │16 try testFetch(.xit, .{ .wire = .http }, .sha1, 3001, io, allocator); │ │17 try testFetch(.xit, .{ .wire = .http }, .sha256, 3003, io, allocator); │ │18 - if (.windows != builtin.os.tag) { │ │19 - try testFetch(.xit, .{ .wire = .ssh }, .sha1, 3005, io, allocator); │ │20 - try testFetch(.xit, .{ .wire = .ssh }, .sha256, 3007, io, allocator);│ │21 - } │ │18 + try testFetch(.xit, .{ .wire = .ssh }, .sha1, 3005, io, allocator); │ │19 + try testFetch(.xit, .{ .wire = .ssh }, .sha256, 3007, io, allocator); │ │20 } │ │21 │ │22 test "push small" { │ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │23 const io = std.testing.io; │ │24 const allocator = std.testing.allocator; │ │27 - if (.windows != builtin.os.tag) { │ │28 - try testPush(.xit, .{ .wire = .ssh }, .sha1, 3101, io, allocator); │ │29 - try testPush(.xit, .{ .wire = .ssh }, .sha256, 3103, io, allocator);│ │30 - } │ │25 + try testPush(.xit, .{ .wire = .ssh }, .sha1, 3101, io, allocator); │ │26 + try testPush(.xit, .{ .wire = .ssh }, .sha256, 3103, io, allocator); │ │27 } │ │28 │ │29 test "push creates missing repo under serve" { │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │30 const io = std.testing.io; │ │31 const allocator = std.testing.allocator; │ │36 - if (.windows != builtin.os.tag) { │ │37 - // the server creates missing repositories as sha1 │ │38 - try testPushCreatesMissingRepo(.xit, .{ .wire = .ssh }, 3201, io, allocator);│ │39 - } │ │32 + // the server creates missing repositories as sha1 │ │33 + try testPushCreatesMissingRepo(.xit, .{ .wire = .ssh }, 3201, io, allocator); │ │34 } │ │35 │ │36 test "push events" { │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │37 const io = std.testing.io; │ │38 const allocator = std.testing.allocator; │ │45 - if (.windows != builtin.os.tag) { │ │46 - try testPushEvents(.xit, .{ .wire = .ssh }, .sha1, 3301, io, allocator); │ │47 - try testPushEvents(.xit, .{ .wire = .ssh }, .sha256, 3303, io, allocator);│ │48 - } │ │39 + try testPushEvents(.xit, .{ .wire = .ssh }, .sha1, 3301, io, allocator); │ │40 + try testPushEvents(.xit, .{ .wire = .ssh }, .sha256, 3303, io, allocator); │ │41 } │ │42 │ │43 test "clone small" { │ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────╮ │45 const allocator = std.testing.allocator; │ │46 try testClone(.xit, .{ .wire = .http }, false, .sha1, 3401, io, allocator); │ │47 try testClone(.xit, .{ .wire = .http }, false, .sha256, 3403, io, allocator); │ │56 - if (.windows != builtin.os.tag) { │ │57 - try testClone(.xit, .{ .wire = .ssh }, false, .sha1, 3405, io, allocator); │ │58 - try testClone(.xit, .{ .wire = .ssh }, false, .sha256, 3407, io, allocator);│ │59 - } │ │48 + try testClone(.xit, .{ .wire = .ssh }, false, .sha1, 3405, io, allocator); │ │49 + try testClone(.xit, .{ .wire = .ssh }, false, .sha256, 3407, io, allocator); │ │50 } │ │51 │ │52 test "clone small subprocess" { │ ╰────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────╮ │54 const allocator = std.testing.allocator; │ │55 try testClone(.git, .{ .wire = .http }, true, .sha1, 3501, io, allocator); │ │56 try testClone(.git, .{ .wire = .http }, true, .sha256, 3503, io, allocator); │ │67 - if (.windows != builtin.os.tag) { │ │68 - try testClone(.git, .{ .wire = .ssh }, true, .sha1, 3505, io, allocator); │ │69 - try testClone(.git, .{ .wire = .ssh }, true, .sha256, 3507, io, allocator);│ │70 - } │ │57 + try testClone(.git, .{ .wire = .ssh }, true, .sha1, 3505, io, allocator); │ │58 + try testClone(.git, .{ .wire = .ssh }, true, .sha256, 3507, io, allocator); │ │59 } │ │60 │ │61 test "fetch large subprocess" { │ ╰───────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────╮ │63 const allocator = std.testing.allocator; │ │64 try testFetchLarge(.git, .{ .wire = .http }, true, .sha1, 3601, io, allocator); │ │65 try testFetchLarge(.git, .{ .wire = .http }, true, .sha256, 3603, io, allocator); │ │78 - if (.windows != builtin.os.tag) { │ │79 - try testFetchLarge(.git, .{ .wire = .ssh }, true, .sha1, 3605, io, allocator); │ │80 - try testFetchLarge(.git, .{ .wire = .ssh }, true, .sha256, 3607, io, allocator);│ │81 - } │ │66 + try testFetchLarge(.git, .{ .wire = .ssh }, true, .sha1, 3605, io, allocator); │ │67 + try testFetchLarge(.git, .{ .wire = .ssh }, true, .sha256, 3607, io, allocator); │ │68 } │ │69 │ │70 test "push large subprocess" { │ ╰────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────╮ │71 const io = std.testing.io; │ │72 const allocator = std.testing.allocator; │ │87 - if (.windows != builtin.os.tag) { │ │88 - try testPushLarge(.git, .{ .wire = .ssh }, true, .sha1, 3701, io, allocator); │ │89 - try testPushLarge(.git, .{ .wire = .ssh }, true, .sha256, 3703, io, allocator);│ │90 - } │ │73 + try testPushLarge(.git, .{ .wire = .ssh }, true, .sha1, 3701, io, allocator); │ │74 + try testPushLarge(.git, .{ .wire = .ssh }, true, .sha256, 3703, io, allocator); │ │75 } │ │76 │ │77 test "push fork" { │ ╰───────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────╮ │78 const io = std.testing.io; │ │79 const allocator = std.testing.allocator; │ │96 - if (.windows != builtin.os.tag) { │ │97 - try testPushFork(.sha1, 3801, io, allocator); │ │98 - try testPushFork(.sha256, 3803, io, allocator);│ │99 - } │ │80 + try testPushFork(.sha1, 3801, io, allocator); │ │81 + try testPushFork(.sha256, 3803, io, allocator); │ │82 } │ │83 │ │84 fn runServer( │ ╰───────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │107 } │ │108 } │ │109 │ │110 + if (builtin.os.tag == .windows) { │ │111 + // openssh needs an acl granting access only to the current user. │ │112 + // use cwd so the temp path doesn't need powershell quoting. │ │113 + var permissions_process = try std.process.spawn(io, .{ │ │114 + .argv = &.{ │ │115 + "powershell.exe", "-NoProfile", "-NonInteractive", "-Command", │ │116 + \\$ErrorActionPreference = 'Stop' │ │117 + \\$user = [System.Security.Principal.WindowsIdentity]::GetCurrent().User │ │118 + \\$acl = [System.Security.AccessControl.FileSecurity]::new() │ │119 + \\$acl.SetOwner($user) │ │120 + \\$acl.SetAccessRuleProtection($true, $false) │ │121 + \\$rule = [System.Security.AccessControl.FileSystemAccessRule]::new($user, 'FullControl', 'Allow')│ │122 + \\$acl.AddAccessRule($rule) │ │123 + \\Set-Acl -LiteralPath .\key -AclObject $acl │ │124 + , │ │125 + }, │ │126 + .cwd = .{ .path = temp_path }, │ │127 + .stdin = .ignore, │ │128 + .stdout = .ignore, │ │129 + .stderr = .inherit, │ │130 + }); │ │131 + defer permissions_process.kill(io); │ │132 + const term = try permissions_process.wait(io); │ │133 + if (term != .exited or term.exited != 0) return error.SshKeyPermissionsFailed; │ │134 + } │ │135 + │ │136 // seed the admin event store so the server can resolve <owner>/<repo> paths │ │137 // and authenticate pushes from the dev key above │ │138 try setupAdmin(io, allocator, temp_path); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯