Commit fc3b1a4
authored
HotFix: Simplify teamIdOrSlug schema validation (#185)
The previous TeamIdOrSlugSchema regex did not match the possible slugs
in the database 100% of the time.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Loosens teamIdOrSlug validation, verifies UUIDs against DB to avoid
slug/ID collisions, and adds structured warning logs in dashboard and
team middleware.
>
> - **Team resolution/backend**:
> - `TeamIdOrSlugSchema` now accepts any `string` (removed slug regex)
alongside `uuid`.
> - `getTeamIdFromSegment` verifies UUIDs against `teams` table and
ensures they aren’t treated as IDs when they match a slug; retains slug
lookup and uses `server-only`.
> - **Logging**:
> - Adds warning logs in `app/dashboard/[teamIdOrSlug]/layout.tsx` when
team cannot be resolved (with serialized error).
> - Adds warning logs in `withTeamIdResolution` middleware for invalid
`teamIdOrSlug` and unauthorized access.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
bbb083f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 4d66499 commit fc3b1a4
File tree
4 files changed
+50
-8
lines changed- src
- app/dashboard/[teamIdOrSlug]
- lib
- clients
- schemas
- server/team
4 files changed
+50
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
51 | 64 | | |
52 | 65 | | |
53 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
218 | 228 | | |
219 | 229 | | |
220 | 230 | | |
221 | 231 | | |
222 | 232 | | |
223 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
224 | 244 | | |
225 | 245 | | |
226 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
33 | 42 | | |
34 | 43 | | |
35 | 44 | | |
| |||
0 commit comments