Merge branch 'cxxxr-fix-csrf-token-check'

This commit is contained in:
Eitaro Fukamachi 2019-03-18 16:16:03 +09:00
commit 3d21b5b622

View file

@ -51,9 +51,12 @@
(csrf-token (gethash *csrf-session-key*
(getf env :lack.session))))
(and csrf-token
(let ((recieved-csrf-token
(let ((received-csrf-token
(cdr (assoc "_csrf_token" (request-body-parameters req) :test #'string=))))
(string= csrf-token recieved-csrf-token)))))
;; for multipart/form-data
(when (listp received-csrf-token)
(setf received-csrf-token (first received-csrf-token)))
(equal csrf-token received-csrf-token)))))
(defun csrf-token (session)
(unless (gethash *csrf-session-key* session)