Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Add file permissions checks. #11323
James Colebabf9fe96f41
diff --git a/app/Console/Commands/Integrity/ReportSkeleton.php.stub b/app/Console/Commands/Integrity/ReportSkeleton.php.stubdeleted file mode 100644index 5efa56a32a..0000000000--- a/app/Console/Commands/Integrity/ReportSkeleton.php.stub+++ /dev/null@@ -1,26 +0,0 @@-<?php--namespace FireflyIII\Console\Commands\Integrity;--use Illuminate\Console\Command;--class ReportSkeleton extends Command-{-- protected $description = 'DESCRIPTION HERE';-- protected $signature = 'firefly-iii:INT_COMMAND';-- /**- * Execute the console command.- *- * @return int- */- public function handle(): int- {- //- $this->warn('Congrats, you found the skeleton command. Boo!');-- return 0;- }-}diff --git a/app/Console/Commands/Integrity/ReportsIntegrity.php b/app/Console/Commands/Integrity/ReportsIntegrity.phpindex 46e5427ad6..4684738cc9 100644--- a/app/Console/Commands/Integrity/ReportsIntegrity.php+++ b/app/Console/Commands/Integrity/ReportsIntegrity.php@@ -48,6 +48,7 @@ class ReportsIntegrity extends Command$commands = ['integrity:empty-objects','integrity:total-sums',+ 'integrity:file-permissions',];foreach ($commands as $command) {$this->friendlyLine(sprintf('Now executing %s', $command));diff --git a/app/Console/Commands/Integrity/ValidatesFilePermissions.php b/app/Console/Commands/Integrity/ValidatesFilePermissions.phpnew file mode 100644index 0000000000..e3849e6aa1--- /dev/null+++ b/app/Console/Commands/Integrity/ValidatesFilePermissions.php@@ -0,0 +1,70 @@+<?php+/*+ * ValidatesFilePermissions.php+ * Copyright (c) 2025 [email protected]+ *+ * This file is part of Firefly III (https://github.com/firefly-iii).+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <https://www.gnu.org/licenses/>.+ */++namespace FireflyIII\Console\Commands\Integrity;++use FireflyIII\Console\Commands\ShowsFriendlyMessages;+use Illuminate\Console\Command;++class ValidatesFilePermissions extends Command+{+ use ShowsFriendlyMessages;++ /**+ * The name and signature of the console command.+ *+ * @var string+ */+ protected $signature = 'integrity:file-permissions';++ /**+ * The console command description.+ *+ * @var string+ */+ protected $description = 'Command description';++ /**+ * Execute the console command.+ */+ public function handle(): int+ {+ $directories = [storage_path('upload')];+ $errors = false;+ /** @var string $directory */+ foreach ($directories as $directory) {+ if (!is_dir($directory)) {+ $this->friendlyError(sprintf('Directory "%s" cannot found. It is necessary to allow files to be uploaded.', $uploadDir));+ $errors = true;+ continue;+ }+ if (!is_writable($directory)) {+ $this->friendlyError(sprintf('Directory "%s" is not writeable. Uploading attachments may fail silently.', $uploadDir));+ $errors = true;+ }+ }+ if(false === $errors) {+ $this->friendlyInfo('All necessary file paths seem to exist, and are writeable.');+ }++ return self::SUCCESS;+ }+}diff --git a/composer.lock b/composer.lockindex 33b3d4eeda..0f738f9188 100644--- a/composer.lock+++ b/composer.lock@@ -3543,22 +3543,22 @@},{"name": "mailersend/laravel-driver",- "version": "v2.12.0",+ "version": "v2.9.1","source": {"type": "git","url": "https://github.com/mailersend/mailersend-laravel-driver.git",- "reference": "15e1ec41e29e65d3ca226929c65804190aaa93eb"+ "reference": "87fd5ab76808bbaac9221be0d306baef13e98725"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/mailersend/mailersend-laravel-driver/zipball/15e1ec41e29e65d3ca226929c65804190aaa93eb",- "reference": "15e1ec41e29e65d3ca226929c65804190aaa93eb",+ "url": "https://api.github.com/repos/mailersend/mailersend-laravel-driver/zipball/87fd5ab76808bbaac9221be0d306baef13e98725",+ "reference": "87fd5ab76808bbaac9221be0d306baef13e98725","shasum": ""},"require": {"ext-json": "*","illuminate/support": "^9.0 || ^10.0 || ^11.0 || ^12.0",- "mailersend/mailersend": "^0.35.0",+ "mailersend/mailersend": "^0.31.0","nyholm/psr7": "^1.5","php": ">=8.0","php-http/guzzle7-adapter": "^1.0",@@ -3606,28 +3606,29 @@],"support": {"issues": "https://github.com/mailersend/mailersend-laravel-driver/issues",- "source": "https://github.com/mailersend/mailersend-laravel-driver/tree/v2.12.0"+ "source": "https://github.com/mailersend/mailersend-laravel-driver/tree/v2.9.1"},- "time": "2025-10-28T14:59:16+00:00"+ "time": "2025-04-09T09:33:07+00:00"},{"name": "mailersend/mailersend",- "version": "v0.35.0",+ "version": "v0.31.0","source": {"type": "git","url": "https://github.com/mailersend/mailersend-php.git",- "reference": "f1696cf9e727e9503fbc5882d2a111bd966ad276"+ "reference": "513ff83ee768526055ad52987cde401ea7218c67"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/mailersend/mailersend-php/zipball/f1696cf9e727e9503fbc5882d2a111bd966ad276",- "reference": "f1696cf9e727e9503fbc5882d2a111bd966ad276",+ "url": "https://api.github.com/repos/mailersend/mailersend-php/zipball/513ff83ee768526055ad52987cde401ea7218c67",+ "reference": "513ff83ee768526055ad52987cde401ea7218c67","shasum": ""},"require": {"beberlei/assert": "^3.2","ext-json": "*",- "php": "^7.4 || ^8.0 <8.5",+ "illuminate/collections": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0",+ "php": "^7.4|^8.0","php-http/client-common": "^2.2","php-http/discovery": "^1.9","php-http/httplug": "^2.1",@@ -3672,9 +3673,9 @@],"support": {"issues": "https://github.com/mailersend/mailersend-php/issues",- "source": "https://github.com/mailersend/mailersend-php/tree/v0.35.0"+ "source": "https://github.com/mailersend/mailersend-php/tree/v0.31.0"},- "time": "2025-10-28T13:11:43+00:00"+ "time": "2025-04-03T12:16:11+00:00"},{"name": "monolog/monolog",@@ -11239,16 +11240,16 @@},{"name": "nikic/php-parser",- "version": "v5.6.2",+ "version": "v5.7.0","source": {"type": "git","url": "https://github.com/nikic/PHP-Parser.git",- "reference": "3a454ca033b9e06b63282ce19562e892747449bb"+ "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3a454ca033b9e06b63282ce19562e892747449bb",- "reference": "3a454ca033b9e06b63282ce19562e892747449bb",+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82",+ "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82","shasum": ""},"require": {@@ -11291,9 +11292,9 @@],"support": {"issues": "https://github.com/nikic/PHP-Parser/issues",- "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.2"+ "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0"},- "time": "2025-10-21T19:32:17+00:00"+ "time": "2025-12-06T11:56:16+00:00"},{"name": "phar-io/manifest",@@ -12018,16 +12019,16 @@},{"name": "phpunit/phpunit",- "version": "12.5.0",+ "version": "12.5.1","source": {"type": "git","url": "https://github.com/sebastianbergmann/phpunit.git",- "reference": "fef037fe50d20ce826cdbd741b7a2afcdec5f45b"+ "reference": "e33a5132ea24119400f6ce5bce6665922e968bad"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fef037fe50d20ce826cdbd741b7a2afcdec5f45b",- "reference": "fef037fe50d20ce826cdbd741b7a2afcdec5f45b",+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e33a5132ea24119400f6ce5bce6665922e968bad",+ "reference": "e33a5132ea24119400f6ce5bce6665922e968bad","shasum": ""},"require": {@@ -12095,7 +12096,7 @@"support": {"issues": "https://github.com/sebastianbergmann/phpunit/issues","security": "https://github.com/sebastianbergmann/phpunit/security/policy",- "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.0"+ "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.1"},"funding": [{@@ -12119,7 +12120,7 @@"type": "tidelift"}],- "time": "2025-12-05T04:59:40+00:00"+ "time": "2025-12-06T12:19:17+00:00"},{"name": "rector/rector",