Prevent unauthorized access to device graphs

Users could access info for the wrong device by piggyback on port permissions
This commit is contained in:
Jellyfrog
2020-06-30 13:35:45 +02:00
parent 4da411c839
commit 659325d5d0
2 changed files with 7 additions and 3 deletions

View File

@@ -72,6 +72,12 @@ class DeviceController extends Controller
if ($current_tab == 'port') {
$vars = Url::parseLegacyPath($request->path());
$port = Port::findOrFail($vars->get('port'));
// This prevents users from traversal device id's by piggybacking on the auth for the specified port
if ($port->device_id !== $device_id) {
abort(404);
}
$this->authorize('view', $port);
} else {
$this->authorize('view', $device);