From 09ee5a667c18d22682eff5451fe6f7b76e645eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 1 Aug 2023 17:46:22 +0300 Subject: [PATCH 1/5] sentry update --- composer.lock | 103 ++++++++++++++++++++++++++++++++-------------- config/sentry.php | 6 --- 2 files changed, 73 insertions(+), 36 deletions(-) diff --git a/composer.lock b/composer.lock index 6fc7c3955..e15ec1409 100644 --- a/composer.lock +++ b/composer.lock @@ -4951,16 +4951,16 @@ }, { "name": "laravel/framework", - "version": "v10.16.1", + "version": "v10.17.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "5c93d2795c393b462481179ce42dedfb30cc19b5" + "reference": "a0e3f5ac5b6258f6ede9a2a2c5cc3820baea24a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/5c93d2795c393b462481179ce42dedfb30cc19b5", - "reference": "5c93d2795c393b462481179ce42dedfb30cc19b5", + "url": "https://api.github.com/repos/laravel/framework/zipball/a0e3f5ac5b6258f6ede9a2a2c5cc3820baea24a2", + "reference": "a0e3f5ac5b6258f6ede9a2a2c5cc3820baea24a2", "shasum": "" }, "require": { @@ -4978,11 +4978,12 @@ "ext-tokenizer": "*", "fruitcake/php-cors": "^1.2", "guzzlehttp/uri-template": "^1.0", + "laravel/prompts": "^0.1", "laravel/serializable-closure": "^1.3", "league/commonmark": "^2.2.1", "league/flysystem": "^3.8.0", "monolog/monolog": "^3.0", - "nesbot/carbon": "^2.62.1", + "nesbot/carbon": "^2.67", "nunomaduro/termwind": "^1.13", "php": "^8.1", "psr/container": "^1.1.1|^2.0.1", @@ -5061,7 +5062,6 @@ "mockery/mockery": "^1.5.1", "orchestra/testbench-core": "^8.4", "pda/pheanstalk": "^4.0", - "phpstan/phpdoc-parser": "^1.15", "phpstan/phpstan": "^1.4.7", "phpunit/phpunit": "^10.0.7", "predis/predis": "^2.0.2", @@ -5147,7 +5147,55 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-07-26T03:30:46+00:00" + "time": "2023-08-01T14:08:45+00:00" + }, + { + "name": "laravel/prompts", + "version": "v0.1.1", + "source": { + "type": "git", + "url": "https://github.com/laravel/prompts.git", + "reference": "309b30157090a63c40152aa912d198d6aeb60ea6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/prompts/zipball/309b30157090a63c40152aa912d198d6aeb60ea6", + "reference": "309b30157090a63c40152aa912d198d6aeb60ea6", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "illuminate/collections": "^10.0", + "php": "^8.1", + "symfony/console": "^6.2" + }, + "require-dev": { + "mockery/mockery": "^1.5", + "pestphp/pest": "^2.3", + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-mockery": "^1.1" + }, + "suggest": { + "ext-pcntl": "Required for the spinner to be animated." + }, + "type": "library", + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Laravel\\Prompts\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "support": { + "issues": "https://github.com/laravel/prompts/issues", + "source": "https://github.com/laravel/prompts/tree/v0.1.1" + }, + "time": "2023-07-31T15:03:02+00:00" }, { "name": "laravel/sanctum", @@ -9075,16 +9123,16 @@ }, { "name": "psy/psysh", - "version": "v0.11.19", + "version": "v0.11.20", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "1724ceff278daeeac5a006744633bacbb2dc4706" + "reference": "0fa27040553d1d280a67a4393194df5228afea5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/1724ceff278daeeac5a006744633bacbb2dc4706", - "reference": "1724ceff278daeeac5a006744633bacbb2dc4706", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/0fa27040553d1d280a67a4393194df5228afea5b", + "reference": "0fa27040553d1d280a67a4393194df5228afea5b", "shasum": "" }, "require": { @@ -9145,9 +9193,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.11.19" + "source": "https://github.com/bobthecow/psysh/tree/v0.11.20" }, - "time": "2023-07-15T19:42:19+00:00" + "time": "2023-07-31T14:32:22+00:00" }, { "name": "ralouphie/getallheaders", @@ -9691,16 +9739,16 @@ }, { "name": "sentry/sentry", - "version": "3.20.1", + "version": "3.21.0", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "644ad9768c18139a80ac510090fad000d9ffd8a4" + "reference": "624aafc22b84b089ffa43b71fb01e0096505ec4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/644ad9768c18139a80ac510090fad000d9ffd8a4", - "reference": "644ad9768c18139a80ac510090fad000d9ffd8a4", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/624aafc22b84b089ffa43b71fb01e0096505ec4f", + "reference": "624aafc22b84b089ffa43b71fb01e0096505ec4f", "shasum": "" }, "require": { @@ -9744,11 +9792,6 @@ "monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler." }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.13.x-dev" - } - }, "autoload": { "files": [ "src/functions.php" @@ -9780,7 +9823,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-php/issues", - "source": "https://github.com/getsentry/sentry-php/tree/3.20.1" + "source": "https://github.com/getsentry/sentry-php/tree/3.21.0" }, "funding": [ { @@ -9792,20 +9835,20 @@ "type": "custom" } ], - "time": "2023-06-26T11:01:40+00:00" + "time": "2023-07-31T15:31:24+00:00" }, { "name": "sentry/sentry-laravel", - "version": "3.7.0", + "version": "3.7.1", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-laravel.git", - "reference": "f6f64312a13f1b801e570713e857cdb83896e58b" + "reference": "d1b21a9552db12016d3aeb15f6e6188a03a5dd87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/f6f64312a13f1b801e570713e857cdb83896e58b", - "reference": "f6f64312a13f1b801e570713e857cdb83896e58b", + "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/d1b21a9552db12016d3aeb15f6e6188a03a5dd87", + "reference": "d1b21a9552db12016d3aeb15f6e6188a03a5dd87", "shasum": "" }, "require": { @@ -9870,7 +9913,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-laravel/issues", - "source": "https://github.com/getsentry/sentry-laravel/tree/3.7.0" + "source": "https://github.com/getsentry/sentry-laravel/tree/3.7.1" }, "funding": [ { @@ -9882,7 +9925,7 @@ "type": "custom" } ], - "time": "2023-07-31T11:54:22+00:00" + "time": "2023-08-01T10:02:58+00:00" }, { "name": "simple-icons/simple-icons", diff --git a/config/sentry.php b/config/sentry.php index 2030a3bd8..87cd2e3af 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -43,9 +43,6 @@ return [ // Capture Livewire components as breadcrumbs 'livewire' => env('SENTRY_BREADCRUMBS_LIVEWIRE_ENABLED', true), - // Capture storage access as breadcrumbs - 'storage' => env('SENTRY_BREADCRUMBS_STORAGE_ENABLED', true), - // Capture SQL queries as breadcrumbs 'sql_queries' => env('SENTRY_BREADCRUMBS_SQL_QUERIES_ENABLED', true), @@ -78,9 +75,6 @@ return [ // Capture views rendered as spans 'views' => env('SENTRY_TRACE_VIEWS_ENABLED', true), - // Capture storage access as spans - 'storage' => env('SENTRY_TRACE_STORAGE_ENABLED', true), - // Capture Livewire components as spans 'livewire' => env('SENTRY_TRACE_LIVEWIRE_ENABLED', true), From 8b305a94c3d8791e1afa8b417bc49de6365d3495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Thu, 3 Aug 2023 00:29:12 +0300 Subject: [PATCH 2/5] improved too many emails for firewall --- .../Email/TellFirewallTooManyEmailsSent.php | 40 +------------------ config/firewall.php | 18 +++++++++ tests/Feature/Email/TooManyEmailsSentTest.php | 4 +- 3 files changed, 22 insertions(+), 40 deletions(-) diff --git a/app/Listeners/Email/TellFirewallTooManyEmailsSent.php b/app/Listeners/Email/TellFirewallTooManyEmailsSent.php index 933923aad..c8264385c 100644 --- a/app/Listeners/Email/TellFirewallTooManyEmailsSent.php +++ b/app/Listeners/Email/TellFirewallTooManyEmailsSent.php @@ -5,7 +5,6 @@ namespace App\Listeners\Email; use Akaunting\Firewall\Events\AttackDetected; use Akaunting\Firewall\Traits\Helper; use App\Events\Email\TooManyEmailsSent as Event; -use Illuminate\Support\Facades\Config; class TellFirewallTooManyEmailsSent { @@ -17,9 +16,7 @@ class TellFirewallTooManyEmailsSent $this->middleware = 'too_many_emails_sent'; $this->user_id = $event->user_id; - $this->loadConfig(); - - if ($this->skip($event)) { + if ($this->skip()) { return; } @@ -28,40 +25,7 @@ class TellFirewallTooManyEmailsSent event(new AttackDetected($log)); } - public function loadConfig(): void - { - if (! empty(Config::get('firewall.middleware.' . $this->middleware))) { - return; - } - - $config = array_merge_recursive( - Config::get('firewall'), - [ - 'middleware' => [ - $this->middleware => [ - 'enabled' => env('FIREWALL_MIDDLEWARE_' . strtoupper($this->middleware) . '_ENABLED', Config::get('firewall.enabled', true)), - - 'methods' => ['post'], - - 'routes' => [ - 'only' => [], // i.e. 'contact' - 'except' => [], // i.e. 'admin/*' - ], - - 'auto_block' => [ - 'attempts' => env('FIREWALL_MIDDLEWARE_' . strtoupper($this->middleware) . '_AUTO_BLOCK_ATTEMPTS', 20), - 'frequency' => 1 * 60, // 1 minute - 'period' => 30 * 60, // 30 minutes - ], - ], - ], - ] - ); - - Config::set('firewall', $config); - } - - public function skip($event): bool + public function skip(): bool { if ($this->isDisabled()) { return true; diff --git a/config/firewall.php b/config/firewall.php index 214bfd7a5..149a86aeb 100644 --- a/config/firewall.php +++ b/config/firewall.php @@ -436,6 +436,24 @@ return [ ], ], + // Custom middleware + 'too_many_emails_sent' => [ + 'enabled' => env('FIREWALL_MIDDLEWARE_TOO_MANY_EMAILS_SENT_ENABLED', env('FIREWALL_ENABLED', true)), + + 'methods' => ['post'], + + 'routes' => [ + 'only' => [], // i.e. 'contact' + 'except' => [], // i.e. 'admin/*' + ], + + 'auto_block' => [ + 'attempts' => env('FIREWALL_MIDDLEWARE_TOO_MANY_EMAILS_SENT_AUTO_BLOCK_ATTEMPTS', 20), + 'frequency' => 1 * 60, // 1 minute + 'period' => 30 * 60, // 30 minutes + ], + ], + ], ]; diff --git a/tests/Feature/Email/TooManyEmailsSentTest.php b/tests/Feature/Email/TooManyEmailsSentTest.php index 120f81e72..60ddbb9ac 100644 --- a/tests/Feature/Email/TooManyEmailsSentTest.php +++ b/tests/Feature/Email/TooManyEmailsSentTest.php @@ -11,7 +11,7 @@ class TooManyEmailsSentTest extends FeatureTestCase { $this->loginAs(); - config(['firewall.enabled' => true]); + config(['firewall.middleware.too_many_emails_sent.enabled' => true]); for ($i = 0; $i < 19; $i++) { event(new TooManyEmailsSent(user_id())); @@ -31,7 +31,7 @@ class TooManyEmailsSentTest extends FeatureTestCase { $this->loginAs(); - config(['firewall.enabled' => true]); + config(['firewall.middleware.too_many_emails_sent.enabled' => true]); for ($i = 0; $i < 20; $i++) { event(new TooManyEmailsSent(user_id())); From c4c1e7489e03a5b03bfdbec04a88c7d0a9314c76 Mon Sep 17 00:00:00 2001 From: Merve Karaman Date: Thu, 3 Aug 2023 11:19:32 +0300 Subject: [PATCH 3/5] Wizard spacing control --- resources/assets/js/views/wizard/Finish.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/resources/assets/js/views/wizard/Finish.vue b/resources/assets/js/views/wizard/Finish.vue index 075fb2645..cb75fec9a 100644 --- a/resources/assets/js/views/wizard/Finish.vue +++ b/resources/assets/js/views/wizard/Finish.vue @@ -20,16 +20,16 @@ -
- +
+

{{ item.name }} - +

-
+
@@ -49,7 +49,7 @@
From bfc6578ed65fa065dc7ec354f1dc99a33d379e8c Mon Sep 17 00:00:00 2001 From: Merve Karaman Date: Thu, 3 Aug 2023 11:21:43 +0300 Subject: [PATCH 4/5] Once clicked the second click is blocked --- resources/views/components/documents/show/send.blade.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/views/components/documents/show/send.blade.php b/resources/views/components/documents/show/send.blade.php index 8dab77b2e..992a3f502 100644 --- a/resources/views/components/documents/show/send.blade.php +++ b/resources/views/components/documents/show/send.blade.php @@ -28,7 +28,9 @@ @if (! $hideMarkSent) @can($permissionUpdate) @if ($document->status == 'draft') - + {{ trans($textMarkSent) }} @else From 1e2137c451b48a899df7cbb09da14dc8db53ea3e Mon Sep 17 00:00:00 2001 From: Merve Karaman Date: Tue, 8 Aug 2023 15:04:19 +0300 Subject: [PATCH 5/5] Loading animation added to button. --- resources/views/components/index/bulkaction/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/components/index/bulkaction/index.blade.php b/resources/views/components/index/bulkaction/index.blade.php index 34b71fc77..0a507184b 100644 --- a/resources/views/components/index/bulkaction/index.blade.php +++ b/resources/views/components/index/bulkaction/index.blade.php @@ -81,7 +81,7 @@ @click="onActionBulkAction" class="relative flex items-center justify-center bg-green hover:bg-green-700 text-white px-6 py-1.5 text-base rounded-lg disabled:bg-green-100" > - + {{ trans('general.confirm') }}