fix: check chat/vote ownership during actions (#847)
This commit is contained in:
parent
c58fd528fc
commit
a378757d3b
4 changed files with 28 additions and 2 deletions
|
|
@ -58,7 +58,12 @@ export async function POST(request: Request) {
|
|||
const title = await generateTitleFromUserMessage({
|
||||
message: userMessage,
|
||||
});
|
||||
|
||||
await saveChat({ id, userId: session.user.id, title });
|
||||
} else {
|
||||
if (chat.userId !== session.user.id) {
|
||||
return new Response('Unauthorized', { status: 401 });
|
||||
}
|
||||
}
|
||||
|
||||
await saveMessages({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue