Skip to content

Commit

Permalink
* security: For user restore from backup, the user additionally must …
Browse files Browse the repository at this point in the history
…have the Delete permission (since data are initially removed before restoring from the backup file)

git-svn-id: svn+ssh://svn.izzysoft.de/public/phpvideopro/trunk@2607 4b860ef2-653a-0410-b28f-a1f29e8e3dd0
  • Loading branch information
IzzySoft committed Feb 20, 2009
1 parent d18e560 commit 8447c08
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#==================================================[ Check authorization ]===
if (!$pvp->auth->browse) kickoff();
if ($mode=="restore" && !$pvp->auth->add) kickoff();
if ($mode=="restore" && !($pvp->auth->add && $pvp->auth->delete)) kickoff();

#=======================================================[ Little Helpers ]===
#----------------------------------------------------[ Purge old backups ]---
Expand Down
9 changes: 7 additions & 2 deletions help/de/configuration.inc
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,16 @@ damit ein neues Untermenü im Menü <i>*edit#</i> verfügbar.
<b>*permit_userbackup_download#:</b> Über den damit aktivierten Menüpunkt wird
ein Backup aller Filmdaten des Benutzers generiert, welches sodann automatisch
heruntergeladen wird. Das Backup wird nicht auf dem Server gespeichert. Dies
entspricht dem auf den Benutzer beschränkten Backup über das Admin-Menü.
entspricht dem auf den Benutzer beschränkten Backup über das Admin-Menü. Um den
entsprechenden Menüpunkt angezeigt zu bekommen, benötigt der Benutzer zumindest
Leserechte.

[text]
<b>*permit_userbackup_store#:</b> Auch hiermit wird ein Menüpunkt analog zum
vorigen erstellt, das Backup ist ebenfalls identisch - nur wird es nicht zum
Benutzer übertragen, sondern stattdessen im konfigurierten Backup-Verzeichnis
abgelegt. Dies erfordert allerdings, dass der Webserver-Prozess auf selbiges
schreibend zugreifen kann.
schreibend zugreifen kann. Der Benutzer benötigt wiederum zumindest Leserechte.

[text]
<b>*permit_userbackup_restore#</b>: Dies ist das Gegenstück zum vorigen Punkt,
Expand All @@ -322,6 +324,9 @@ Server gespeicherten Backup. Natürlich ist hier Vorsorge getroffen, dass weder
Die Backup-Datei muss speziell für diesen Benutzer erstellt worden sein, es
werden nur Daten aus dieser Datei importiert, die dem Benutzer gehör(t)en, und
diese werden auch explizit nur in die Datensammlung des Benutzers übernommen.
Außerdem muss der Benutzer über die Privilegien <i>Hinzufügen</i> sowie
<i>Löschen</i> verfügen - da hier zunächst alle Filmdaten des Benutzers entfernt
und anschließend aus dem Backup neu angelegt werden.

[text]
<b>*max_user_backups#:</b> Zwar mag Plattenplatz nicht mehr unbedingt ein
Expand Down
10 changes: 7 additions & 3 deletions help/en/configuration.inc
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,15 @@ available to the users in a new submenu of the <i>*edit#</i> menu.
start a backup with. The backup file will then be sent to the browser, so the
user can download and store it on the local disk. Nothing will be stored on the
server this way - and the backup corresponds to the user-restricted backup an
admin can create on the <i>*backup_db#</i> page.
admin can create on the <i>*backup_db#</i> page. To see this menu item, the user
at least requires the <i>Browse</i> (<i>Read</i>) privilege.

[text]
<b>*permit_userbackup_store#:</b> The menu item provided here is similar to the
one just discussed. The difference is that the backup will be stored on the
server (in the configured backup directory) - which of course requires that
directory to be writable by the web server process. No backup data will be sent
to the user here.
to the user here, but he still at least requires the <i>Browse</i> privilege.

[text]
<b>*permit_userbackup_restore#</b>: The opposite of the previous item. This
Expand All @@ -289,7 +290,10 @@ application makes sure the user cannot import (or overwrite) foreign data: The
backup file must be made especially for this user (either via the previously
discussed menu item, or via the <i>*backup_db#</i> page), only data belonging
to the user will be processed (so renaming the file does not do it), and
everything will be restored explicitly to the users collection.
everything will be restored explicitly to the users collection. This requires
the user to have at least the <i>Add</i> and <i>Delete</i> privileges, since
the corresponding data will first be completely removed and then replaced by the
contents of the backup file.

[text]
<b>*max_user_backups#:</b> Though disk space should not be the big deal today,
Expand Down
2 changes: 1 addition & 1 deletion inc/config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#=============================================================[ database ]===
$database["type"] = "mysql"; # mysql|pgsql
$database["host"] = "localhost"; # your hosts name
$database["database"] = "pvptest"; # what database holds the tables
$database["database"] = "videopro"; # what database holds the tables
$database["user"] = "video"; # db user with at least following
# privileges on these tables:
# SELECT,UPDATE,INSERT,DELETE
Expand Down
6 changes: 3 additions & 3 deletions inc/newmenue.inc
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ function createjsDOMenu() {
}
?>
editMenu.items.newMovie.setSubMenu(newMovies);
<? } if (($pvp->auth->add && $pvp->config->user_backup_restore) || ($pvp->auth->browse && ($pvp->config->user_backup_store||$pvp->config->user_backup_download))) { ?>
<? } $backup_writable = is_writable($backup_path); if (($pvp->auth->add && $pvp->auth->delete && $pvp->config->user_backup_restore) || ($backup_writable && $pvp->auth->browse && ($pvp->config->user_backup_store||$pvp->config->user_backup_download))) { ?>
userBackups = new jsDOMenu();
<? if ($pvp->auth->browse && $pvp->config->user_backup_store) { ?>
<? if ($pvp->auth->browse && $pvp->config->user_backup_store && $backup_writable) { ?>
userBackups.addMenuItem(new menuItem("<?=lang('user_backup_store')?>","store_backup","<?=$pvp->link->slink($base_url."backup.php?mode=save")?>"));
userBackups.items.store_backup.showIcon("backup");
<? } if ($pvp->auth->browse && $pvp->config->user_backup_download) { ?>
userBackups.addMenuItem(new menuItem("<?=lang('user_backup_download')?>","download_backup","<?=$pvp->link->slink($base_url."backup.php?mode=download")?>"));
userBackups.items.download_backup.showIcon("download");
<? } if ($pvp->auth->add && $pvp->config->user_backup_restore) { ?>
<? } if ($pvp->auth->add && $pvp->auth->delete && $pvp->config->user_backup_restore) { ?>
userBackups.addMenuItem(new menuItem("<?=lang('user_backup_restore')?>","restore_backup","<?=$pvp->link->slink($base_url."backup.php?mode=restore")?>"));
userBackups.items.restore_backup.showIcon("restore");

Expand Down

0 comments on commit 8447c08

Please sign in to comment.