Changeset 3323146
- Timestamp:
- 07/06/2025 09:07:50 PM (9 months ago)
- File:
-
- 1 edited
-
dairect-chat/trunk/includes/api-handler.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dairect-chat/trunk/includes/api-handler.php
r3322007 r3323146 16 16 $api_key = getenv('GEMINI_API_KEY'); 17 17 18 // Line 19 over-sanitized for Plugin Review19 $session_raw = isset($_SESSION['dairect_chat_history']) 18 // Properly sanitized session history 19 $session_raw = isset($_SESSION['dairect_chat_history']) && is_array($_SESSION['dairect_chat_history']) 20 20 ? array_map(function($entry) { 21 21 return [ … … 23 23 'parts' => array_map(function($part) { 24 24 return ['text' => sanitize_text_field(wp_unslash($part['text'] ?? ''))]; 25 }, wp_unslash($entry['parts'] ?? []))25 }, is_array($entry['parts'] ?? null) ? wp_unslash($entry['parts']) : []) 26 26 ]; 27 }, wp_unslash( (array) sanitize_text_field(json_encode($_SESSION['dairect_chat_history'] ?? []))))27 }, wp_unslash($_SESSION['dairect_chat_history'])) 28 28 : []; 29 29 30 // Line 27 over-sanitized too31 30 $firstMsg = isset($session_raw[0]['parts'][0]['text']) 32 31 ? sanitize_text_field($session_raw[0]['parts'][0]['text'])
Note: See TracChangeset
for help on using the changeset viewer.