Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong identity fetched and missing auth calls #513

Closed
mworrell opened this issue Jan 9, 2019 · 0 comments
Closed

Wrong identity fetched and missing auth calls #513

mworrell opened this issue Jan 9, 2019 · 0 comments
Labels

Comments

@mworrell
Copy link
Contributor

mworrell commented Jan 9, 2019

In https://github.com/driebit/ginger/blob/master/modules/mod_ginger_base/controllers/controller_auth.erl#L100 the function claims to return some identity information for an user with id Id. In fact it is returning the identity with id Id, which probably belongs to a completely other user (and might even contain secrets that shouldn't be shared).

user(Id, Context) ->
    #{ <<"identity">> => proplists:delete(propb, m_identity:get(Id, Context))
     , <<"resource">> => m_ginger_rest:rsc(Id, Context)
     }.

Besides that this controller authenticates an user by setting internal Zotonic properties in the session. This bypasses the z_auth:logon_pw/2 or z_auth:logon/2 routines.

The internal routines should be called, as they enable observers to hook into the login process and correctly initialize the session and/or set cookies (an example is the device-id for rate limiting).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants