dbxapp
4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
dbxapp.de
Portal
Start
Anwender
Entwickler
KI-Bereiche
Loading...
Searching...
No Matches
cms_action_security_test.php
Go to the documentation of this file.
1
<?php
2
3
$root
= dirname(__DIR__);
4
$cms
= file_get_contents(
$root
.
'/include/dbxContent_cms.class.php'
);
5
$seo
= file_get_contents(
$root
.
'/include/dbxContent_seo.class.php'
);
6
$lng
= file_get_contents(dirname(__DIR__, 2) .
'/dbxContent/include/dbxContentLngSync.class.php'
);
7
8
$fail
=
static
function
(
string
$message,
int
$code): void {
9
fwrite(STDERR,
"FAIL: $message\n"
);
10
exit
($code);
11
};
12
13
if
(!is_string(
$cms
) || !is_string(
$seo
) || !is_string(
$lng
)) {
14
$fail
(
'Content-Quellen konnten nicht gelesen werden.'
, 1);
15
}
16
17
foreach
(array(
$cms
,
$seo
) as
$source
) {
18
if
(strpos(
$source
,
"private const ACTION_TOKEN_SCOPE = 'dbxContent_admin.actions'"
) ===
false
19
|| strpos(
$source
,
'check_action_token(self::ACTION_TOKEN_SCOPE, $token)'
) ===
false
) {
20
$fail
(
'CMS oder SEO nutzt nicht die gemeinsame Tokenbehandlung.'
, 2);
21
}
22
}
23
24
$cmsActions
= array(
25
'cms_save'
,
26
'cms_new_page'
,
27
'cms_duplicate_page'
,
28
'cms_delete_page'
,
29
'cms_move_node'
,
30
'cms_upload'
,
31
'cms_delete_media'
,
32
'cms_assign_media'
,
33
'cms_sort_media'
,
34
);
35
foreach
(
$cmsActions
as $action) {
36
if
(strpos(
$cms
,
"'"
. $action .
"'"
) ===
false
) {
37
$fail
(
'Schreibende CMS-Aktion fehlt in der Tokenliste: '
. $action, 3);
38
}
39
}
40
41
if
(strpos(
$cms
,
"if (\$action === 'cms_media')"
) ===
false
42
|| strpos(
$cms
,
"get_modul_var('sync', 0, 'int') === 1"
) ===
false
43
|| strpos(
$cms
,
'if ($this->action_requires_token($action) && !$this->check_action_token($action))'
) ===
false
) {
44
$fail
(
'Der gemischte Medienendpunkt oder die zentrale Dispatch-Pruefung ist ungeschuetzt.'
, 4);
45
}
46
47
if
(strpos(
$seo
,
"if (\$action === 'seo_save' && !\$this->check_action_token(\$action))"
) ===
false
) {
48
$fail
(
'SEO-Speichern wird nicht vor dem Dispatch tokengeprueft.'
, 5);
49
}
50
51
if
(preg_match(
'/\b(?:PRAGMA|ALTER\s+TABLE|CREATE\s+(?:TABLE|INDEX))\b/i'
,
$cms
) === 1
52
|| preg_match(
'/\b(?:PRAGMA|ALTER\s+TABLE|CREATE\s+(?:TABLE|INDEX))\b/i'
,
$lng
) === 1) {
53
$fail
(
'Ein normaler Content-Request enthaelt weiterhin Laufzeit-DDL.'
, 6);
54
}
55
56
echo
"OK CMS action security and DD ownership\n"
;
$fail
$fail
Definition
cms_action_security_test.php:8
$seo
$seo
Definition
cms_action_security_test.php:5
$lng
$lng
Definition
cms_action_security_test.php:6
$cmsActions
if(!is_string( $cms)||!is_string( $seo)||!is_string( $lng)) foreach(array($cms, $seo) as $source) $cmsActions
Definition
cms_action_security_test.php:24
$root
$root
Definition
db_access_boundary_test.php:3
$fail
$fail
Definition
dbxActionTokenAutomation_test.php:6
$source
$source
Definition
dbxCmsEditorPerformance_contract_test.php:4
$cms
$cms
Definition
dbxCmsMediaMaintenancePerformance_contract_test.php:5
exit
exit
Definition
index.php:146
dbx
modules
dbxContent_admin
tests
cms_action_security_test.php
Generated by
1.17.0