dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
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
13if (!is_string($cms) || !is_string($seo) || !is_string($lng)) {
14 $fail('Content-Quellen konnten nicht gelesen werden.', 1);
15}
16
17foreach (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
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);
35foreach ($cmsActions as $action) {
36 if (strpos($cms, "'" . $action . "'") === false) {
37 $fail('Schreibende CMS-Aktion fehlt in der Tokenliste: ' . $action, 3);
38 }
39}
40
41if (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
47if (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
51if (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
56echo "OK CMS action security and DD ownership\n";
if(!is_string( $cms)||!is_string( $seo)||!is_string( $lng)) foreach(array($cms, $seo) as $source) $cmsActions
exit
Definition index.php:146