31 lines
917 B
TypeScript
31 lines
917 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { logCSPViolation } from '@/shared/lib/csp-utils';
|
|
|
|
export async function POST(request: NextRequest) {
|
|
try {
|
|
const violation = await request.json();
|
|
|
|
// CSP 위반 로깅
|
|
logCSPViolation(violation);
|
|
|
|
// 추가적인 보안 분석이나 알림 로직을 여기에 추가할 수 있습니다
|
|
// 예: Slack 알림, 이메일 알림, 데이터베이스 저장 등
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
message: 'CSP violation logged successfully'
|
|
});
|
|
} catch (error) {
|
|
console.error('Error processing CSP violation:', error);
|
|
return NextResponse.json(
|
|
{ success: false, message: 'Failed to process CSP violation' },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|
|
|
|
export async function GET() {
|
|
return NextResponse.json({
|
|
message: 'CSP violation reporting endpoint is active'
|
|
});
|
|
}
|