Commit e7ff476
fix: Add ownership checks to global task endpoints (open-webui#23454)
* Add ownership checks to global task endpoints
- Restrict GET /api/tasks and POST /api/tasks/stop/{task_id} to admin-only
- Add new scoped POST /api/tasks/chat/{chat_id}/stop endpoint with ownership
check so regular users can stop their own chat tasks
- Allow admins to access the scoped chat task endpoints alongside owners
- Update frontend to use the new scoped stop endpoint when a chatId is available
https://claude.ai/code/session_01K7zPDvvjRu8AxJ4Br2HhZc
* Handle temporary (local:) chat IDs in scoped task endpoints
Temporary chats use local:<socketId> as chat_id which doesn't exist in
the DB. The scoped endpoints now skip ownership checks for local: IDs
(they aren't enumerable) and use {chat_id:path} to handle the colon in
the URL path.
https://claude.ai/code/session_01K7zPDvvjRu8AxJ4Br2HhZc
* Verify session ownership for local: chat IDs and URL-encode chat_id
- For local:<socketId> chat IDs, look up the socket's owner in
SESSION_POOL and verify it matches the requesting user (or admin)
- URL-encode chat_id in frontend fetch calls to handle special
characters (colon in local: IDs) safely
https://claude.ai/code/session_01K7zPDvvjRu8AxJ4Br2HhZc
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent c47dd7b commit e7ff476
3 files changed
Lines changed: 72 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
566 | 567 | | |
567 | 568 | | |
568 | 569 | | |
| 570 | + | |
569 | 571 | | |
570 | 572 | | |
571 | 573 | | |
| |||
1974 | 1976 | | |
1975 | 1977 | | |
1976 | 1978 | | |
1977 | | - | |
| 1979 | + | |
1978 | 1980 | | |
1979 | 1981 | | |
1980 | 1982 | | |
| |||
1983 | 1985 | | |
1984 | 1986 | | |
1985 | 1987 | | |
1986 | | - | |
| 1988 | + | |
1987 | 1989 | | |
1988 | 1990 | | |
1989 | 1991 | | |
1990 | | - | |
| 1992 | + | |
1991 | 1993 | | |
1992 | | - | |
1993 | | - | |
1994 | | - | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
1995 | 2003 | | |
1996 | 2004 | | |
1997 | 2005 | | |
1998 | 2006 | | |
1999 | 2007 | | |
2000 | 2008 | | |
2001 | 2009 | | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
2002 | 2025 | | |
2003 | 2026 | | |
2004 | 2027 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
276 | 308 | | |
277 | 309 | | |
278 | 310 | | |
279 | | - | |
| 311 | + | |
280 | 312 | | |
281 | 313 | | |
282 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
2464 | 2465 | | |
2465 | 2466 | | |
2466 | 2467 | | |
2467 | | - | |
2468 | | - | |
| 2468 | + | |
| 2469 | + | |
2469 | 2470 | | |
2470 | 2471 | | |
2471 | 2472 | | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
2472 | 2480 | | |
2473 | 2481 | | |
2474 | 2482 | | |
| |||
0 commit comments