Security hardening: fix SQLi, XSS, file upload, and migrate DB to RDS

- Fix all SQL injection vulnerabilities across Service_model, User_model,
  Module_model, Log_model, and Admin controller using parameterized queries
- Add htmlspecialchars() to all user-controlled output in admin views
  (bookings, services, workers, service categories, login form)
- Fix XSS in AJAX worker response and manage-booking-cancelled view
- Add file extension whitelist (jpg, jpeg, png, gif, webp) to all uploads
- Remove webshell (pentest2.php) from assets/img/profiles/
- Stop logging plaintext passwords on failed login attempts
- Migrate database.php hostname from localhost to AWS RDS endpoint
- Fix dropdown styling (white-on-white) in worker calendar view

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ubuntu
2026-05-07 13:00:32 +00:00
co-authored by Claude Opus 4.6
parent 307f17faa6
commit 420bcb37fd
20 changed files with 205 additions and 194 deletions
+11 -7
View File
@@ -121,10 +121,10 @@ class Pages extends CI_Controller {
$workerListShow .= '<label for="worker_'.$workerItem->worker_id.'">';
$workerListShow .= '<div class="profileRow">';
$workerListShow .= '<div class="profileCell profileRadioBtn"><input type="radio" name="worker_radio" class="workers" id="worker_'.$workerItem->worker_id.'" onclick="setWorker('.$workerItem->worker_id.')" '.($workerIndex==0?'checked':'').'></div>';
$workerListShow .= '<div class="profileCell profileImage"><img src="'.SITEURL.'assets/img/'.$workerItem->worker_profile_img.'"></div>';
$workerListShow .= '<div class="profileCell profileImage"><img src="'.SITEURL.'assets/img/'.htmlspecialchars($workerItem->worker_profile_img, ENT_QUOTES, 'UTF-8').'"></div>';
$workerListShow .= '<div class="profileCell">';
$workerListShow .= '<div class="profileName">'.$workerItem->worker_name.'</div>';
$workerListShow .= '<div class="profileDescription">'.$workerItem->worker_info.'</div>';
$workerListShow .= '<div class="profileName">'.htmlspecialchars($workerItem->worker_name, ENT_QUOTES, 'UTF-8').'</div>';
$workerListShow .= '<div class="profileDescription">'.htmlspecialchars($workerItem->worker_info, ENT_QUOTES, 'UTF-8').'</div>';
$workerListShow .= '</div>';
$workerListShow .= '</div>';
$workerListShow .= '</label>';
@@ -231,8 +231,8 @@ class Pages extends CI_Controller {
if(is_object($result)){
?>
<div class="serviceBookingprofileImage" style="background-image:url('<?php echo SITEURL.'assets/img/'.$result->worker_profile_img;?>');"></div>
<div class="serviceBookingprofileName"><?php echo $result->worker_name;?></div>
<div class="serviceBookingprofileImage" style="background-image:url('<?php echo SITEURL.'assets/img/'.htmlspecialchars($result->worker_profile_img, ENT_QUOTES, 'UTF-8');?>');"></div>
<div class="serviceBookingprofileName"><?php echo htmlspecialchars($result->worker_name, ENT_QUOTES, 'UTF-8');?></div>
<?php
@@ -620,8 +620,12 @@ class Pages extends CI_Controller {
$target_dir = getcwd()."/assets/img/profiles/";
$target_file = $target_dir . str_replace('.','_', str_replace('@','_',$_SESSION['username']));
$imageFileType = strtolower(pathinfo(basename($_FILES["profile_img"]["name"]),PATHINFO_EXTENSION));
if (move_uploaded_file($_FILES["profile_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
$allowedTypes = array('jpg', 'jpeg', 'png', 'gif', 'webp');
if (!in_array($imageFileType, $allowedTypes)) {
$data['message'] = 'Csak képfájlok engedélyezettek (jpg, png, gif, webp)!';
$data['message_class'] = 'errorMessage';
} elseif (move_uploaded_file($_FILES["profile_img"]["tmp_name"], $target_file.'.'.$imageFileType)) {
$data['message'] = 'A profilkép sikeresen feltöltve!';
$data['message_class'] = 'successMessage';
$data['profile_img_url'] = 'assets/img/profiles/'.str_replace('.','_', str_replace('@','_',$_SESSION['username'])).'.'.$imageFileType;