mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
feat(auth): enforce length limits for name and password during registration
feat(comments): add content length validation for comments and annotations feat(guest-gate): restrict guest name length and update localStorage handling feat(share-link-unlock): set maxLength for password input field
This commit is contained in:
@@ -252,6 +252,17 @@ export async function POST(request: NextRequest, { params }: RouteParams) {
|
||||
return apiErrors.badRequest('Either content, a voice recording, an image attachment, or an annotation is required');
|
||||
}
|
||||
|
||||
// Length limits to prevent DB bloat and DoS on export/notification paths
|
||||
if (content !== undefined && content !== null && String(content).length > 10_000) {
|
||||
return apiErrors.badRequest('Comment content must be 10,000 characters or fewer');
|
||||
}
|
||||
if (guestName !== undefined && guestName !== null && String(guestName).length > 100) {
|
||||
return apiErrors.badRequest('Guest name must be 100 characters or fewer');
|
||||
}
|
||||
if (annotationData !== undefined && annotationData !== null && JSON.stringify(annotationData).length > 50_000) {
|
||||
return apiErrors.badRequest('Annotation data is too large');
|
||||
}
|
||||
|
||||
// If replying, verify parent exists in same version
|
||||
if (parentId) {
|
||||
const parent = await db.comment.findFirst({
|
||||
|
||||
Reference in New Issue
Block a user