You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/Console/Commands/InstallModuleCommand.php
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -268,7 +268,7 @@ protected function getPathToZip(string $location): string|null
268
268
if ($isRemote) {
269
269
// Warning about fetching from source
270
270
$host = parse_url($location, PHP_URL_HOST);
271
-
$this->warn("This will download a module from {$host}. Modules can contain code which would have the ability to do anything on the BookStack host server.\nYou should only install modules from trusted sources.");
271
+
$this->warn("\nThis will download a module from:{$host}\n\nModules can contain code which would have the ability to do anything on the BookStack host server.\nYou should only install modules from trusted sources.");
272
272
$trustHost = $this->confirm('Are you sure you trust this source?');
273
273
if (!$trustHost) {
274
274
returnnull;
@@ -286,13 +286,20 @@ protected function getPathToZip(string $location): string|null
286
286
return$this->downloadModuleFile($location);
287
287
}
288
288
289
-
// Validate file and get full location
289
+
// Validate the file and get the full location
290
290
$zipPath = realpath($location);
291
+
291
292
if (!$zipPath || !is_file($zipPath)) {
292
293
$this->error("ERROR: Module file not found at {$location}");
293
294
returnnull;
294
295
}
295
296
297
+
$this->warn("\nThis will install a module from: {$zipPath}\n\nModules can contain code which would have the ability to do anything on the BookStack host server.\nYou should only install modules from trusted sources.");
298
+
$trustHost = $this->confirm('Are you sure you want to install this module?');
->expectsOutput("\nThis will install a module from: {$zip}\n\nModules can contain code which would have the ability to do anything on the BookStack host server.\nYou should only install modules from trusted sources.")
19
+
->expectsConfirmation('Are you sure you want to install this module?', 'yes')
->expectsOutput("This will download a module from example.com. Modules can contain code which would have the ability to do anything on the BookStack host server.\nYou should only install modules from trusted sources.")
40
+
->expectsOutput("\nThis will download a module from: example.com\n\nModules can contain code which would have the ability to do anything on the BookStack host server.\nYou should only install modules from trusted sources.")
39
41
->expectsConfirmation('Are you sure you trust this source?', 'yes')
->expectsOutput("This will download a module from example.com. Modules can contain code which would have the ability to do anything on the BookStack host server.\nYou should only install modules from trusted sources.")
66
+
->expectsOutput("\nThis will download a module from: example.com\n\nModules can contain code which would have the ability to do anything on the BookStack host server.\nYou should only install modules from trusted sources.")
65
67
->expectsConfirmation('Are you sure you trust this source?', 'yes')
66
68
->expectsOutput("You are downloading a module from an insecure HTTP source.\nWe recommend only using HTTPS sources to avoid various security risks.")
67
69
->expectsConfirmation('Are you sure you want to continue without HTTPS?', 'yes')
@@ -142,6 +144,7 @@ public function test_run_with_invalid_zip_has_early_exit()
->expectsConfirmation('Are you sure you want to install this module?', 'yes')
169
174
->expectsOutput("ERROR: Failed to read module metadata with error: Module in folder \"_temp\" has an invalid 'version' format. Expected semantic version format like '1.0.0' or 'v1.0.0'")
170
175
->assertExitCode(1);
171
176
}
@@ -177,6 +182,7 @@ public function test_local_module_install_without_active_theme_can_setup_theme_f
->expectsChoice('What would you like to do?', 'Replace existing module', ['Cancel module install', 'Add alongside existing module', 'Replace existing module'])
@@ -226,6 +234,7 @@ public function test_single_existing_module_with_same_name_cancel()
->expectsChoice('What would you like to do?', 'Cancel module install', ['Cancel module install', 'Add alongside existing module', 'Replace existing module'])
@@ -244,6 +253,7 @@ public function test_single_existing_module_with_same_name_add()
->expectsChoice('What would you like to do?', 'Add alongside existing module', ['Cancel module install', 'Add alongside existing module', 'Replace existing module'])
0 commit comments