Navigation Menu

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

Overriding nonce verification in the login form #1636

Closed
anonymous-matomo-user opened this issue Aug 23, 2010 · 2 comments
Closed

Overriding nonce verification in the login form #1636

anonymous-matomo-user opened this issue Aug 23, 2010 · 2 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Milestone

Comments

@anonymous-matomo-user
Copy link

To enable direct login to Piwik from my Virtualmin Piwik plugin, I am posting pre-set username-password combinations to Piwik through a frame. Cookies are be preserved (client-side) by pre-loading Piwik in a hidden iframe. However, it gets stuck with nonce validation inside the Login module where the nonce is checked against a form variable.

This works perfectly when nonce verification is bypassed.

- if(Piwik_Nonce::verifyNonce('Piwik_Login.login', $nonce))
+ if(true || Piwik_Nonce::verifyNonce('Piwik_Login.login', $nonce))

I have seen and worked around similar security checks in phpMyAdmin. But there's one noticible difference between Piwik and phpMyAdmin. Unlike Piwik, phpMyAdmin checks for the token in a cookie variable.

Nobody would want nonce check removed including me. However, it would be great if Piwik supports third-party/framed logins without any patches or implementation of just another full-featured login module. Ideally, I am thinking about two possible ways around this:

  1. A new API method which would supply a nonce to trusted third-party scripts.
+ UsersManager.getAuthNonce (userLogin, clientUserAgent)
  1. Rellocating the nonce from login form to a cookie. (By setting proper privacy headers, cookies from iframe'd sites can be preserved on client side. But form variables from inside iframe cannot be accessed.)
- $nonce = $form->getSubmitValue('form_nonce');
+ $nonce = $_COOKIE['auth_nonce'];

I would also like draw your attention to the issues users had recently with double requests from browsers/add-ons (see [1236]). Rellocating nonce to a short-lived cookie would most probably make a permanent solution to such future issues as well.

I am asking for this help here because the plugin I am working on is going to be released for public. Hence, I would prefer an official way to authenticate rather than patching or making complex additions to Piwik source.

@robocoder
Copy link
Contributor

Use the Login module's logme() method.

@anonymous-matomo-user
Copy link
Author

Wow, its already implemented. Thanks!

@anonymous-matomo-user anonymous-matomo-user added this to the Piwik 0.9.9 - Stable release milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

2 participants