Skip to content

Commit 18a5aab

Browse files
committed
Mitigate CSRF on notification #216
1 parent 85dd299 commit 18a5aab

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Professional support for Rdiffweb is available by contacting [IKUS Soft](https:/
112112
This releases include a security fix. If you are using an earlier version, you should upgrade to this release immediately.
113113

114114
* Support MarkupSafe<3 for Debian bookworm
115+
* Mitigate CSRF on user's notification settings #216 [CVE-2022-3233](https://nvd.nist.gov/vuln/detail/CVE-2022-3233)
115116

116117
## 2.4.5 (2002-09-16)
117118

Diff for: rdiffweb/controller/pref_notification.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
import logging
2323

24+
import cherrypy
25+
2426
from rdiffweb.controller import Controller, validate_int
2527
from rdiffweb.tools.i18n import ugettext as _
2628

@@ -45,7 +47,7 @@ def _handle_set_notification_info(self, **kwargs):
4547

4648
def render_prefs_panel(self, panelid, action=None, **kwargs): # @UnusedVariable
4749
# Process the parameters.
48-
if action == "set_notification_info":
50+
if cherrypy.request.method == 'POST' and action == "set_notification_info":
4951
self._handle_set_notification_info(**kwargs)
5052

5153
params = {

Diff for: rdiffweb/controller/tests/test_page_prefs.py

+12
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,18 @@ def test_update_notification(self):
139139
repo_obj = self.app.store.get_user(self.USERNAME).get_repo(self.REPO)
140140
self.assertEqual(7, repo_obj.maxage)
141141

142+
def test_update_notification_method_get(self):
143+
# Given a user with repositories
144+
# When trying to update notification with GET method
145+
self.getPage("/prefs/notification?action=set_notification_info&testcases=7")
146+
# Then page return with success
147+
self.assertStatus(200)
148+
# Then page doesn't update values
149+
self.assertNotInBody('Notification settings updated successfully.')
150+
# Then database is not updated
151+
repo_obj = self.app.store.get_user(self.USERNAME).get_repo(self.REPO)
152+
self.assertEqual(0, repo_obj.maxage)
153+
142154
def test_get_page(self):
143155
self.getPage("/prefs/", method='GET')
144156
self.assertInBody("SSH")

0 commit comments

Comments
 (0)