mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 09:51:13 -05:00
feat: Implement security fix plan
This commit is contained in:
@@ -4,6 +4,7 @@ import { createClient } from "https://esm.sh/@supabase/supabase-js@2.57.4";
|
||||
import { validateEntityData, validateEntityDataStrict } from "./validation.ts";
|
||||
import { createErrorResponse } from "../_shared/errorSanitizer.ts";
|
||||
import { edgeLogger, startRequest, endRequest } from "../_shared/logger.ts";
|
||||
import { rateLimiters, withRateLimit } from "../_shared/rateLimiter.ts";
|
||||
|
||||
const corsHeaders = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
@@ -46,7 +47,10 @@ const RIDE_MODEL_FIELDS = [
|
||||
'card_image_url', 'card_image_id'
|
||||
];
|
||||
|
||||
serve(async (req) => {
|
||||
// Apply per-user rate limiting for moderators (10 approvals/minute per moderator)
|
||||
const approvalRateLimiter = rateLimiters.perUser(10);
|
||||
|
||||
serve(withRateLimit(async (req) => {
|
||||
const tracking = startRequest(); // Start request tracking
|
||||
|
||||
if (req.method === 'OPTIONS') {
|
||||
@@ -764,7 +768,7 @@ serve(async (req) => {
|
||||
'process-selective-approval'
|
||||
);
|
||||
}
|
||||
});
|
||||
}, approvalRateLimiter, corsHeaders));
|
||||
|
||||
// Helper functions
|
||||
function topologicalSort(items: any[]): any[] {
|
||||
|
||||
Reference in New Issue
Block a user