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

2FA Prevents dashboard from being embedded #14446

Closed
jmumby opened this issue May 13, 2019 · 4 comments · Fixed by #14657
Closed

2FA Prevents dashboard from being embedded #14446

jmumby opened this issue May 13, 2019 · 4 comments · Fixed by #14657
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@jmumby
Copy link

jmumby commented May 13, 2019

When embedding as follows.

https://test.innocraft.cloud/index.php?module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&idSite=8&period=week&date=yesterday&token_auth=xxxxxxxx

Widgets are not displayed in the iFrame, only website and segment selector.

image

This issue occurs when a non-authenticated user attempts to view the embed. If the user is logged in the view behaves as expected.

@Findus23 Findus23 added the Bug For errors / faults / flaws / inconsistencies etc. label May 14, 2019
@mattab mattab added this to the 3.11.0 milestone Jun 18, 2019
@katebutler katebutler self-assigned this Jul 8, 2019
@mattab
Copy link
Member

mattab commented Jul 9, 2019

Current behavior

iframe embedded widgetized reports don't load when 2FA is activated for the user with this token_auth.

Expected behavior instead

When a widgetize/report iframe embedding request is received by Matomo, and it has a valid token_auth parameter, and Two factor auth is enabled for this user, then we expect reports to embed correctly (no 2fa token required).

@katebutler
Copy link

The error is arising from an XHR call which is sending back the 2FA token validation page instead of the expected JSON response. XHR calls with module=API skip 2FA validation (see Request class and TwoFactorAuth). Others do not and will be rejected, causing the page to fail to render.

@mattab
Copy link
Member

mattab commented Jul 9, 2019

Proposal

  • Prevent 2fa user to use Embedding report feature
  • When a user has 2fa enabled, then module=Widgetize requests should issue a friendly reminder "Embedding reports is not supported because Two-Factor auth is enabled. Please consider create a new user, give it only read only permissions to the website, disable two-factor auth for this user."
  • when a Matomo instance has 2fa forced across all users, then as a side effect embedding reports would be completely disabled since all users would be required to have 2fa... This may be a BC break for some.
  • would be great to also update the user guide https://matomo.org/docs/embed-matomo-reports/ with best practises, and other tweaks.

@tsteur
Copy link
Member

tsteur commented Jul 10, 2019

@mattab the embedded widgets should definitely work with token_auth. There's no reason it shouldn't work as the same data could be requested through the API with 2FA. And in Matomo 4 we will replace the token_auth with some app specific token or so which will then also have the same behaviour.

2fa user should be able to use Embedding report feature for sure.

There should be already some logic in there for this that any authentication through token_auth should be fine, also for widgets (I had tested this) but maybe there's some other problem with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants