Backend Changes: - Extended SafeScriptAPI to support all HTTP methods (GET, POST, PUT, PATCH, DELETE) - Created WhitelistedURL model for per-plugin and platform-wide URL whitelisting - Added _validate_url() method with SSRF protection and private IP blocking - Updated SafeScriptAPI to accept scheduled_task parameter for whitelist checking - All HTTP methods now validate against whitelist before making requests WhitelistedURL Model: - Supports two scopes: PLATFORM (all plugins) and PLUGIN (specific plugin) - Stores URL patterns with wildcard support (e.g., https://api.example.com/*) - Tracks allowed HTTP methods per URL - Includes approval workflow (approved_by, approved_at) - Stores original plugin code for verification - Domain-based indexing for fast lookup - Database constraint ensures platform-wide entries have no plugin assigned Security Features: - SSRF prevention: blocks localhost, loopback, and private IP ranges - Per-plugin whitelist: each ScheduledTask can only access its whitelisted URLs - Platform-wide whitelist: approved URLs accessible by all plugins - HTTP method validation: URLs must explicitly allow each method - URL pattern matching with wildcard support Related Models: - WhitelistedURL.scheduled_task -> ScheduledTask (plugin that owns the whitelist) - WhitelistedURL.approved_by -> User (platform user who approved the URL) Migration: schedule/migrations/0014_whitelistedurl.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
23 KiB
23 KiB