From: thevlad at gmail.com (thevlad at gmail.com)
Subject: [PATCH] Encode value and field before calculating cookie digest, the same way secure_value() does
Date: Thu, 12 Apr 2018 20:54:31 +0300 [thread overview]
Message-ID: <20180412175431.33587-1-thevlad@gmail.com> (raw)
From: Vlad Safronov <thevlad at gmail.com>
Bugfix: Encode value and field before calculating cookie digest, the same way as secure_value() does
so validating will work correctly on encoded values.
---
filters/simple-authentication.lua | 2 ++
1 file changed, 2 insertions(+)
diff --git a/filters/simple-authentication.lua b/filters/simple-authentication.lua
index de34d09..b40a819 100644
--- a/filters/simple-authentication.lua
+++ b/filters/simple-authentication.lua
@@ -230,6 +230,8 @@ function validate_value(expected_field, cookie)
return nil
end
+ value = url_encode(value)
+ field = url_encode(field)
-- Lua hashes strings, so these comparisons are time invariant.
if hmac ~= crypto.hmac.digest("sha1", field .. "|" .. value .. "|" .. tostring(expiration) .. "|" .. salt, secret) then
return nil
--
2.17.0
next reply other threads:[~2018-04-12 17:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-12 17:54 thevlad [this message]
2018-06-16 16:28 ` john
[not found] ` <CALR6X0_NbTSKE0DPDoni7H6M6d1HoXco=PBCJQRQOeVZGaGwZw@mail.gmail.com>
[not found] ` <20180617175023.GM1922@john.keeping.me.uk>
2018-06-17 19:03 ` thevlad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180412175431.33587-1-thevlad@gmail.com \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).