strip password

This commit is contained in:
Alex Holliday committed 2026-08-20 13:52:14 -07:00
1 parent 1b2d2887af
commit 4443a53a23
6 files changed
+64 -35

No files matched your search

+6 -6
View File
@@ -1,12 +1,12 @@
import { IProxiesController } from "@/api/controllers/proxyController.js";
import { Router } from "express";
export const createProxyRoutes = (tagController: IProxiesController): Router => {
export const createProxyRoutes = (proxyController: IProxiesController): Router => {
const router = Router();
router.post("/", tagController.createProxy);
router.get("/team", tagController.getProxiesByTeamId);
router.get("/:id", tagController.getProxyById);
router.delete("/:id", tagController.deleteProxy);
router.patch("/:id", tagController.editProxy);
router.post("/", proxyController.createProxy);
router.get("/team", proxyController.getProxiesByTeamId);
router.get("/:id", proxyController.getProxyById);
router.delete("/:id", proxyController.deleteProxy);
router.patch("/:id", proxyController.editProxy);
return router;
};
+4 -3
View File
@@ -14,7 +14,10 @@ export const createProxyBodyValidation = z.object({
password: z.string().optional(),
});
export const editProxyBodyValidation = createProxyBodyValidation;
// Empty/absent password keeps doesn't delete, only clearPassword: true does.
export const editProxyBodyValidation = createProxyBodyValidation.extend({
clearPassword: z.boolean().optional(),
});
export const getProxyByIdParamValidation = z.object({
id: z.string().min(1, "Proxy ID is required"),
@@ -26,8 +29,6 @@ export const deleteProxyParamValidation = z.object({
id: z.string().min(1, "Proxy ID is required"),
});
// Canonical proxy shape returned by /proxies endpoints. Keep aligned with what
// the controllers actually serialize (password is intentionally omitted; hasPassword tells the client one is stored).
export const proxyResponseSchema = z
.object({
id: z.string(),