A free open source IT asset/license management system
Fixed FD-56927 - upgraded commonmark, added max to comments
snipe66770cfe20cb
diff --git a/app/Http/Controllers/Account/AcceptanceController.php b/app/Http/Controllers/Account/AcceptanceController.phpindex 19d7692447..05ba1348d9 100644--- a/app/Http/Controllers/Account/AcceptanceController.php+++ b/app/Http/Controllers/Account/AcceptanceController.php@@ -98,6 +98,14 @@ class AcceptanceController extends Controllerabort(403, trans('general.insufficient_permissions'));}+ // Bound the note server-side. Unbounded notes were reaching synchronous+ // CommonMark rendering in the acceptance notification email and+ // consuming worker CPU on a per-request basis (defense in depth against+ // the parser CVE; the commonmark bump to 2.9.0 is the primary fix).+ $request->validate([+ 'note' => 'nullable|string|max:1000',+ ]);+$acceptance = CheckoutAcceptance::find($id);if (! $acceptance) {diff --git a/composer.json b/composer.jsonindex 8952d7502a..88d87ef954 100644--- a/composer.json+++ b/composer.json@@ -47,6 +47,7 @@"laravel/socialite": "^5.6","laravel/tinker": "^2.6","laravel/ui": "^4.0",+ "league/commonmark": "^2.9.0","league/csv": "^9.7","league/flysystem-aws-s3-v3": "^3.0","livewire/livewire": "^4.0",diff --git a/composer.lock b/composer.lockindex cec1c93d77..8bf8bc01c5 100644--- a/composer.lock+++ b/composer.lock@@ -4,7 +4,7 @@"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies","This file is @generated automatically"],- "content-hash": "d3d61d9b70fb976c46bafc7120c9f8e6",+ "content-hash": "538ed1d90b81cae1b0410ad6debc5d74","packages": [{"name": "alek13/slack",@@ -1887,25 +1887,26 @@},{"name": "guzzlehttp/guzzle",- "version": "7.10.0",+ "version": "7.15.3","source": {"type": "git","url": "https://github.com/guzzle/guzzle.git",- "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4"+ "reference": "ae311b8f045ea93ce7b1c9cdb7cec06c53f944bc"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4",- "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4",+ "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ae311b8f045ea93ce7b1c9cdb7cec06c53f944bc",+ "reference": "ae311b8f045ea93ce7b1c9cdb7cec06c53f944bc","shasum": ""},"require": {"ext-json": "*",- "guzzlehttp/promises": "^2.3",- "guzzlehttp/psr7": "^2.8",+ "guzzlehttp/promises": "^2.5.2",+ "guzzlehttp/psr7": "^2.13","php": "^7.2.5 || ^8.0","psr/http-client": "^1.0",- "symfony/deprecation-contracts": "^2.2 || ^3.0"+ "symfony/deprecation-contracts": "^2.5 || ^3.0",+ "symfony/polyfill-php80": "^1.25"},"provide": {"psr/http-client-implementation": "1.0"@@ -1913,9 +1914,10 @@"require-dev": {"bamarni/composer-bin-plugin": "^1.8.2","ext-curl": "*",- "guzzle/client-integration-tests": "3.0.2",+ "guzzle/client-integration-tests": "3.0.3",+ "guzzlehttp/test-server": "^0.7","php-http/message-factory": "^1.1",- "phpunit/phpunit": "^8.5.39 || ^9.6.20",+ "phpunit/phpunit": "^8.5.52 || ^9.6.34","psr/log": "^1.1 || ^2.0 || ^3.0"},"suggest": {@@ -1993,7 +1995,7 @@],"support": {"issues": "https://github.com/guzzle/guzzle/issues",- "source": "https://github.com/guzzle/guzzle/tree/7.10.0"+ "source": "https://github.com/guzzle/guzzle/tree/7.15.3"},"funding": [{@@ -2009,28 +2011,29 @@"type": "tidelift"}],- "time": "2025-08-23T22:36:01+00:00"+ "time": "2026-08-05T19:48:21+00:00"},{"name": "guzzlehttp/promises",- "version": "2.3.0",+ "version": "2.5.2","source": {"type": "git","url": "https://github.com/guzzle/promises.git",- "reference": "481557b130ef3790cf82b713667b43030dc9c957"+ "reference": "2823687acff28b2dbe67b2508a6b300e2c3fa4ce"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957",- "reference": "481557b130ef3790cf82b713667b43030dc9c957",+ "url": "https://api.github.com/repos/guzzle/promises/zipball/2823687acff28b2dbe67b2508a6b300e2c3fa4ce",+ "reference": "2823687acff28b2dbe67b2508a6b300e2c3fa4ce","shasum": ""},"require": {- "php": "^7.2.5 || ^8.0"+ "php": "^7.2.5 || ^8.0",+ "symfony/deprecation-contracts": "^2.5 || ^3.0"},"require-dev": {"bamarni/composer-bin-plugin": "^1.8.2",- "phpunit/phpunit": "^8.5.44 || ^9.6.25"+ "phpunit/phpunit": "^8.5.52 || ^9.6.34"},"type": "library","extra": {@@ -2076,7 +2079,7 @@],"support": {"issues": "https://github.com/guzzle/promises/issues",- "source": "https://github.com/guzzle/promises/tree/2.3.0"+ "source": "https://github.com/guzzle/promises/tree/2.5.2"},"funding": [{@@ -2092,27 +2095,29 @@"type": "tidelift"}],- "time": "2025-08-22T14:34:08+00:00"+ "time": "2026-08-05T19:30:54+00:00"},{"name": "guzzlehttp/psr7",- "version": "2.9.0",+ "version": "2.13.0","source": {"type": "git","url": "https://github.com/guzzle/psr7.git",- "reference": "7d0ed42f28e42d61352a7a79de682e5e67fec884"+ "reference": "dad89620b7a6edb60c15858442eb2e408b45d8f4"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/guzzle/psr7/zipball/7d0ed42f28e42d61352a7a79de682e5e67fec884",- "reference": "7d0ed42f28e42d61352a7a79de682e5e67fec884",+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/dad89620b7a6edb60c15858442eb2e408b45d8f4",+ "reference": "dad89620b7a6edb60c15858442eb2e408b45d8f4","shasum": ""},"require": {"php": "^7.2.5 || ^8.0","psr/http-factory": "^1.0","psr/http-message": "^1.1 || ^2.0",- "ralouphie/getallheaders": "^3.0"+ "ralouphie/getallheaders": "^3.0",+ "symfony/deprecation-contracts": "^2.5 || ^3.0",+ "symfony/polyfill-php80": "^1.25"},"provide": {"psr/http-factory-implementation": "1.0",@@ -2120,9 +2125,9 @@},"require-dev": {"bamarni/composer-bin-plugin": "^1.8.2",- "http-interop/http-factory-tests": "0.9.0",+ "http-interop/http-factory-tests": "1.1.0","jshttp/mime-db": "1.54.0.1",- "phpunit/phpunit": "^8.5.44 || ^9.6.25"+ "phpunit/phpunit": "^8.5.52 || ^9.6.34"},"suggest": {"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"@@ -2193,7 +2198,7 @@],"support": {"issues": "https://github.com/guzzle/psr7/issues",- "source": "https://github.com/guzzle/psr7/tree/2.9.0"+ "source": "https://github.com/guzzle/psr7/tree/2.13.0"},"funding": [{@@ -2209,7 +2214,7 @@"type": "tidelift"}],- "time": "2026-03-10T16:41:02+00:00"+ "time": "2026-07-16T22:23:49+00:00"},{"name": "guzzlehttp/uri-template",@@ -3345,16 +3350,16 @@},{"name": "league/commonmark",- "version": "2.8.2",+ "version": "2.10.0","source": {"type": "git","url": "https://github.com/thephpleague/commonmark.git",- "reference": "59fb075d2101740c337c7216e3f32b36c204218b"+ "reference": "d2d1aa8b35e072966c89bc0c66cf926e56767dc4"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/59fb075d2101740c337c7216e3f32b36c204218b",- "reference": "59fb075d2101740c337c7216e3f32b36c204218b",+ "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d2d1aa8b35e072966c89bc0c66cf926e56767dc4",+ "reference": "d2d1aa8b35e072966c89bc0c66cf926e56767dc4","shasum": ""},"require": {@@ -3376,8 +3381,8 @@"github/gfm": "0.29.0","michelf/php-markdown": "^1.4 || ^2.0","nyholm/psr7": "^1.5",- "phpstan/phpstan": "^1.8.2",- "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0",+ "phpstan/phpstan": "^2.0.0",+ "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0 || ^12.0.0 || ^13.0.0","scrutinizer/ocular": "^1.8.1","symfony/finder": "^5.3 | ^6.0 | ^7.0 || ^8.0","symfony/process": "^5.4 | ^6.0 | ^7.0 || ^8.0",@@ -3391,7 +3396,7 @@"type": "library","extra": {"branch-alias": {- "dev-main": "2.9-dev"+ "dev-main": "2.11-dev"}},"autoload": {@@ -3448,7 +3453,7 @@"type": "tidelift"}],- "time": "2026-03-19T13:16:38+00:00"+ "time": "2026-08-11T16:06:25+00:00"},{"name": "league/config",@@ -4793,16 +4798,16 @@},{"name": "nette/utils",- "version": "v4.1.4",+ "version": "v4.1.5","source": {"type": "git","url": "https://github.com/nette/utils.git",- "reference": "7da6c396d7ebe142bc857c20479d5e70a5e1aac7"+ "reference": "b043439dbdf954e6c28b5ea7e34b0100f83165e0"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/nette/utils/zipball/7da6c396d7ebe142bc857c20479d5e70a5e1aac7",- "reference": "7da6c396d7ebe142bc857c20479d5e70a5e1aac7",+ "url": "https://api.github.com/repos/nette/utils/zipball/b043439dbdf954e6c28b5ea7e34b0100f83165e0",+ "reference": "b043439dbdf954e6c28b5ea7e34b0100f83165e0","shasum": ""},"require": {@@ -4822,7 +4827,7 @@},"suggest": {"ext-gd": "to use Image",- "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()",+ "ext-iconv": "to use Strings::chr(), ord() and reverse()","ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()","ext-json": "to use Nette\\Utils\\Json","ext-mbstring": "to use Strings::lower() etc...",@@ -4878,9 +4883,9 @@],"support": {"issues": "https://github.com/nette/utils/issues",- "source": "https://github.com/nette/utils/tree/v4.1.4"+ "source": "https://github.com/nette/utils/tree/v4.1.5"},- "time": "2026-05-11T20:49:54+00:00"+ "time": "2026-07-17T23:02:45+00:00"},{"name": "nikic/php-parser",@@ -8555,16 +8560,16 @@},{"name": "symfony/deprecation-contracts",- "version": "v3.7.0",+ "version": "v3.7.1","source": {"type": "git","url": "https://github.com/symfony/deprecation-contracts.git",- "reference": "50f59d1f3ca46d41ac911f97a78626b6756af35b"+ "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/50f59d1f3ca46d41ac911f97a78626b6756af35b",- "reference": "50f59d1f3ca46d41ac911f97a78626b6756af35b",+ "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/f3202fa1b5097b0af062dc978b32ecf63404e31d",+ "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d","shasum": ""},"require": {@@ -8602,7 +8607,7 @@"description": "A generic function and convention to trigger deprecation notices","homepage": "https://symfony.com","support": {- "source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.0"+ "source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.1"},"funding": [{@@ -8622,7 +8627,7 @@"type": "tidelift"}],- "time": "2026-04-13T15:52:40+00:00"+ "time": "2026-06-05T06:23:12+00:00"},{"name": "symfony/error-handler",diff --git a/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php b/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.phpindex 2bdc2ab8e5..d238a80cdf 100644--- a/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php+++ b/tests/Feature/CheckoutAcceptances/Ui/AssetAcceptanceTest.php@@ -414,4 +414,58 @@ class AssetAcceptanceTest extends TestCase->assertDontSee(route('users.show', $assignee), false)->assertDontSee(route('hardware.checkout.create', $asset), false);}++ public function test_oversized_note_is_rejected_before_persistence_or_notification()+ {+ // Regression for the DoS reported by PizzaStev3 (Ahmed Mohammed).+ // An unbounded `note` on the acceptance store endpoint was reaching+ // synchronous CommonMark rendering in the decline notification and+ // burning per-request PHP-worker CPU (40k bytes ~= 847ms, 80k ~= 2.6s).+ // Server-side `max:1000` on the note field closes this at the input+ // boundary regardless of parser version. Primary fix is the+ // league/commonmark 2.9.0 bump; this test locks in the input-side guard.+ Event::fake([CheckoutAccepted::class]);+ Notification::fake();++ $checkoutAcceptance = CheckoutAcceptance::factory()->pending()->create();+ $oversizedNote = 'F9'.str_repeat(' ', 40_000).'éZ';++ $this->actingAs($checkoutAcceptance->assignedTo)+ ->from(route('account.accept.item', $checkoutAcceptance))+ ->post(route('account.store-acceptance', $checkoutAcceptance), [+ 'asset_acceptance' => 'declined',+ 'note' => $oversizedNote,+ ])+ ->assertRedirect(route('account.accept.item', $checkoutAcceptance))+ ->assertSessionHasErrors('note');++ $this->assertTrue($checkoutAcceptance->fresh()->isPending(), 'Acceptance state should not advance when note validation fails.');+ $this->assertNull($checkoutAcceptance->fresh()->declined_at);+ $this->assertNull($checkoutAcceptance->fresh()->accepted_at);++ Event::assertNotDispatched(CheckoutAccepted::class);+ Notification::assertNothingSent();+ }++ public function test_normal_length_note_still_works()+ {+ // Negative side of the oversized-note regression: a normal short note+ // must still round-trip through the acceptance flow. Guards against+ // over-tightening the max: rule below reasonable UX.+ Event::fake([CheckoutAccepted::class]);++ $checkoutAcceptance = CheckoutAcceptance::factory()->pending()->create();++ $this->actingAs($checkoutAcceptance->assignedTo)+ ->post(route('account.store-acceptance', $checkoutAcceptance), [+ 'asset_acceptance' => 'accepted',+ 'note' => str_repeat('a', 500),+ ])+ ->assertRedirectToRoute('account.accept')+ ->assertSessionHas('success');++ $this->assertFalse($checkoutAcceptance->fresh()->isPending());++ Event::assertDispatched(CheckoutAccepted::class);+ }}