mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-24 03:06:12 +01:00
🔒 fix: Access Check for User-Specific Job Metadata in Streaming Endpoint (#11487)
* Implemented a check to ensure that only the user associated with a job can access its chat stream, returning a 403 Unauthorized response for mismatched user IDs. * This enhancement improves security by preventing unauthorized access to user-specific job data.
This commit is contained in:
parent
ee44c6344d
commit
8be0047a80
1 changed files with 4 additions and 0 deletions
|
|
@ -47,6 +47,10 @@ router.get('/chat/stream/:streamId', async (req, res) => {
|
|||
});
|
||||
}
|
||||
|
||||
if (job.metadata?.userId && job.metadata.userId !== req.user.id) {
|
||||
return res.status(403).json({ error: 'Unauthorized' });
|
||||
}
|
||||
|
||||
res.setHeader('Content-Encoding', 'identity');
|
||||
res.setHeader('Content-Type', 'text/event-stream');
|
||||
res.setHeader('Cache-Control', 'no-cache, no-transform');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue