mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🛡️ feat: Model Validation Middleware (#1841)
* refactor: add ViolationTypes enum and add new violation for illegal model requests * feat: validateModel middleware to protect the backend against illicit requests for unlisted models
This commit is contained in:
parent
d8038e3b19
commit
a8a19c6caa
19 changed files with 539 additions and 377 deletions
|
|
@ -1,5 +1,5 @@
|
|||
const rateLimit = require('express-rate-limit');
|
||||
const { CacheKeys } = require('librechat-data-provider');
|
||||
const { ViolationTypes } = require('librechat-data-provider');
|
||||
const logViolation = require('~/cache/logViolation');
|
||||
|
||||
const getEnvironmentVariables = () => {
|
||||
|
|
@ -35,7 +35,7 @@ const createFileUploadHandler = (ip = true) => {
|
|||
} = getEnvironmentVariables();
|
||||
|
||||
return async (req, res) => {
|
||||
const type = CacheKeys.FILE_UPLOAD_LIMIT;
|
||||
const type = ViolationTypes.FILE_UPLOAD_LIMIT;
|
||||
const errorMessage = {
|
||||
type,
|
||||
max: ip ? fileUploadIpMax : fileUploadUserMax,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue