╭ changed ────────╮ │src/serve_ssh.zig│ ╰─────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │489 if (service == .receive_pack and !isKeyInAuthorizedKeys(user.event.ssh_keys, &sess.fingerprint)) │ │490 return writeError(sess, "unauthorized: this SSH key is not registered to the patch author"); │ │491 │ │492 - const target = (try evt.readRepoById(io, allocator, &admin_arena, handler.server.users_dir, fork_record.event.repo_user_id[0..evt.event_id_size], fork_record.event.repo_id[0..evt.event_id_size], forker_id)) orelse│ │492 + const target_owner_id = try evt.parseEventId(&fork_record.event.repo_user_id); │ │493 + const target_id = try evt.parseEventId(&fork_record.event.repo_id); │ │494 + const target = (try evt.readRepoById(io, allocator, &admin_arena, handler.server.users_dir, &target_owner_id, &target_id, forker_id)) orelse │ │495 return writeError(sess, "repo not found"); │ │496 // patches that are off take their drafts with them │ │497 const patch_role = target.repo.event.patch_role orelse return writeError(sess, "patch draft not found"); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │512 } │ │513 } else { │ │514 if (!std.mem.eql(u8, target.repo.event.name, forker_repo.name)) return writeError(sess, "patch draft belongs to another repo"); │ │513 - const target_path = try evt.repoPath(allocator, handler.server.users_dir, fork_record.event.repo_user_id, fork_record.event.repo_id);│ │515 + const target_path = try evt.repoPath(allocator, handler.server.users_dir, &target_owner_id, &target_id); │ │516 defer allocator.free(target_path); │ │517 const author: evt.CommitAuthor = .{ .name = user.event.name, .email = user.event.email }; │ │518 const timestamp: u64 = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │592 } │ │593 │ │594 // the creator owns the repo │ │593 - const owner_id = repo.repo.event.user_id[0..evt.event_id_size]; │ │594 - if (try authorWithKey(moment, arena, owner_id, fingerprint)) |author| return .{ .allowed = author }; │ │595 + const owner_id = try evt.parseEventId(&repo.repo.event.user_id); │ │596 + if (try authorWithKey(moment, arena, &owner_id, fingerprint)) |author| return .{ .allowed = author };│ │597 │ │598 // anyone else holding the key needs a grant with the role. a key can be │ │599 // shared, so a grant that falls short doesn't end the search. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │598 - for (try evt.readRepoGrants(io, allocator, arena, users_dir, owner_id, &repo.event_id)) |grant| { │ │600 + for (try evt.readRepoGrants(io, allocator, arena, users_dir, &owner_id, &repo.event_id)) |grant| { │ │601 if (!grant.role.atLeast(min_role)) continue; │ │600 - if (try authorWithKey(moment, arena, grant.user_id, fingerprint)) |author| return .{ .allowed = author }; │ │602 + if (try authorWithKey(moment, arena, &try evt.parseEventId(&grant.user_id), fingerprint)) |author| return .{ .allowed = author };│ │603 } │ │604 return .denied; │ │605 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯