Tom Qiao
b9602adabe
fix(handler): validate skill id UUID at request boundary ( #3025 )
...
loadSkillForUser was passing chi.URLParam(r, "id") directly into
parseUUID, the panic-on-invalid helper reserved for trusted UUID
round-trips. A malformed `/api/skills/{notuuid}` request panicked
in util.MustParseUUID; chi's middleware.Recoverer turned it into a
500 instead of a 400.
This violates the documented convention (CLAUDE.md → "Backend Handler
UUID Parsing Convention"): pure-UUID request inputs must use
parseUUIDOrBadRequest, which writes a 400 and short-circuits.
Switch loadSkillForUser to parseUUIDOrBadRequest. Behaviour for valid
UUIDs is unchanged; malformed input now returns 400 with a clear
"invalid skill id" message.
Test:
- TestGetSkill_MalformedUUIDReturns400 asserts GET /api/skills/not-a-uuid
returns 400.
Co-authored-by: Tom Qiao <tomqiaozc@users.noreply.github.com >
2026-05-22 12:22:07 +08:00
..
2026-05-09 16:11:58 +08:00
2026-05-09 16:11:58 +08:00
2026-05-11 12:39:45 +08:00
2026-05-11 12:39:45 +08:00
2026-05-13 18:26:04 +08:00
2026-04-28 19:21:13 +08:00
2026-05-20 12:30:10 +08:00
2026-05-20 12:30:10 +08:00
2026-04-21 14:42:52 +08:00
2026-05-21 15:33:47 +08:00
2026-05-18 12:17:39 +08:00
2026-05-18 12:17:39 +08:00
2026-05-18 12:17:39 +08:00
2026-05-18 14:59:40 +08:00
2026-05-20 15:37:23 +08:00
2026-05-13 16:57:34 +08:00
2026-05-13 16:57:34 +08:00
2026-05-21 17:07:44 +08:00
2026-05-21 17:07:44 +08:00
2026-05-21 13:43:15 +08:00
2026-05-21 13:43:15 +08:00
2026-05-09 13:12:00 +08:00
2026-05-09 13:12:00 +08:00
2026-05-21 17:06:55 +08:00
2026-04-28 16:07:24 +08:00
2026-05-21 15:33:47 +08:00
2026-05-21 15:33:47 +08:00
2026-05-21 15:33:47 +08:00
2026-04-23 10:35:55 +08:00
2026-04-28 14:50:28 +08:00
2026-05-13 18:24:15 +08:00
2026-05-13 18:24:15 +08:00
2026-05-20 04:17:45 +02:00
2026-05-20 04:17:45 +02:00
2026-05-20 15:37:23 +08:00
2026-05-21 16:35:45 +08:00
2026-05-07 15:50:27 +08:00
2026-05-07 15:50:27 +08:00
2026-05-06 14:31:33 +08:00
2026-04-28 14:50:28 +08:00
2026-05-04 21:24:56 +08:00
2026-05-21 19:00:26 +08:00
2026-04-30 15:35:12 +08:00
2026-05-15 18:44:08 +08:00
2026-05-19 10:37:38 +08:00
2026-05-21 16:35:45 +08:00
2026-05-21 16:35:45 +08:00
2026-05-19 17:04:16 +08:00
2026-05-21 16:35:45 +08:00
2026-04-27 14:23:42 +08:00
2026-04-28 14:50:28 +08:00
2026-05-20 17:18:41 +08:00
2026-05-06 11:01:22 +02:00
2026-05-21 19:00:26 +08:00
2026-05-21 19:00:26 +08:00
2026-05-21 19:00:26 +08:00
2026-05-21 15:33:47 +08:00
2026-04-29 17:07:54 +08:00
2026-04-28 14:50:28 +08:00
2026-05-15 12:47:38 +08:00
2026-05-15 12:47:38 +08:00
2026-05-06 14:09:35 +08:00
2026-04-28 14:50:28 +08:00
2026-05-13 18:46:20 +08:00
2026-05-06 14:31:33 +08:00
2026-05-06 14:31:33 +08:00
2026-05-18 16:56:27 +08:00
2026-05-18 16:56:27 +08:00
2026-05-18 16:56:27 +08:00
2026-05-18 16:56:27 +08:00
2026-05-03 11:13:34 +08:00
2026-05-03 11:13:34 +08:00
2026-05-03 11:13:34 +08:00
2026-05-20 12:30:10 +08:00
2026-05-21 15:33:47 +08:00
2026-05-06 13:00:11 +08:00
2026-05-06 13:00:11 +08:00
2026-05-06 13:00:11 +08:00
2026-05-06 13:00:11 +08:00
2026-05-21 15:33:47 +08:00
2026-05-21 15:33:47 +08:00
2026-05-18 15:45:06 +08:00
2026-05-13 18:26:04 +08:00
2026-05-22 12:22:07 +08:00
2026-05-13 18:26:04 +08:00
2026-05-22 12:22:07 +08:00
2026-05-13 18:46:20 +08:00
2026-05-13 18:46:20 +08:00
2026-05-15 13:17:08 +08:00
2026-05-14 15:23:36 +02:00
2026-05-18 10:35:18 +02:00
2026-05-14 14:07:26 +08:00
2026-05-20 05:30:13 +02:00
2026-05-11 12:39:45 +08:00
2026-04-17 16:26:00 +08:00
2026-05-20 15:30:03 +08:00
2026-04-29 15:54:24 +08:00
2026-05-06 16:16:12 +08:00
2026-05-21 15:33:47 +08:00
2026-05-18 14:59:40 +08:00
2026-05-18 14:59:40 +08:00
2026-05-18 12:17:39 +08:00
2026-05-18 12:17:39 +08:00
2026-05-08 19:14:12 +08:00
2026-05-11 15:06:50 +08:00
2026-05-21 19:00:26 +08:00
2026-05-21 19:00:26 +08:00