This is an automated email from the ASF dual-hosted git repository. vatamane pushed a commit to branch replicator-ignore-other-cookies in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 798bb5975120a5c30c3555cd13e88fadbbb6ab23 Author: Nick Vatamaniuc <[email protected]> AuthorDate: Mon May 12 13:35:24 2025 -0400 Ignore extraneous cookie in replicator session plugin Previously, the replictor session plugin emitted an error log line if it found only non-`AuthSession` cookies in the headers. It turns out, as we saw in #1851, some proxies can set their own cookies, and so CouchDb replicator should expect and skip over those without generating excessive log noise. Fix #1851 --- src/couch_replicator/src/couch_replicator_auth_session.erl | 12 +++++++++++- 1 file changed, 11 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 182e3cc86..8f0be0a1d 100644 --- a/src/couch_replicator/src/couch_replicator_auth_session.erl +++ b/src/couch_replicator/src/couch_replicator_auth_session.erl @@ -379,7 +379,7 @@ parse_cookie(Headers) -> {error, cookie_not_found}; [_ | _] = Cookies -> case get_auth_session_cookies_and_age(Cookies) of - [] -> {error, cookie_format_invalid}; + [] -> {error, cookie_not_found}; [{Cookie, MaxAge} | _] -> {ok, MaxAge, Cookie} end end. @@ -800,4 +800,14 @@ get_auth_session_cookies_and_age_test() -> ]) ). +parse_cookie_test() -> + NotFound = {error, cookie_not_found}, + ?assertEqual(NotFound, parse_cookie([])), + ?assertEqual(NotFound, parse_cookie([{"abc", "def"}])), + ?assertEqual(NotFound, parse_cookie([{"set-cookiee", "c=v"}])), + ?assertEqual(NotFound, parse_cookie([{"set-cookie", ""}])), + ?assertEqual(NotFound, parse_cookie([{"Set-cOokie", "c=v"}])), + ?assertEqual({ok, undefined, "x"}, parse_cookie([{"set-cookie", "authsession=x"}])), + ?assertEqual({ok, 4, "x"}, parse_cookie([{"set-cookie", "authsession=x; max-age=4"}])). + -endif.
