dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
shop_admin_action_security_test.php
Go to the documentation of this file.
1<?php
2
3$shopRoot = dirname(__DIR__);
4$adminFile = dirname(__DIR__, 2) . '/dbxShop_admin/include/dbxShopAdmin.class.php';
5$admin = file_get_contents($adminFile);
6
7$fail = static function (string $message, int $code): void {
8 fwrite(STDERR, "FAIL: $message\n");
9 exit($code);
10};
11
12if (!is_string($admin)) {
13 $fail('Shop-Admin-Quelle konnte nicht gelesen werden.', 1);
14}
15
16if (strpos($admin, "private const ACTION_TOKEN_SCOPE = 'dbxShop_admin.actions'") === false
17 || strpos($admin, 'action_token(self::ACTION_TOKEN_SCOPE)') === false
18 || strpos($admin, 'check_action_token(self::ACTION_TOKEN_SCOPE, $token)') === false) {
19 $fail('Die zentrale Shop-Admin-Tokenbehandlung fehlt.', 2);
20}
21
23 'assign_media',
24 'product_tree_move',
25 'install',
26 'remove_image',
27 'export_channel',
28 'product_report_action',
29 'delete_order',
30 'withdrawal_status',
31 'order_quick_action',
32 'send_status_mail',
33 'order_invoice_pdf',
34);
35foreach ($protectedActions as $action) {
36 if (strpos($admin, "checkActionToken('" . $action . "')") === false) {
37 $fail('Shop-Admin-Aktion ist nicht tokengeprueft: ' . $action, 3);
38 }
39}
40
41if (strpos($admin, "'install_url' => \$this->actionUrl(") === false
42 || strpos($admin, '$treeMoveUrl = str_replace(\'&\', \'&amp;\', $this->actionUrl(') === false
43 || strpos($admin, '$invoicePdfUrl = $this->actionUrl(') === false
44 || strpos($admin, "\$report->_action = \$this->actionUrl('?dbx_modul=dbxShop_admin&dbx_run1=products')") === false) {
45 $fail('Mindestens ein schreibender Shop-Admin-Link wird ohne Token erzeugt.', 4);
46}
47
48if (strpos($admin, 'private bool $maintenanceMode = false;') === false
49 || strpos($admin, 'private function maintainShopAdminContent(): void') === false
50 || strpos($admin, '$this->maintainShopAdminContent();') === false
51 || substr_count($admin, 'if (!$this->maintenanceMode)') < 2) {
52 $fail('Shop-Hilfen oder Medienpflege sind nicht auf den Wartungslauf begrenzt.', 5);
53}
54
55if (substr_count($admin, '$this->ensureCmsShopMediaFolder();') !== 1
56 || substr_count($admin, '$this->syncShopMediaUsage();') !== 3) {
57 $fail('Ein normaler Shop-Admin-GET fuehrt weiterhin Medienpflege aus.', 6);
58}
59
60echo "OK shop admin action security\n";
exit
Definition index.php:146
if(!is_string( $admin)) if(strpos($admin, "private const ACTION_TOKEN_SCOPE = 'dbxShop_admin.actions'")===false||strpos($admin, 'action_token(self::ACTION_TOKEN_SCOPE)')===false||strpos($admin, 'check_action_token(self::ACTION_TOKEN_SCOPE, $token)')===false) $protectedActions