Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/80#discussion_r35987108
--- Diff: src/couch_httpd_auth.erl ---
@@ -304,12 +310,19 @@ handle_session_req(#httpd{method='POST',
mochi_req=MochiReq}=Req, AuthModule) ->
UserSalt = couch_util:get_value(<<"salt">>, UserProps2),
CurrentTime = make_cookie_time(),
Cookie = cookie_auth_cookie(Req, ?b2l(UserName),
<<Secret/binary, UserSalt/binary>>, CurrentTime),
+ % maybe set the csrf token
+ Cookies = case couch_httpd:qs_value(Req, "csrf", "false") of
--- End diff --
mmm...so we here
1. Enable CSRF protection only by user request, not for the whole server.
What means, that it will be easy to forget to activate that protection.
2. CSRF is not applied for Basic and OAuth authed users and those that
authed using other methods as they don't POST /_session. They could only GET
it, but it's not mandatory.
What are your thoughts about these cases?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---