Skip to content

Commit e974df7

Browse files
committed
Mitigate CSRF on user's settings #221
1 parent 39e7dcd commit e974df7

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

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
* Generate a new session on login and 2FA #220
115+
* Mitigate CSRF on user's settings #221
115116

116117
## 2.4.6 (2022-09-20)
117118

rdiffweb/controller/pref_general.py

+13-12
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,19 @@ def render_prefs_panel(self, panelid, action=None, **kwargs): # @UnusedVariable
116116
# Process the parameters.
117117
profile_form = UserProfileForm(email=self.app.currentuser.email)
118118
password_form = UserPasswordForm()
119-
if action == "set_profile_info":
120-
self._handle_set_profile_info(action, profile_form)
121-
elif action == "set_password":
122-
self._handle_set_password(action, password_form)
123-
elif action == "update_repos":
124-
self.app.currentuser.refresh_repos(delete=True)
125-
flash(_("Repositories successfully updated"), level='success')
126-
elif action is None:
127-
pass
128-
else:
129-
_logger.warning("unknown action: %s", action)
130-
raise cherrypy.NotFound("Unknown action")
119+
if cherrypy.request.method == 'POST':
120+
if action == "set_profile_info":
121+
self._handle_set_profile_info(action, profile_form)
122+
elif action == "set_password":
123+
self._handle_set_password(action, password_form)
124+
elif action == "update_repos":
125+
self.app.currentuser.refresh_repos(delete=True)
126+
flash(_("Repositories successfully updated"), level='success')
127+
elif action is None:
128+
pass
129+
else:
130+
_logger.warning("unknown action: %s", action)
131+
raise cherrypy.NotFound("Unknown action")
131132
params = {
132133
'profile_form': profile_form,
133134
'password_form': password_form,

0 commit comments

Comments
 (0)