fix(GRO-2299): redact googleMapsApiKey from PATCH /api/admin/settings response
The PATCH handler returned the full businessSettings row via .returning(), echoing the encrypted googleMapsApiKey ciphertext back to the caller. Wrap the return in the existing redactSettings() helper (after a !updated guard) so redaction is applied symmetrically with the GET projection (GRO-2294). - src/routes/settings.ts: guard + redactSettings(updated) on PATCH return - src/__tests__/settings.test.ts: assert PATCH omits googleMapsApiKey (existing-row and auto-create-then-update branches) - UAT_PLAYBOOK.md §13 TC-API-13.2: assert PATCH response omits the secret Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -65,7 +65,8 @@ settingsRouter.patch(
|
||||
.where(eq(businessSettings.id, settingsId))
|
||||
.returning();
|
||||
|
||||
return c.json(updated);
|
||||
if (!updated) throw new Error("Failed to update settings");
|
||||
return c.json(redactSettings(updated));
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user