If you navigate to a user's login history page at /user/%user/login_history, the report shows data from all users. It looks like login_history_menu() passes an argument to login_history_report_callback(), but that argument is not in the function signature, nor is it used to refine the query.

This may be a potential security issue if you allow users to "View own login history", since the user will then have access to potentially sensitive data from all users.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

a_thakur’s picture

The attached patch resolves the issue. Please review and test it. The attached screen shots shows the results.

greggles’s picture

Looks good to me.

star-szr’s picture

FileSize
846 bytes

Thanks for the patch @a_thakur. This patch fixes the user-specific reports, but unfortunately it also breaks the global login report.

Warning: Missing argument 1 for login_history_report_callback() in login_history_report_callback() (line 11 of login_history/includes/login_history.pages.inc).
Notice: Undefined variable: account in login_history_report_callback() (line 28 of login_history/includes/login_history.pages.inc).
Notice: Trying to get property of non-object in login_history_report_callback() (line 28 of login_history/includes/login_history.pages.inc).

Here's a new patch to fix this bug. This patch only adjusts the menu callback and leaves the menu path as is to be addressed in #1707200: Change user login history menu item to use a dash instead of an underscore. Feel free to open a new documentation issue for the @file docblocks, that way we can keep things a bit more separated and easier to review.

As with my other patches, #1691474: Convert files to unix line endings has been applied first.

a_thakur’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the revised patch Cottser, I had suspected that I had missed that particular setting which I believe had caused to error to appear when the login history report was viewed from "Report" menu item in the admin menu.

The patch works fine.

star-szr’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 7.x-1.x in bdec4d4, moving to 6.x for backport.

star-szr’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.22 KB

Here's a patch for the D6 version. Not as clean unfortunately, no DBTNG :)

I tested the per-user reports at user/%uid/login_history and the overall report at admin/reports/login-history.

star-szr’s picture

Status: Needs review » Fixed

Commited to 6.x-1.x in 87cd227.

a_thakur’s picture

Version: 6.x-1.x-dev » 7.x-1.0-beta1
Status: Fixed » Needs work

The bug still persists in 7.x-1.0-beta1 branch.

star-szr’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Status: Needs work » Fixed

@a_thakur - I'll be tagging a new beta release in the near future. For now, please use the dev version.

star-szr’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev

Actually, this should go back to 6.x…

star-szr’s picture

@a_thakur - I just created the release for 7.x-1.0-beta2, should be available for download within 24 hours now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.