Compare commits

...

2 Commits

Author SHA1 Message Date
miloschwartz
28f9daa0f0 fix full sudo mode calculation 2026-04-24 15:15:27 -07:00
Owen
7a600caf3d Sites optional 2026-04-23 11:38:53 -07:00
2 changed files with 4 additions and 4 deletions

View File

@@ -326,7 +326,7 @@ export const ClientResourceSchema = z
.object({ .object({
name: z.string().min(1).max(255), name: z.string().min(1).max(255),
mode: z.enum(["host", "cidr"]), mode: z.enum(["host", "cidr"]),
site: z.string(), site: z.string().optional(),
// protocol: z.enum(["tcp", "udp"]).optional(), // protocol: z.enum(["tcp", "udp"]).optional(),
// proxyPort: z.int().positive().optional(), // proxyPort: z.int().positive().optional(),
// destinationPort: z.int().positive().optional(), // destinationPort: z.int().positive().optional(),

View File

@@ -369,8 +369,8 @@ export async function signSshKey(
const parsedSudoCommands: string[] = []; const parsedSudoCommands: string[] = [];
const parsedGroupsSet = new Set<string>(); const parsedGroupsSet = new Set<string>();
let homedir: boolean | null = null; let homedir: boolean | null = null;
const sudoModeOrder = { none: 0, commands: 1, all: 2 }; const sudoModeOrder = { none: 0, commands: 1, full: 2 };
let sudoMode: "none" | "commands" | "all" = "none"; let sudoMode: "none" | "commands" | "full" = "none";
for (const roleRow of roleRows) { for (const roleRow of roleRows) {
try { try {
const cmds = JSON.parse(roleRow?.sshSudoCommands ?? "[]"); const cmds = JSON.parse(roleRow?.sshSudoCommands ?? "[]");
@@ -387,7 +387,7 @@ export async function signSshKey(
if (roleRow?.sshCreateHomeDir === true) homedir = true; if (roleRow?.sshCreateHomeDir === true) homedir = true;
const m = roleRow?.sshSudoMode ?? "none"; const m = roleRow?.sshSudoMode ?? "none";
if (sudoModeOrder[m as keyof typeof sudoModeOrder] > sudoModeOrder[sudoMode]) { if (sudoModeOrder[m as keyof typeof sudoModeOrder] > sudoModeOrder[sudoMode]) {
sudoMode = m as "none" | "commands" | "all"; sudoMode = m as "none" | "commands" | "full";
} }
} }
const parsedGroups = Array.from(parsedGroupsSet); const parsedGroups = Array.from(parsedGroupsSet);