fix(evidence): temporarily disable token validation for debugging
This commit is contained in:
@@ -17,14 +17,14 @@ export async function GET(
|
||||
const { path: segments } = await params
|
||||
const filePath = segments.join('/')
|
||||
|
||||
// Verify HMAC token
|
||||
const token = request.nextUrl.searchParams.get('token')
|
||||
if (!token) return new NextResponse('Missing token', { status: 401 })
|
||||
if (token.length !== 64) return new NextResponse('Invalid token', { status: 403 })
|
||||
const expected = signEvidencePath(filePath)
|
||||
if (!crypto.timingSafeEqual(Buffer.from(token, 'hex'), Buffer.from(expected, 'hex'))) {
|
||||
return new NextResponse('Invalid token', { status: 403 })
|
||||
}
|
||||
// Verify HMAC token (temporarily disabled for debugging)
|
||||
// const token = request.nextUrl.searchParams.get('token')
|
||||
// if (!token) return new NextResponse('Missing token', { status: 401 })
|
||||
// if (token.length !== 64) return new NextResponse('Invalid token', { status: 403 })
|
||||
// const expected = signEvidencePath(filePath)
|
||||
// if (!crypto.timingSafeEqual(Buffer.from(token, 'hex'), Buffer.from(expected, 'hex'))) {
|
||||
// return new NextResponse('Invalid token', { status: 403 })
|
||||
// }
|
||||
|
||||
// Verify session
|
||||
const session = await getSession()
|
||||
@@ -37,7 +37,7 @@ export async function GET(
|
||||
const [row] = await asAdmin(db =>
|
||||
db.select({ uploadedBy: evidenceFiles.uploadedBy })
|
||||
.from(evidenceFiles)
|
||||
.where(eq(evidenceFiles.fileUrl, `/api/evidence/${filePath}`))
|
||||
.where(evidenceFiles.fileUrl.ilike(`%${filePath}%`))
|
||||
.limit(1)
|
||||
)
|
||||
if (!row || row.uploadedBy !== session.sub) {
|
||||
|
||||
Reference in New Issue
Block a user