Fix file upload security, bind_param mismatch, and cookie flags
- upload_attachment.php: derive stored file extension from validated MIME type instead of user-supplied filename, preventing executable extension attacks (e.g. a PHP file renamed to evil.txt would now be stored as .txt) - CustomFieldModel.php: fix bind_param type string in updateDefinition() 'sssssiiiii' (10 chars) → 'sssssiiii' (9 chars) to match 9 SQL placeholders - RateLimitMiddleware.php: replace MD5 with SHA256 for rate limit file hashing - user_preferences.php: add httponly, secure, samesite=Lax flags to ticketsPerPage cookie to prevent XSS/CSRF cookie theft Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (!in_array($key, $validKeys)) continue;
|
||||
$prefsModel->setPreference($userId, $key, $value);
|
||||
if ($key === 'rows_per_page') {
|
||||
setcookie('ticketsPerPage', $value, time() + (86400 * 365), '/');
|
||||
setcookie('ticketsPerPage', $value, ['expires' => time() + (86400 * 365), 'path' => '/', 'httponly' => true, 'secure' => true, 'samesite' => 'Lax']);
|
||||
}
|
||||
}
|
||||
echo json_encode(['success' => true]);
|
||||
|
||||
Reference in New Issue
Block a user