diff --git a/app/Controllers/AppContentManagementController.php b/app/Controllers/AppContentManagementController.php index e13732b2..a3db36ec 100755 --- a/app/Controllers/AppContentManagementController.php +++ b/app/Controllers/AppContentManagementController.php @@ -247,7 +247,7 @@ class AppContentManagementController extends AdminController 'errors' => [ 'required' => 'Type is required', 'max_length' => 'Type cannot exceed 255 characters', - 'regex_match' => 'Type contains invalid characters' + 'regex_match' => 'Type can contain only letters, numbers, spaces, _ and -' ] ], 'content_section' => [ @@ -255,7 +255,7 @@ class AppContentManagementController extends AdminController 'errors' => [ 'required' => 'Content Section is required', 'max_length' => 'Content Section cannot exceed 255 characters', - 'regex_match' => 'Content Section contains invalid characters' + 'regex_match' => 'Content Section can contain only letters, numbers, spaces, _ and -' ] ], 'heading' => [ @@ -263,7 +263,7 @@ class AppContentManagementController extends AdminController 'errors' => [ 'required' => 'Heading is required', 'max_length' => 'Heading cannot exceed 255 characters', - 'regex_match' => 'Heading contains invalid characters. Only letters, numbers, spaces and basic punctuation are allowed' + 'regex_match' => 'Heading can contain only letters, numbers, spaces, and these characters: . , ; : ! ? ( ) & / -' ] ], 'content' => [ @@ -465,18 +465,22 @@ class AppContentManagementController extends AdminController if ($method === 'post') { $rules = [ 'category' => [ - 'rules' => 'required|max_length[100]|alpha_numeric_space', + // Allow letters, numbers, spaces and / - . , " ' + 'rules' => 'required|max_length[100]|regex_match[/^[a-zA-Z0-9 \\/\\-\\.\,\"\\\']+$/]', 'errors' => [ - 'required' => 'Category is required', - 'max_length' => 'Category cannot exceed 100 characters', - 'alpha_numeric_space' => 'Category contains invalid characters' + 'required' => 'Category is required', + 'max_length' => 'Category cannot exceed 100 characters', + 'regex_match' => 'Category can contain only letters, numbers, spaces, and these characters: / - . , " \'', + ] ], 'question' => [ - 'rules' => 'required|max_length[1000]', + // Allow only letters, numbers, spaces and basic punctuation . , ; : ! ? ( ) & / - + 'rules' => 'required|max_length[1000]|regex_match[/^[a-zA-Z0-9 _\\-.,;:!?()&\\/]+$/]', 'errors' => [ 'required' => 'Question is required', 'max_length' => 'Question cannot exceed 1000 characters', + 'regex_match' => 'Question can contain only letters, numbers, spaces, and these characters: . , ; : ! ? ( ) & / -', ] ], 'answer' => [ @@ -779,17 +783,18 @@ class AppContentManagementController extends AdminController * The `/i` flag makes the search case-insensitive. */ $dangerous_patterns = [ - '/<\s*script/i', // + '/<\s*object/i', // + '/<\s*embed/i', // + '/<\s*applet/i', // + '/on\w+\s*=/i', // on...= (e.g., onclick=, onmouseover=, onerror=) '/data\s*:\s*text\/html/i', // data:text/html - '/expression\s*\(/i', // CSS expression() + '/expression\s*\(/i', // CSS expression() + '/\balert\s*\(/i', // alert(...) ]; // Loop through the patterns and check if any of them exist in the decoded string. diff --git a/app/Views/cd_master_add_modal.php b/app/Views/cd_master_add_modal.php index 9ff01a91..c8bf0f05 100644 --- a/app/Views/cd_master_add_modal.php +++ b/app/Views/cd_master_add_modal.php @@ -129,7 +129,7 @@ if(res.status == true){ $('#cd_ac_no_for_cd_master_errorr').text(res.message); - // toastr.warning(res.message, 'warning'); + // toastr.warning(res.message, 'Warning'); // $('#cd_ac_no').val(''); $('#cd_master_btn_Submit').prop('disabled',true); return; diff --git a/app/Views/client_branch.php b/app/Views/client_branch.php index 97d8161a..17fcf49d 100755 --- a/app/Views/client_branch.php +++ b/app/Views/client_branch.php @@ -697,7 +697,7 @@ $('body').on('click', '.btnBranchEdit', function() { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -916,10 +916,10 @@ function removeClientBranch(element) { // console.log(res.status == true); if (res) { if (res.status == true) { - toastr.success(res.message, 'success'); + toastr.success(res.message, 'Success'); location.reload(); } else { - toastr.warning(res.message, 'warning'); + toastr.warning(res.message, 'Warning'); } } }, diff --git a/app/Views/client_kyc.php b/app/Views/client_kyc.php index 6a8a0259..c8a43c29 100755 --- a/app/Views/client_kyc.php +++ b/app/Views/client_kyc.php @@ -377,7 +377,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); diff --git a/app/Views/faq_list.php b/app/Views/faq_list.php index f8991b21..aed8bbcb 100644 --- a/app/Views/faq_list.php +++ b/app/Views/faq_list.php @@ -376,6 +376,24 @@ } + // Simple client-side XSS pattern check to give instant feedback + function hasUnsafeHtml(html) { + if (!html) return false; + + const decoded = $('