mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-26 20:26:13 +01:00
🔐 fix: Secure iconURL Handling (#10753)
* 🔒 fix: `iconURL` in conversation parsing - Updated the `buildEndpointOption` middleware to derive `iconURL` from model specs when not provided by the client, improving security by preventing malicious URLs. - Modified the `parseCompactConvo` function to strip `iconURL` from conversation inputs, ensuring it is only set server-side. - Added comprehensive tests to validate the stripping of `iconURL` across various endpoint types, enhancing overall input sanitization. * ✨ feat: Add ESLint rule for unused variables - Introduced a new ESLint rule to warn about unused variables, allowing for better code quality and maintainability. - Configured the rule to ignore variables and arguments that start with an underscore, accommodating common coding practices.
This commit is contained in:
parent
4202db1c99
commit
6fa94d3eb8
4 changed files with 162 additions and 6 deletions
|
|
@ -343,7 +343,11 @@ export const parseCompactConvo = ({
|
|||
throw new Error(`Unknown endpointType: ${endpointType}`);
|
||||
}
|
||||
|
||||
const convo = schema.parse(conversation) as s.TConversation | null;
|
||||
// Strip iconURL from input before parsing - it should only be derived server-side
|
||||
// from model spec configuration, not accepted from client requests
|
||||
const { iconURL: _clientIconURL, ...conversationWithoutIconURL } = conversation;
|
||||
|
||||
const convo = schema.parse(conversationWithoutIconURL) as s.TConversation | null;
|
||||
// const { models, secondaryModels } = possibleValues ?? {};
|
||||
const { models } = possibleValues ?? {};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue