diff options
author | Mark Sapiro <mark@msapiro.net> | 2017-06-05 20:48:34 -0700 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2017-06-05 20:48:34 -0700 |
commit | 0d11dc90ee6fc9cc61d32ca3ea6819ca95ac1c12 (patch) | |
tree | f7743c3b5fc245e214bc94da3266bd16f9d664e2 /Mailman/Cgi/confirm.py | |
parent | 845dc52970be426af2a766be4609a8bef2bd1c05 (diff) | |
download | mailman2-0d11dc90ee6fc9cc61d32ca3ea6819ca95ac1c12.tar.gz mailman2-0d11dc90ee6fc9cc61d32ca3ea6819ca95ac1c12.tar.xz mailman2-0d11dc90ee6fc9cc61d32ca3ea6819ca95ac1c12.zip |
Defend against CGI requests with multiple values for the same parameter.
Diffstat (limited to 'Mailman/Cgi/confirm.py')
-rw-r--r-- | Mailman/Cgi/confirm.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Mailman/Cgi/confirm.py b/Mailman/Cgi/confirm.py index fec69dd2..1cb640b8 100644 --- a/Mailman/Cgi/confirm.py +++ b/Mailman/Cgi/confirm.py @@ -74,7 +74,7 @@ def main(): # Get the form data to see if this is a second-step confirmation cgidata = cgi.FieldStorage(keep_blank_values=1) try: - cookie = cgidata.getvalue('cookie') + cookie = cgidata.getfirst('cookie') except TypeError: # Someone crafted a POST with a bad Content-Type:. doc.AddItem(Header(2, _("Error"))) @@ -124,17 +124,17 @@ def main(): try: if content[0] == Pending.SUBSCRIPTION: - if cgidata.getvalue('cancel'): + if cgidata.getfirst('cancel'): subscription_cancel(mlist, doc, cookie) - elif cgidata.getvalue('submit'): + elif cgidata.getfirst('submit'): subscription_confirm(mlist, doc, cookie, cgidata) else: subscription_prompt(mlist, doc, cookie, content[1]) elif content[0] == Pending.UNSUBSCRIPTION: try: - if cgidata.getvalue('cancel'): + if cgidata.getfirst('cancel'): unsubscription_cancel(mlist, doc, cookie) - elif cgidata.getvalue('submit'): + elif cgidata.getfirst('submit'): unsubscription_confirm(mlist, doc, cookie) else: unsubscription_prompt(mlist, doc, cookie, *content[1:]) @@ -145,9 +145,9 @@ def main(): # Expunge this record from the pending database. expunge(mlist, cookie) elif content[0] == Pending.CHANGE_OF_ADDRESS: - if cgidata.getvalue('cancel'): + if cgidata.getfirst('cancel'): addrchange_cancel(mlist, doc, cookie) - elif cgidata.getvalue('submit'): + elif cgidata.getfirst('submit'): addrchange_confirm(mlist, doc, cookie) else: # Watch out for users who have unsubscribed themselves in the @@ -161,16 +161,16 @@ def main(): # Expunge this record from the pending database. expunge(mlist, cookie) elif content[0] == Pending.HELD_MESSAGE: - if cgidata.getvalue('cancel'): + if cgidata.getfirst('cancel'): heldmsg_cancel(mlist, doc, cookie) - elif cgidata.getvalue('submit'): + elif cgidata.getfirst('submit'): heldmsg_confirm(mlist, doc, cookie) else: heldmsg_prompt(mlist, doc, cookie, *content[1:]) elif content[0] == Pending.RE_ENABLE: - if cgidata.getvalue('cancel'): + if cgidata.getfirst('cancel'): reenable_cancel(mlist, doc, cookie) - elif cgidata.getvalue('submit'): + elif cgidata.getfirst('submit'): reenable_confirm(mlist, doc, cookie) else: reenable_prompt(mlist, doc, cookie, *content[1:]) @@ -349,20 +349,20 @@ def subscription_confirm(mlist, doc, cookie, cgidata): try: # Some pending values may be overridden in the form. email of # course is hardcoded. ;) - lang = cgidata.getvalue('language') + lang = cgidata.getfirst('language') if not Utils.IsLanguage(lang): lang = mlist.preferred_language i18n.set_language(lang) doc.set_language(lang) if cgidata.has_key('digests'): try: - digest = int(cgidata.getvalue('digests')) + digest = int(cgidata.getfirst('digests')) except ValueError: digest = None else: digest = None userdesc = mlist.pend_confirm(cookie, expunge=False)[1] - fullname = cgidata.getvalue('realname', None) + fullname = cgidata.getfirst('realname', None) if fullname is not None: fullname = Utils.canonstr(fullname, lang) overrides = UserDesc(fullname=fullname, digest=digest, lang=lang) |