Commit 2210fe2
committed
fix(webapp): tighten sessions create + list auth
- Derive isCached from the upsert result (id mismatch = pre-existing row)
instead of doing a separate findFirst first. The pre-check was racy —
two concurrent first-time POSTs could both return 201 with
isCached: false. Using the returned row's id is atomic and saves a
round-trip.
- Scope the list endpoint's authorization to the standard action/resource
pattern (matches api.v1.runs.ts): task-scoped JWTs can list sessions
filtered by their task, and broader super-scopes (read:sessions,
read:all, admin) authorize unfiltered listing.
- Log and swallow unexpected errors on POST rather than returning the
raw error.message. Prisma/internal messages can leak column names and
query fragments.1 parent ff46f33 commit 2210fe2
1 file changed
+11
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
| |||
93 | 99 | | |
94 | 100 | | |
95 | 101 | | |
96 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
97 | 105 | | |
98 | 106 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| |||
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 159 | + | |
161 | 160 | | |
162 | 161 | | |
163 | 162 | | |
| |||
0 commit comments