Skip to content

Commit 64d449c

Browse files
committed
Make event rule delete action CSRF protected
1 parent 47e9108 commit 64d449c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

application/controllers/EventRuleController.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,15 @@ public function indexAction(): void
8686
->on(
8787
EventRuleConfigForm::ON_DELETE,
8888
function (EventRuleConfigForm $form) use ($ruleId, $eventRuleConfigValues) {
89-
$form->removeRule((int) $ruleId);
90-
Notification::success(
91-
sprintf(t('Successfully deleted event rule %s'), $eventRuleConfigValues['name'])
92-
);
93-
$this->redirectNow('__CLOSE__');
89+
$csrf = $form->getElement('CSRFToken');
90+
if ($csrf !== null && $csrf->isValid()) {
91+
$form->removeRule((int) $ruleId);
92+
Notification::success(
93+
sprintf(t('Successfully deleted event rule %s'), $eventRuleConfigValues['name'])
94+
);
95+
96+
$this->redirectNow('__CLOSE__');
97+
}
9498
}
9599
)
96100
->handleRequest($this->getServerRequest());

0 commit comments

Comments
 (0)