Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: "Malformed Cookie header found" exception breaks tunnel #425

Open
alwayshopeless opened this issue Oct 6, 2024 · 0 comments
Open

Comments

@alwayshopeless
Copy link

System architecture

Linux

PHP Version

No response

Bug description

When tunnel accept request with Cookie header, which was build incorrectly tunnel break with message "production.ERROR: Malformed Cookie header found" from unhandled exception.
aminas/laminas-http/src/Headers.php(495): Laminas\Http\Header\Cookie::fromString()

My proposal: catch this exception in app and push it to logs.
Im so sorry but have not time to make pull request with fix it myself

Steps to reproduce

curl -H "Cookie: value" https://any-tonnel.expose.domain

Just send malformed cookie request

Relevant log output

[2024-10-06 19:47:20] production.ERROR: Malformed Cookie header found {"exception":"[object] (Laminas\\Http\\Header\\Exception\\RuntimeException(code: 0): Malformed Cookie header found at phar:///usr/local/bin/expose/vendor/laminas/laminas-http/src/Header/Cookie.php:78)
[stacktrace]
#0 phar:///usr/local/bin/expose/vendor/laminas/laminas-http/src/Headers.php(495): Laminas\\Http\\Header\\Cookie::fromString()
#1 phar:///usr/local/bin/expose/vendor/laminas/laminas-http/src/Headers.php(391): Laminas\\Http\\Headers->lazyLoadHeader()
#2 phar:///usr/local/bin/expose/vendor/laminas/laminas-http/src/Headers.php(472): Laminas\\Http\\Headers->current()
#3 phar:///usr/local/bin/expose/vendor/laminas/laminas-http/src/Headers.php(445): Laminas\\Http\\Headers->forceLoading()
#4 phar:///usr/local/bin/expose/app/Logger/LoggedRequest.php(187): Laminas\\Http\\Headers->toArray()
#5 phar:///usr/local/bin/expose/app/Logger/LoggedRequest.php(47): App\\Logger\\LoggedRequest->getRequestId()
#6 phar:///usr/local/bin/expose/app/Logger/RequestLogger.php(35): App\\Logger\\LoggedRequest->__construct()
#7 phar:///usr/local/bin/expose/app/Client/Http/HttpClient.php(52): App\\Logger\\RequestLogger->logRequest()
#8 phar:///usr/local/bin/expose/app/Client/ProxyManager.php(81): App\\Client\\Http\\HttpClient->performRequest()
#9 phar:///usr/local/bin/expose/app/Client/ProxyManager.php(35): App\\Client\\ProxyManager->performRequest()
#10 phar:///usr/local/bin/expose/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): App\\Client\\ProxyManager->App\\Client\\{closure}()
#11 phar:///usr/local/bin/expose/vendor/ratchet/pawl/src/WebSocket.php(72): Ratchet\\Client\\WebSocket->emit()
#12 phar:///usr/local/bin/expose/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php(248): Ratchet\\Client\\WebSocket->Ratchet\\Client\\{closure}()
#13 phar:///usr/local/bin/expose/vendor/ratchet/rfc6455/src/Messaging/MessageBuffer.php(194): Ratchet\\RFC6455\\Messaging\\MessageBuffer->processData()
#14 phar:///usr/local/bin/expose/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): Ratchet\\RFC6455\\Messaging\\MessageBuffer->onData()
#15 phar:///usr/local/bin/expose/vendor/react/stream/src/Util.php(71): Evenement\\EventEmitter->emit()
#16 phar:///usr/local/bin/expose/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(123): React\\Stream\\Util::React\\Stream\\{closure}()
#17 phar:///usr/local/bin/expose/vendor/react/stream/src/DuplexResourceStream.php(196): Evenement\\EventEmitter->emit()
#18 phar:///usr/local/bin/expose/vendor/react/event-loop/src/StreamSelectLoop.php(246): React\\Stream\\DuplexResourceStream->handleData()
#19 phar:///usr/local/bin/expose/vendor/react/event-loop/src/StreamSelectLoop.php(213): React\\EventLoop\\StreamSelectLoop->waitForStreamActivity()
#20 phar:///usr/local/bin/expose/app/Client/Factory.php(205): React\\EventLoop\\StreamSelectLoop->run()
#21 phar:///usr/local/bin/expose/app/Commands/ShareCommand.php(64): App\\Client\\Factory->run()
#22 phar:///usr/local/bin/expose/vendor/illuminate/container/BoundMethod.php(36): App\\Commands\\ShareCommand->handle()
#23 phar:///usr/local/bin/expose/vendor/illuminate/container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#24 phar:///usr/local/bin/expose/vendor/illuminate/container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#25 phar:///usr/local/bin/expose/vendor/illuminate/container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#26 phar:///usr/local/bin/expose/vendor/illuminate/container/Container.php(661): Illuminate\\Container\\BoundMethod::call()
#27 phar:///usr/local/bin/expose/vendor/illuminate/console/Command.php(183): Illuminate\\Container\\Container->call()
#28 phar:///usr/local/bin/expose/vendor/symfony/console/Command/Command.php(312): Illuminate\\Console\\Command->execute()
#29 phar:///usr/local/bin/expose/vendor/illuminate/console/Command.php(152): Symfony\\Component\\Console\\Command\\Command->run()
#30 phar:///usr/local/bin/expose/vendor/symfony/console/Application.php(1022): Illuminate\\Console\\Command->run()
#31 phar:///usr/local/bin/expose/vendor/symfony/console/Application.php(314): Symfony\\Component\\Console\\Application->doRunCommand()
#32 phar:///usr/local/bin/expose/vendor/symfony/console/Application.php(168): Symfony\\Component\\Console\\Application->doRun()
#33 phar:///usr/local/bin/expose/vendor/illuminate/console/Application.php(102): Symfony\\Component\\Console\\Application->run()
#34 phar:///usr/local/bin/expose/vendor/laravel-zero/foundation/src/Illuminate/Foundation/Console/Kernel.php(155): Illuminate\\Console\\Application->run()
#35 phar:///usr/local/bin/expose/vendor/laravel-zero/framework/src/Kernel.php(96): Illuminate\\Foundation\\Console\\Kernel->handle()
#36 phar:///usr/local/bin/expose/expose(44): LaravelZero\\Framework\\Kernel->handle()
#37 /usr/local/bin/expose(14): require('...')
#38 {main}
"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant