Skip to content

Commit

Permalink
fix secure issue with user data export
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Jan 19, 2022
1 parent e680e13 commit e17f3e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/MicroweberPackages/User/helpers/api_user.php
Expand Up @@ -65,7 +65,7 @@

api_expose_admin('users/search_authors', function ($params = false) {

$return = array();
$return = array();

$kw = false;
if (isset($params['kw'])) {
Expand Down
11 changes: 11 additions & 0 deletions src/MicroweberPackages/User/routes/api.php
Expand Up @@ -17,6 +17,17 @@

$userId = (int) $request->all()['user_id'];

$allowToExport = false;
if ($userId == user_id()) {
$allowToExport = true;
} else if (is_admin()) {
$allowToExport = true;
}

if ($allowToExport == false) {
return array('error' => 'You are now allowed to export this information.');
}

$exportFromTables = [];
$prefix = mw()->database_manager->get_prefix();
$tablesList = mw()->database_manager->get_tables_list(true);
Expand Down

0 comments on commit e17f3e9

Please sign in to comment.