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
@@ -1,7 +1,7 @@
<div class="mainContentContainer" style="top:100px">
<div class="pageTitle"><?php echo $pageTitle;?></div>
<form method="post" action="<?php echo base_url();?>services/service-process">
<input type="hidden" name ="service_id" value="<?php echo $selectedItem->service_id;?>">
<input type="hidden" name ="service_id" value=\"<?php echo htmlspecialchars($selectedItem->service_id, ENT_QUOTES, 'UTF-8');?>\">
<div class="formRow">
<label class="formTitle">Típus</label>
<select class="formDropdownBox" style="padding:0;" name="service_type">
@@ -11,47 +11,47 @@
</div>
<div class="formRow">
<label class="formTitle">Kategória (NO)</label>
<input type="text" class="formInputBox" name="service_category_no" value="<?php echo $selectedItem->service_category_no;?>">
<input type="text" class="formInputBox" name="service_category_no" value=\"<?php echo htmlspecialchars($selectedItem->service_category_no, ENT_QUOTES, 'UTF-8');?>\">
</div>
<div class="formRow">
<label class="formTitle">Kategória (EN)</label>
<input type="text" class="formInputBox" name="service_category_en" value="<?php echo $selectedItem->service_category_en;?>">
<input type="text" class="formInputBox" name="service_category_en" value=\"<?php echo htmlspecialchars($selectedItem->service_category_en, ENT_QUOTES, 'UTF-8');?>\">
</div>
<div class="formRow">
<label class="formTitle">Kategória (HU)</label>
<input type="text" class="formInputBox" name="service_category_hu" value="<?php echo $selectedItem->service_category_hu;?>">
<input type="text" class="formInputBox" name="service_category_hu" value=\"<?php echo htmlspecialchars($selectedItem->service_category_hu, ENT_QUOTES, 'UTF-8');?>\">
</div>
<div class="formRow">
<label class="formTitle">Megnevezés (NO)</label>
<input type="text" class="formInputBox" name="service_name_no" value="<?php echo $selectedItem->service_name_no;?>">
<input type="text" class="formInputBox" name="service_name_no" value=\"<?php echo htmlspecialchars($selectedItem->service_name_no, ENT_QUOTES, 'UTF-8');?>\">
</div>
<div class="formRow">
<label class="formTitle">Megnevezés (EN)</label>
<input type="text" class="formInputBox" name="service_name_en" value="<?php echo $selectedItem->service_name_en;?>">
<input type="text" class="formInputBox" name="service_name_en" value=\"<?php echo htmlspecialchars($selectedItem->service_name_en, ENT_QUOTES, 'UTF-8');?>\">
</div>
<div class="formRow">
<label class="formTitle">Megnevezés (HU)</label>
<input type="text" class="formInputBox" name="service_name_hu" value="<?php echo $selectedItem->service_name_hu;?>">
<input type="text" class="formInputBox" name="service_name_hu" value=\"<?php echo htmlspecialchars($selectedItem->service_name_hu, ENT_QUOTES, 'UTF-8');?>\">
</div>
<div class="formRow">
<label class="formTitle">Leírás (NO)</label>
<input type="text" class="formInputBox" name="service_description_no" value="<?php echo $selectedItem->service_description_no;?>">
<input type="text" class="formInputBox" name="service_description_no" value=\"<?php echo htmlspecialchars($selectedItem->service_description_no, ENT_QUOTES, 'UTF-8');?>\">
</div>
<div class="formRow">
<label class="formTitle">Leírás (EN)</label>
<input type="text" class="formInputBox" name="service_description_en" value="<?php echo $selectedItem->service_description_en;?>">
<input type="text" class="formInputBox" name="service_description_en" value=\"<?php echo htmlspecialchars($selectedItem->service_description_en, ENT_QUOTES, 'UTF-8');?>\">
</div>
<div class="formRow">
<label class="formTitle">Leírás (HU)</label>
<input type="text" class="formInputBox" name="service_description_hu" value="<?php echo $selectedItem->service_description_hu;?>">
<input type="text" class="formInputBox" name="service_description_hu" value=\"<?php echo htmlspecialchars($selectedItem->service_description_hu, ENT_QUOTES, 'UTF-8');?>\">
</div>
<div class="formRow">
<label class="formTitle">Szolgáltatás ára</label>
<input type="number" class="formInputBox" name="service_price" value="<?php echo $selectedItem->service_price;?>">
<input type="number" class="formInputBox" name="service_price" value=\"<?php echo htmlspecialchars($selectedItem->service_price, ENT_QUOTES, 'UTF-8');?>\">
</div>
<div class="formRow">
<label class="formTitle">Szolgáltatás időtartama</label>
<input type="time" class="formInputBox" name="service_time" value="<?php echo $selectedItem->service_time;?>">
<input type="time" class="formInputBox" name="service_time" value=\"<?php echo htmlspecialchars($selectedItem->service_time, ENT_QUOTES, 'UTF-8');?>\">
</div>
<div class="formRow">
<label class="formTitle">Szolgáltatás kategória</label>
@@ -59,7 +59,7 @@
<?php
if(!empty($serviceCategories)){
foreach($serviceCategories as $serviceCategoryItem){
echo '<option value="'.$serviceCategoryItem->service_category_id.'" '.($selectedItem->service_category_id == $serviceCategoryItem->service_category_id?' selected':'').'>'.$serviceCategoryItem->serv_cat_name.'</option>';
echo '<option value="'.$serviceCategoryItem->service_category_id.'" '.($selectedItem->service_category_id == $serviceCategoryItem->service_category_id?' selected':'').'>'.htmlspecialchars($serviceCategoryItem->serv_cat_name, ENT_QUOTES, 'UTF-8').'</option>';
}
}
?>