mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 10:16:56 +00:00
fix(security): improve access control and storage security (#518)
* fix(security): improve access control and storage security * fix(security): set NODE_ENV in dockerfiles and sign local storage get urls with lru cache
This commit is contained in:
@@ -14,7 +14,7 @@ import { notificationService } from '@shumai/core/src/notification/notification'
|
||||
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
|
||||
import { assetService } from '@shumai/core/src/asset/asset'
|
||||
import { NotificationType } from '@shumai/db'
|
||||
import { s3Service, verifyLocalUrlSignature } from '@shumai/core/src/s3/s3'
|
||||
import { getStorageBackend, s3Service, verifyLocalUrlSignature } from '@shumai/core/src/s3/s3'
|
||||
import type { Prisma } from '@shumai/db'
|
||||
|
||||
type User = Prisma.UserGetPayload<Record<string, never>>
|
||||
@@ -23,6 +23,10 @@ export const localUploadRoute = new Hono().put(
|
||||
'/upload/local',
|
||||
zValidator('query', localUploadQuerySchema),
|
||||
async (c) => {
|
||||
if (getStorageBackend() !== 'local') {
|
||||
return c.text('Not found', 404)
|
||||
}
|
||||
|
||||
const { bucket, key, Signature } = c.req.valid('query')
|
||||
|
||||
if (!verifyLocalUrlSignature(bucket, key, Signature)) {
|
||||
|
||||
Reference in New Issue
Block a user