Close the critical holes found in the security audit
- .htaccess: 404 for dotfiles (.git etc.), logs/dumps/archives, composer files, vendor/, documents/, archive/ - Pages::ajax: changeUserStatus, checkUser and refreshLogMonitor now require a logged-in admin or module user; the operator is logged from the session, not the request - Public worker JSON only returns worker_id and worker_name (no ntfy topic or calendar ID) - Admin: the five worker-schedule methods now redirect to login without a session Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3569539376
commit
3440188c0f
@@ -130,6 +130,7 @@ class Admin extends CI_Controller {
|
||||
}
|
||||
|
||||
public function worker_schedule_overrides() {
|
||||
$this->_requireLogin();
|
||||
$this->load->model('Service_model');
|
||||
$data['currentUser'] = $this->User_model->getUserByUsername($_SESSION['username']);
|
||||
$data['workerSchedules'] = $this->Service_model->getWorkerScheduleOverrides();
|
||||
@@ -139,6 +140,7 @@ class Admin extends CI_Controller {
|
||||
}
|
||||
|
||||
public function admin_worker_schedule() {
|
||||
$this->_requireLogin();
|
||||
$this->load->helper('url');
|
||||
$this->load->model('User_model');
|
||||
$this->load->model('Service_model');
|
||||
@@ -174,6 +176,7 @@ class Admin extends CI_Controller {
|
||||
}
|
||||
|
||||
public function store_worker_schedule() {
|
||||
$this->_requireLogin();
|
||||
$this->load->model('Service_model');
|
||||
$this->load->helper('url');
|
||||
|
||||
@@ -212,6 +215,7 @@ class Admin extends CI_Controller {
|
||||
|
||||
|
||||
public function manage_worker_schedule($worker_id = null) {
|
||||
$this->_requireLogin();
|
||||
$this->load->model('Service_model');
|
||||
$data['workers'] = $this->Service_model->getAllWorkers();
|
||||
$data['selectedWorker'] = null;
|
||||
@@ -226,6 +230,7 @@ class Admin extends CI_Controller {
|
||||
}
|
||||
|
||||
public function save_worker_schedule() {
|
||||
$this->_requireLogin();
|
||||
$this->load->model('Service_model');
|
||||
|
||||
$worker_id = $this->input->post('worker_id');
|
||||
@@ -1358,6 +1363,20 @@ class Admin extends CI_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop here unless an admin is logged in. Every public method of this
|
||||
* controller is reachable at /admin/<method> through CodeIgniter's default
|
||||
* routing, routed or not, so each one must check the session itself.
|
||||
*/
|
||||
private function _requireLogin(){
|
||||
$this->load->helper('url');
|
||||
$this->load->model('User_model');
|
||||
if(empty($_SESSION['username']) || !is_object($this->User_model->getUserByUsername($_SESSION['username']))){
|
||||
header("Location:".SITEURL."login");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
private function _ntfy($title, $message, $workerTopic = null){
|
||||
$this->config->load('google_calendar');
|
||||
$evelinTopic = $this->config->item('ntfy_topic');
|
||||
|
||||
Reference in New Issue
Block a user