You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2020/01/14 16:41:03 UTC
[couchdb] branch replicator-session-ignore-other-cookies created
(now 259e566)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a change to branch replicator-session-ignore-other-cookies
in repository https://gitbox.apache.org/repos/asf/couchdb.git.
at 259e566 Ignore other cookies in replication auth session plugin
This branch includes the following new commits:
new 259e566 Ignore other cookies in replication auth session plugin
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[couchdb] 01/01: Ignore other cookies in replication auth session
plugin
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch replicator-session-ignore-other-cookies
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 259e566ad1d872d8bf914b730dbc3f7e6102eac2
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Tue Jan 14 11:34:19 2020 -0500
Ignore other cookies in replication auth session plugin
If we somehow get any other cookies in don't spam the logs with error messages.
---
src/couch_replicator/src/couch_replicator_auth_session.erl | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/couch_replicator/src/couch_replicator_auth_session.erl b/src/couch_replicator/src/couch_replicator_auth_session.erl
index 30f499a..7e66c50 100644
--- a/src/couch_replicator/src/couch_replicator_auth_session.erl
+++ b/src/couch_replicator/src/couch_replicator_auth_session.erl
@@ -461,7 +461,7 @@ parse_cookie(Headers0) ->
CaseInsKVs = mochiweb_headers:make(CookieKVs),
case mochiweb_headers:get_value("AuthSession", CaseInsKVs) of
undefined ->
- {error, cookie_format_invalid};
+ {error, cookie_not_found};
Cookie ->
MaxAge = parse_max_age(CaseInsKVs),
{ok, MaxAge, Cookie}
@@ -646,6 +646,7 @@ cookie_update_test_() ->
t_process_auth_failure_stale_epoch(),
t_process_auth_failure_too_frequent(),
t_process_ok_update_cookie(),
+ t_process_ok_ignore_other_cookies(),
t_process_ok_no_cookie(),
t_init_state_fails_on_401(),
t_init_state_401_with_require_valid_user(),
@@ -731,6 +732,17 @@ t_process_ok_update_cookie() ->
end).
+t_process_ok_ignore_other_cookies() ->
+ ?_test(begin
+ Headers = [{"set-CookiE", "Other=xyz; Path=/;"}, {"X", "y"}],
+ Res = process_response(200, Headers, 1, #state{}),
+ ?assertMatch({continue, #state{cookie = undefined, epoch = 0}}, Res),
+ State = #state{cookie = "mycookie", epoch = 5},
+ Res2 = process_response(200, Headers, 1, State),
+ ?assertMatch({continue, #state{cookie = "mycookie", epoch = 5}}, Res2)
+ end).
+
+
t_process_ok_no_cookie() ->
?_test(begin
Headers = [{"X", "y"}],