Merge pull request #9538 from JakubOnderka/access-log-action-column

fix: [internal] Raise size for access_logs action column
pull/9543/head
Jakub Onderka 2024-01-31 17:01:37 +01:00 committed by GitHub
commit 629335c54c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 8 deletions

2
PyMISP

@ -1 +1 @@
Subproject commit 190f82923687cebaf06138724e7c03239e529cb4
Subproject commit dd628a7fe10699ce9efdf2bc9fa7d6d1c1dc484a

View File

@ -86,7 +86,7 @@ class AppModel extends Model
99 => false, 100 => false, 101 => false, 102 => false, 103 => false, 104 => false,
105 => false, 106 => false, 107 => false, 108 => false, 109 => false, 110 => false,
111 => false, 112 => false, 113 => true, 114 => false, 115 => false, 116 => false,
117 => false, 118 => false
117 => false, 118 => false, 119 => false,
);
const ADVANCED_UPDATES_DESCRIPTION = array(
@ -2006,6 +2006,9 @@ class AppModel extends Model
case 118:
$sqlArray[] = "ALTER TABLE `event_reports` MODIFY `content` mediumtext;";
break;
case 119:
$sqlArray[] = "ALTER TABLE `access_logs` MODIFY `action` varchar(191) NOT NULL";
break;
case 'fixNonEmptySharingGroupID':
$sqlArray[] = 'UPDATE `events` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';
$sqlArray[] = 'UPDATE `attributes` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';
@ -4018,6 +4021,12 @@ class AppModel extends Model
*/
public function _remoteIp()
{
static $remoteIp;
if ($remoteIp) {
return $remoteIp;
}
$clientIpHeader = Configure::read('MISP.log_client_ip_header');
if ($clientIpHeader && isset($_SERVER[$clientIpHeader])) {
$headerValue = $_SERVER[$clientIpHeader];
@ -4025,9 +4034,12 @@ class AppModel extends Model
if (($commaPos = strpos($headerValue, ',')) !== false) {
$headerValue = substr($headerValue, 0, $commaPos);
}
return trim($headerValue);
$remoteIp = trim($headerValue);
} else {
$remoteIp = $_SERVER['REMOTE_ADDR'] ?? null;
}
return $_SERVER['REMOTE_ADDR'] ?? null;
return $remoteIp;
}
public function find($type = 'first', $query = array())
@ -4060,7 +4072,7 @@ class AppModel extends Model
return false;
}
public function checkParam($param)
private function checkParam($param)
{
return preg_match('/^[\w\_\-\. ]+$/', $param);
}

View File

@ -115,10 +115,10 @@
"column_name": "action",
"is_nullable": "NO",
"data_type": "varchar",
"character_maximum_length": "20",
"character_maximum_length": "191",
"numeric_precision": null,
"collation_name": "utf8mb4_unicode_ci",
"column_type": "varchar(20)",
"column_type": "varchar(191)",
"column_default": null,
"extra": ""
},
@ -9702,5 +9702,5 @@
"uuid": false
}
},
"db_version": "118"
"db_version": "119"
}