diff --git a/app/Console/Commands/ReceiveEmail.php b/app/Console/Commands/ReceiveEmail.php index cc8098b..cc15b28 100644 --- a/app/Console/Commands/ReceiveEmail.php +++ b/app/Console/Commands/ReceiveEmail.php @@ -141,9 +141,13 @@ public function handle() // Check whether this email is a reply/send from or a new email to be forwarded. $destination = Str::replaceLast('=', '@', $recipient['extension']); $validEmailDestination = filter_var($destination, FILTER_VALIDATE_EMAIL); - $verifiedRecipient = $user->getVerifiedRecipientByEmail($this->senderFrom); + if ($validEmailDestination) { + $verifiedRecipient = $user->getVerifiedRecipientByEmail($this->senderFrom); + } else { + $verifiedRecipient = null; + } - if ($validEmailDestination && $verifiedRecipient?->can_reply_send) { + if ($verifiedRecipient?->can_reply_send) { // Check if the Dmarc allow or spam headers are present from Rspamd if (! $this->parser->getHeader('X-AnonAddy-Dmarc-Allow') || $this->parser->getHeader('X-AnonAddy-Spam')) { // Notify user and exit @@ -152,18 +156,18 @@ public function handle() exit(0); } - if ($this->parser->getHeader('In-Reply-To')) { - $this->handleReply($user, $recipient); + if ($this->parser->getHeader('In-Reply-To') && $alias) { + $this->handleReply($user, $recipient, $alias); } else { - $this->handleSendFrom($user, $recipient, $aliasable ?? null); + $this->handleSendFrom($user, $recipient, $alias ?? null, $aliasable ?? null); } - } elseif ($validEmailDestination && $verifiedRecipient?->can_reply_send === false) { + } elseif ($verifiedRecipient?->can_reply_send === false) { // Notify user that they have not allowed this recipient to reply and send from aliases $verifiedRecipient->notify(new DisallowedReplySendAttempt($recipient, $this->senderFrom, $this->parser->getHeader('X-AnonAddy-Authentication-Results'))); exit(0); } else { - $this->handleForward($user, $recipient, $aliasable ?? null); + $this->handleForward($user, $recipient, $alias ?? null, $aliasable ?? null); } } } catch (\Exception $e) { @@ -184,60 +188,53 @@ protected function handleUnsubscribe($recipient) } } - protected function handleReply($user, $recipient) + protected function handleReply($user, $recipient, $alias) { - $alias = $user->aliases()->where('email', $recipient['local_part'] . '@' . $recipient['domain'])->first(); - - if ($alias) { - $sendTo = Str::replaceLast('=', '@', $recipient['extension']); + $sendTo = Str::replaceLast('=', '@', $recipient['extension']); - $emailData = new EmailData($this->parser, $this->size); + $emailData = new EmailData($this->parser, $this->option('sender'), $this->size); - $message = new ReplyToEmail($user, $alias, $emailData); + $message = new ReplyToEmail($user, $alias, $emailData); - Mail::to($sendTo)->queue($message); - } + Mail::to($sendTo)->queue($message); } - protected function handleSendFrom($user, $recipient, $aliasable) + protected function handleSendFrom($user, $recipient, $alias, $aliasable) { - $alias = $user->aliases()->withTrashed()->firstOrNew([ - 'email' => $recipient['local_part'] . '@' . $recipient['domain'], - 'local_part' => $recipient['local_part'], - 'domain' => $recipient['domain'], - 'aliasable_id' => $aliasable->id ?? null, - 'aliasable_type' => $aliasable ? 'App\\Models\\' . class_basename($aliasable) : null - ]); - - // This is a new alias but at a shared domain or the sender is not a verified recipient. - if (!isset($alias->id) && in_array($recipient['domain'], config('anonaddy.all_domains'))) { - exit(0); + if (is_null($alias)) { + $alias = $user->aliases()->create([ + 'email' => $recipient['local_part'] . '@' . $recipient['domain'], + 'local_part' => $recipient['local_part'], + 'domain' => $recipient['domain'], + 'aliasable_id' => $aliasable?->id, + 'aliasable_type' => $aliasable ? 'App\\Models\\' . class_basename($aliasable) : null + ]); + + // Hydrate all alias fields + $alias->refresh(); } - $alias->save(); - $alias->refresh(); - $sendTo = Str::replaceLast('=', '@', $recipient['extension']); - $emailData = new EmailData($this->parser, $this->size); + $emailData = new EmailData($this->parser, $this->option('sender'), $this->size); $message = new SendFromEmail($user, $alias, $emailData); Mail::to($sendTo)->queue($message); } - protected function handleForward($user, $recipient, $aliasable) + protected function handleForward($user, $recipient, $alias, $aliasable) { - $alias = $user->aliases()->withTrashed()->firstOrNew([ - 'email' => $recipient['local_part'] . '@' . $recipient['domain'], - 'local_part' => $recipient['local_part'], - 'domain' => $recipient['domain'], - 'aliasable_id' => $aliasable->id ?? null, - 'aliasable_type' => $aliasable ? 'App\\Models\\' . class_basename($aliasable) : null - ]); - - if (!isset($alias->id)) { - // This is a new alias. + if (is_null($alias)) { + // This is a new alias + $alias = new Alias([ + 'email' => $recipient['local_part'] . '@' . $recipient['domain'], + 'local_part' => $recipient['local_part'], + 'domain' => $recipient['domain'], + 'aliasable_id' => $aliasable?->id, + 'aliasable_type' => $aliasable ? 'App\\Models\\' . class_basename($aliasable) : null + ]); + if ($user->hasExceededNewAliasLimit()) { $this->error('4.2.1 New aliases per hour limit exceeded for user.'); @@ -250,26 +247,29 @@ protected function handleForward($user, $recipient, $aliasable) $keys = explode('.', $recipient['extension']); $recipientIds = $user - ->recipients() - ->oldest() - ->get() - ->filter(function ($item, $key) use ($keys) { - return in_array($key+1, $keys) && !is_null($item['email_verified_at']); - }) - ->pluck('id') - ->take(10) - ->toArray(); + ->recipients() + ->select(['id','email_verified_at']) + ->oldest() + ->get() + ->filter(function ($item, $key) use ($keys) { + return in_array($key + 1, $keys) && !is_null($item['email_verified_at']); + }) + ->pluck('id') + ->take(10) + ->toArray(); } - } - $alias->save(); - $alias->refresh(); + $user->aliases()->save($alias); + + // Hydrate all alias fields + $alias->refresh(); - if (isset($recipientIds)) { - $alias->recipients()->sync($recipientIds); + if (isset($recipientIds)) { + $alias->recipients()->sync($recipientIds); + } } - $emailData = new EmailData($this->parser, $this->size); + $emailData = new EmailData($this->parser, $this->option('sender'), $this->size); $alias->verifiedRecipientsOrDefault()->each(function ($recipient) use ($alias, $emailData) { $message = new ForwardEmail($alias, $emailData, $recipient); diff --git a/app/Mail/ForwardEmail.php b/app/Mail/ForwardEmail.php index 18d88be..424b00c 100644 --- a/app/Mail/ForwardEmail.php +++ b/app/Mail/ForwardEmail.php @@ -319,4 +319,14 @@ private function needsDkimSignature() { return $this->alias->isCustomDomain() ? $this->alias->aliasable->isVerifiedForSending() : false; } + + /** + * Override default buildSubject method that does not allow an empty subject. + */ + protected function buildSubject($message) + { + $message->subject($this->subject); + + return $this; + } } diff --git a/app/Mail/ReplyToEmail.php b/app/Mail/ReplyToEmail.php index a951752..8b5cda8 100644 --- a/app/Mail/ReplyToEmail.php +++ b/app/Mail/ReplyToEmail.php @@ -218,4 +218,14 @@ private function removeRealEmailAndHtmlBanner($html) ->replaceMatches('/(?s)((<|<)!--banner-info--(>|>)).*?((<|<)!--banner-info--(>|>))/mi', '') ->replaceMatches("/(?s)(after('://')->rtrim('/'), '/') . "(\/|%2F)deactivate(\/|%2F).*?\/tr>)/mi", ''); } + + /** + * Override default buildSubject method that does not allow an empty subject. + */ + protected function buildSubject($message) + { + $message->subject($this->subject); + + return $this; + } } diff --git a/app/Mail/SendFromEmail.php b/app/Mail/SendFromEmail.php index 523931f..7df681b 100644 --- a/app/Mail/SendFromEmail.php +++ b/app/Mail/SendFromEmail.php @@ -204,4 +204,14 @@ private function removeRealEmailAndHtmlBanner($html) ->replaceMatches('/(?s)((<|<)!--banner-info--(>|>)).*?((<|<)!--banner-info--(>|>))/mi', '') ->replaceMatches("/(?s)(after('://')->rtrim('/'), '/') . "(\/|%2F)deactivate(\/|%2F).*?\/tr>)/mi", ''); } + + /** + * Override default buildSubject method that does not allow an empty subject. + */ + protected function buildSubject($message) + { + $message->subject($this->subject); + + return $this; + } } diff --git a/app/Models/Alias.php b/app/Models/Alias.php index a8a438a..8a88148 100644 --- a/app/Models/Alias.php +++ b/app/Models/Alias.php @@ -132,18 +132,22 @@ public function verifiedRecipients() */ public function verifiedRecipientsOrDefault() { - if ($this->verifiedRecipients()->count() === 0) { + $verifiedRecipients = $this + ->verifiedRecipients() + ->get(); + + if ($verifiedRecipients->count() === 0) { // If the alias is for a custom domain or username that has a default recipient set. - if (isset($this->aliasable->defaultRecipient)) { - return $this->aliasable->defaultRecipient(); + if ($this->aliasable_id) { + if (isset($this->aliasable->defaultRecipient)) { + return $this->aliasable->defaultRecipient(); + } } - return $this->user->defaultRecipient(); + return $this->user->hasVerifiedDefaultRecipient() ? $this->user->defaultRecipient() : collect(); } - return $this - ->verifiedRecipients() - ->get(); + return $verifiedRecipients; } /** diff --git a/app/Models/EmailData.php b/app/Models/EmailData.php index a2ff22f..28f470b 100644 --- a/app/Models/EmailData.php +++ b/app/Models/EmailData.php @@ -10,9 +10,19 @@ class EmailData { private static $mimeTypes; - public function __construct(Parser $parser, $size) + public function __construct(Parser $parser, $sender, $size) { - $this->sender = $parser->getAddresses('from')[0]['address']; + if (isset($parser->getAddresses('from')[0]['address'])) { + if (filter_var($parser->getAddresses('from')[0]['address'], FILTER_VALIDATE_EMAIL)) { + $this->sender = $parser->getAddresses('from')[0]['address']; + } + } + + // If we can't get a From header address then use the envelope from + if (! isset($this->sender)) { + $this->sender = $sender; + } + $this->display_from = base64_encode($parser->getAddresses('from')[0]['display']); if (isset($parser->getAddresses('reply-to')[0])) { $this->reply_to_address = $parser->getAddresses('reply-to')[0]['address']; @@ -36,7 +46,7 @@ public function __construct(Parser $parser, $size) $this->listUnsubscribe = base64_encode($parser->getHeader('List-Unsubscribe')); $this->inReplyTo = base64_encode($parser->getHeader('In-Reply-To')); $this->references = base64_encode($parser->getHeader('References')); - $this->originalEnvelopeFrom = $this->sender; + $this->originalEnvelopeFrom = $sender; $this->originalFromHeader = base64_encode($parser->getHeader('From')); $this->originalReplyToHeader = base64_encode($parser->getHeader('Reply-To')); $this->originalSenderHeader = base64_encode($parser->getHeader('Sender')); diff --git a/composer.json b/composer.json index 4a9f37e..1944cb2 100644 --- a/composer.json +++ b/composer.json @@ -19,11 +19,9 @@ "laravel/ui": "^4.0", "maatwebsite/excel": "^3.1", "mews/captcha": "^3.0.0", - "php-mime-mail-parser/php-mime-mail-parser": "^7.0", + "php-mime-mail-parser/php-mime-mail-parser": "^8.0", "pragmarx/google2fa-laravel": "^2.0.0", - "ramsey/uuid": "^4.0", - "web-auth/cose-lib": "v4.0.5", - "web-auth/webauthn-lib": "v4.0.5" + "ramsey/uuid": "^4.0" }, "require-dev": { "fakerphp/faker": "^1.9.1", diff --git a/composer.lock b/composer.lock index a996b2a..d719398 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": "384390e966e41f863d9f771a08262b98", + "content-hash": "0d50c40694adb5c78fe707fbe5c9bc74", "packages": [ { "name": "asbiin/laravel-webauthn", @@ -148,73 +148,6 @@ }, "time": "2022-03-14T02:02:36+00:00" }, - { - "name": "beberlei/assert", - "version": "v3.3.2", - "source": { - "type": "git", - "url": "https://github.com/beberlei/assert.git", - "reference": "cb70015c04be1baee6f5f5c953703347c0ac1655" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/beberlei/assert/zipball/cb70015c04be1baee6f5f5c953703347c0ac1655", - "reference": "cb70015c04be1baee6f5f5c953703347c0ac1655", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-json": "*", - "ext-mbstring": "*", - "ext-simplexml": "*", - "php": "^7.0 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "*", - "phpstan/phpstan": "*", - "phpunit/phpunit": ">=6.0.0", - "yoast/phpunit-polyfills": "^0.1.0" - }, - "suggest": { - "ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles" - }, - "type": "library", - "autoload": { - "files": [ - "lib/Assert/functions.php" - ], - "psr-4": { - "Assert\\": "lib/Assert" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de", - "role": "Lead Developer" - }, - { - "name": "Richard Quadling", - "email": "rquadling@gmail.com", - "role": "Collaborator" - } - ], - "description": "Thin assertion library for input validation in business models.", - "keywords": [ - "assert", - "assertion", - "validation" - ], - "support": { - "issues": "https://github.com/beberlei/assert/issues", - "source": "https://github.com/beberlei/assert/tree/v3.3.2" - }, - "time": "2021-12-16T21:41:27+00:00" - }, { "name": "brick/math", "version": "0.10.2", @@ -1855,16 +1788,16 @@ }, { "name": "laravel/framework", - "version": "v9.39.0", + "version": "v9.40.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "67e674709e1e7db14f304a871481f310822d68c5" + "reference": "9611fdaf2db5759b8299802d7185bcdbee0340bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/67e674709e1e7db14f304a871481f310822d68c5", - "reference": "67e674709e1e7db14f304a871481f310822d68c5", + "url": "https://api.github.com/repos/laravel/framework/zipball/9611fdaf2db5759b8299802d7185bcdbee0340bb", + "reference": "9611fdaf2db5759b8299802d7185bcdbee0340bb", "shasum": "" }, "require": { @@ -2037,7 +1970,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-11-08T14:47:39+00:00" + "time": "2022-11-15T16:13:22+00:00" }, { "name": "laravel/sanctum", @@ -2166,16 +2099,16 @@ }, { "name": "laravel/tinker", - "version": "v2.7.2", + "version": "v2.7.3", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "dff39b661e827dae6e092412f976658df82dbac5" + "reference": "5062061b4924af3392225dd482ca7b4d85d8b8ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/dff39b661e827dae6e092412f976658df82dbac5", - "reference": "dff39b661e827dae6e092412f976658df82dbac5", + "url": "https://api.github.com/repos/laravel/tinker/zipball/5062061b4924af3392225dd482ca7b4d85d8b8ef", + "reference": "5062061b4924af3392225dd482ca7b4d85d8b8ef", "shasum": "" }, "require": { @@ -2228,22 +2161,22 @@ ], "support": { "issues": "https://github.com/laravel/tinker/issues", - "source": "https://github.com/laravel/tinker/tree/v2.7.2" + "source": "https://github.com/laravel/tinker/tree/v2.7.3" }, - "time": "2022-03-23T12:38:24+00:00" + "time": "2022-11-09T15:11:38+00:00" }, { "name": "laravel/ui", - "version": "v4.0.2", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/laravel/ui.git", - "reference": "9aa6930c8ae98b2465594d7f14f4ac131bfd6a99" + "reference": "f2f879e9f0947a1ede12b0ff7446ce4e249479cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/ui/zipball/9aa6930c8ae98b2465594d7f14f4ac131bfd6a99", - "reference": "9aa6930c8ae98b2465594d7f14f4ac131bfd6a99", + "url": "https://api.github.com/repos/laravel/ui/zipball/f2f879e9f0947a1ede12b0ff7446ce4e249479cd", + "reference": "f2f879e9f0947a1ede12b0ff7446ce4e249479cd", "shasum": "" }, "require": { @@ -2289,9 +2222,70 @@ "ui" ], "support": { - "source": "https://github.com/laravel/ui/tree/v4.0.2" + "source": "https://github.com/laravel/ui/tree/v4.1.0" }, - "time": "2022-09-09T18:20:35+00:00" + "time": "2022-11-15T14:36:57+00:00" + }, + { + "name": "lcobucci/clock", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/clock.git", + "reference": "fb533e093fd61321bfcbac08b131ce805fe183d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/clock/zipball/fb533e093fd61321bfcbac08b131ce805fe183d3", + "reference": "fb533e093fd61321bfcbac08b131ce805fe183d3", + "shasum": "" + }, + "require": { + "php": "^8.0", + "stella-maris/clock": "^0.1.4" + }, + "require-dev": { + "infection/infection": "^0.26", + "lcobucci/coding-standard": "^8.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-deprecation-rules": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Lcobucci\\Clock\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Luís Cobucci", + "email": "lcobucci@gmail.com" + } + ], + "description": "Yet another clock abstraction", + "support": { + "issues": "https://github.com/lcobucci/clock/issues", + "source": "https://github.com/lcobucci/clock/tree/2.2.0" + }, + "funding": [ + { + "url": "https://github.com/lcobucci", + "type": "github" + }, + { + "url": "https://www.patreon.com/lcobucci", + "type": "patreon" + } + ], + "time": "2022-04-19T19:34:17+00:00" }, { "name": "league/commonmark", @@ -3585,21 +3579,21 @@ }, { "name": "php-mime-mail-parser/php-mime-mail-parser", - "version": "7.1.2", + "version": "8.0.0", "source": { "type": "git", "url": "https://github.com/php-mime-mail-parser/php-mime-mail-parser.git", - "reference": "81d84bbc6a73b913110e155e98059526825c7ee3" + "reference": "65c7e6110de0096c951f9efed585980de2c1ee35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-mime-mail-parser/php-mime-mail-parser/zipball/81d84bbc6a73b913110e155e98059526825c7ee3", - "reference": "81d84bbc6a73b913110e155e98059526825c7ee3", + "url": "https://api.github.com/repos/php-mime-mail-parser/php-mime-mail-parser/zipball/65c7e6110de0096c951f9efed585980de2c1ee35", + "reference": "65c7e6110de0096c951f9efed585980de2c1ee35", "shasum": "" }, "require": { "ext-mailparse": "*", - "php": "^7.2|^8.0" + "php": "^8.0" }, "replace": { "exorus/php-mime-mail-parser": "*", @@ -3652,7 +3646,7 @@ "role": "Developer" } ], - "description": "A fully tested email parser for PHP 7.2+ (mailparse extension wrapper).", + "description": "A fully tested email parser for PHP 8.0+ (mailparse extension wrapper).", "homepage": "https://github.com/php-mime-mail-parser/php-mime-mail-parser", "keywords": [ "MimeMailParser", @@ -3664,15 +3658,9 @@ ], "support": { "issues": "https://github.com/php-mime-mail-parser/php-mime-mail-parser/issues", - "source": "https://github.com/php-mime-mail-parser/php-mime-mail-parser/tree/7.1.2" + "source": "https://github.com/php-mime-mail-parser/php-mime-mail-parser/tree/8.0.0" }, - "funding": [ - { - "url": "https://github.com/eXorus", - "type": "github" - } - ], - "time": "2022-04-16T07:56:53+00:00" + "time": "2022-11-06T16:06:22+00:00" }, { "name": "phpoffice/phpspreadsheet", @@ -4834,6 +4822,152 @@ ], "time": "2022-06-26T07:20:40+00:00" }, + { + "name": "spomky-labs/pki-framework", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/Spomky-Labs/pki-framework.git", + "reference": "4dc75ffcdaad63b3512c30bdae8a8d862cf1b2cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Spomky-Labs/pki-framework/zipball/4dc75ffcdaad63b3512c30bdae8a8d862cf1b2cb", + "reference": "4dc75ffcdaad63b3512c30bdae8a8d862cf1b2cb", + "shasum": "" + }, + "require": { + "brick/math": "^0.10", + "ext-mbstring": "*", + "php": ">=8.1" + }, + "require-dev": { + "ekino/phpstan-banned-code": "^1.0", + "ext-gmp": "*", + "infection/infection": "^0.26", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-beberlei-assert": "^1.0", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^9.5.5", + "rector/rector": "^0.14", + "roave/security-advisories": "dev-latest", + "symfony/phpunit-bridge": "^6.1", + "symfony/var-dumper": "^6.1", + "symplify/easy-coding-standard": "^11.1", + "thecodingmachine/phpstan-safe-rule": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "SpomkyLabs\\Pki\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joni Eskelinen", + "email": "jonieske@gmail.com", + "role": "Original developer" + } + ], + "description": "A PHP framework for managing Public Key Infrastructures. It comprises X.509 public key certificates, attribute certificates, certification requests and certification path validation.", + "homepage": "https://github.com/spomky-labs/pki-framework", + "keywords": [ + "DER", + "Private Key", + "ac", + "algorithm identifier", + "asn.1", + "asn1", + "attribute certificate", + "certificate", + "certification request", + "cryptography", + "csr", + "decrypt", + "ec", + "encrypt", + "pem", + "pkcs", + "public key", + "rsa", + "sign", + "signature", + "verify", + "x.509", + "x.690", + "x509", + "x690" + ], + "support": { + "issues": "https://github.com/Spomky-Labs/pki-framework/issues", + "source": "https://github.com/Spomky-Labs/pki-framework/tree/1.0.0" + }, + "funding": [ + { + "url": "https://github.com/Spomky", + "type": "github" + }, + { + "url": "https://www.patreon.com/FlorentMorselli", + "type": "patreon" + } + ], + "time": "2022-08-22T11:26:16+00:00" + }, + { + "name": "stella-maris/clock", + "version": "0.1.6", + "source": { + "type": "git", + "url": "https://github.com/stella-maris-solutions/clock.git", + "reference": "a94228dac03c9a8411198ce8c8dacbbe99c930c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/stella-maris-solutions/clock/zipball/a94228dac03c9a8411198ce8c8dacbbe99c930c3", + "reference": "a94228dac03c9a8411198ce8c8dacbbe99c930c3", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "StellaMaris\\Clock\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Heigl", + "role": "Maintainer" + } + ], + "description": "A pre-release of the proposed PSR-20 Clock-Interface", + "homepage": "https://gitlab.com/stella-maris/clock", + "keywords": [ + "clock", + "datetime", + "point in time", + "psr20" + ], + "support": { + "issues": "https://github.com/stella-maris-solutions/clock/issues", + "source": "https://github.com/stella-maris-solutions/clock/tree/0.1.6" + }, + "time": "2022-09-27T15:03:11+00:00" + }, { "name": "symfony/console", "version": "v6.1.7", @@ -7446,42 +7580,39 @@ }, { "name": "web-auth/cose-lib", - "version": "v4.0.5", + "version": "4.0.12", "source": { "type": "git", "url": "https://github.com/web-auth/cose-lib.git", - "reference": "2fe6c0d35136d75bc538372a317ca5df5a75ce73" + "reference": "fc733974fe12b550b54a94a08e4e184aca0015e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/cose-lib/zipball/2fe6c0d35136d75bc538372a317ca5df5a75ce73", - "reference": "2fe6c0d35136d75bc538372a317ca5df5a75ce73", + "url": "https://api.github.com/repos/web-auth/cose-lib/zipball/fc733974fe12b550b54a94a08e4e184aca0015e5", + "reference": "fc733974fe12b550b54a94a08e4e184aca0015e5", "shasum": "" }, "require": { - "beberlei/assert": "^3.2", "brick/math": "^0.9|^0.10", "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", "fgrosse/phpasn1": "^2.1", - "php": ">=8.1", - "thecodingmachine/safe": "^1.0|^2.0" + "php": ">=8.1" }, "require-dev": { "ekino/phpstan-banned-code": "^1.0", "infection/infection": "^0.26.12", "php-parallel-lint/php-parallel-lint": "^1.3", "phpstan/phpstan": "^1.7", - "phpstan/phpstan-beberlei-assert": "^1.0", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-strict-rules": "^1.2", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.13.6", + "qossmic/deptrac-shim": "^0.24.0", + "rector/rector": "^0.14", "symfony/phpunit-bridge": "^6.1", - "symplify/easy-coding-standard": "^11.0", - "thecodingmachine/phpstan-safe-rule": "^1.2" + "symplify/easy-coding-standard": "^11.0" }, "suggest": { "ext-bcmath": "For better performance, please install either GMP (recommended) or BCMath extension", @@ -7515,7 +7646,7 @@ ], "support": { "issues": "https://github.com/web-auth/cose-lib/issues", - "source": "https://github.com/web-auth/cose-lib/tree/v4.0.5" + "source": "https://github.com/web-auth/cose-lib/tree/4.0.12" }, "funding": [ { @@ -7527,30 +7658,31 @@ "type": "patreon" } ], - "time": "2022-08-04T16:48:04+00:00" + "time": "2022-09-17T08:34:42+00:00" }, { "name": "web-auth/metadata-service", - "version": "v4.0.5", + "version": "4.4.1", "source": { "type": "git", "url": "https://github.com/web-auth/webauthn-metadata-service.git", - "reference": "2bc26efc09d280f87777c736f404a2d875d6e7c4" + "reference": "bd2a01cd94b98c42bbde47ec37b1a308256a041d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/webauthn-metadata-service/zipball/2bc26efc09d280f87777c736f404a2d875d6e7c4", - "reference": "2bc26efc09d280f87777c736f404a2d875d6e7c4", + "url": "https://api.github.com/repos/web-auth/webauthn-metadata-service/zipball/bd2a01cd94b98c42bbde47ec37b1a308256a041d", + "reference": "bd2a01cd94b98c42bbde47ec37b1a308256a041d", "shasum": "" }, "require": { - "beberlei/assert": "^3.2", "ext-json": "*", - "paragonie/constant_time_encoding": "^2.4", + "lcobucci/clock": "^2.2", + "paragonie/constant_time_encoding": "^2.6", "php": ">=8.1", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "psr/log": "^2.0|^3.0" + "psr/log": "^1.0|^2.0|^3.0", + "spomky-labs/pki-framework": "^1.0" }, "suggest": { "psr/log-implementation": "Recommended to receive logs from the library", @@ -7585,7 +7717,7 @@ "webauthn" ], "support": { - "source": "https://github.com/web-auth/webauthn-metadata-service/tree/v4.0.5" + "source": "https://github.com/web-auth/webauthn-metadata-service/tree/4.4.1" }, "funding": [ { @@ -7597,42 +7729,43 @@ "type": "patreon" } ], - "time": "2022-06-22T11:14:44+00:00" + "time": "2022-11-07T21:45:07+00:00" }, { "name": "web-auth/webauthn-lib", - "version": "v4.0.5", + "version": "4.4.1", "source": { "type": "git", "url": "https://github.com/web-auth/webauthn-lib.git", - "reference": "1b02740ab8539f025419380c9e4c41b090c6cf47" + "reference": "2cc0aabe6f93c4d680dd507490fc5699841c7490" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/webauthn-lib/zipball/1b02740ab8539f025419380c9e4c41b090c6cf47", - "reference": "1b02740ab8539f025419380c9e4c41b090c6cf47", + "url": "https://api.github.com/repos/web-auth/webauthn-lib/zipball/2cc0aabe6f93c4d680dd507490fc5699841c7490", + "reference": "2cc0aabe6f93c4d680dd507490fc5699841c7490", "shasum": "" }, "require": { - "beberlei/assert": "^3.2", "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", - "fgrosse/phpasn1": "^2.1", - "paragonie/constant_time_encoding": "^2.4", + "fgrosse/phpasn1": "^2.4", + "paragonie/constant_time_encoding": "^2.6", "php": ">=8.1", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "psr/log": "^2.0|^3.0", + "psr/log": "^1.0|^2.0|^3.0", "spomky-labs/cbor-php": "^3.0", - "symfony/uid": "^6.0", - "thecodingmachine/safe": "^2.0", - "web-auth/cose-lib": "^4.0", + "symfony/uid": "^6.1", + "web-auth/cose-lib": "^4.0.12", "web-auth/metadata-service": "self.version" }, + "require-dev": { + "symfony/event-dispatcher": "^6.1" + }, "suggest": { "psr/log-implementation": "Recommended to receive logs from the library", + "symfony/event-dispatcher": "Recommended to use dispatched events", "web-token/jwt-key-mgmt": "Mandatory for the AndroidSafetyNet Attestation Statement support", "web-token/jwt-signature-algorithm-ecdsa": "Recommended for the AndroidSafetyNet Attestation Statement support", "web-token/jwt-signature-algorithm-eddsa": "Recommended for the AndroidSafetyNet Attestation Statement support", @@ -7666,7 +7799,7 @@ "webauthn" ], "support": { - "source": "https://github.com/web-auth/webauthn-lib/tree/v4.0.5" + "source": "https://github.com/web-auth/webauthn-lib/tree/4.4.1" }, "funding": [ { @@ -7678,7 +7811,7 @@ "type": "patreon" } ], - "time": "2022-06-23T16:25:36+00:00" + "time": "2022-11-07T21:45:07+00:00" }, { "name": "web-token/jwt-core", @@ -10363,16 +10496,16 @@ }, { "name": "spatie/flare-client-php", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/spatie/flare-client-php.git", - "reference": "b1b974348750925b717fa8c8b97a0db0d1aa40ca" + "reference": "ebb9ae0509b75e02f128b39537eb9a3ef5ce18e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/b1b974348750925b717fa8c8b97a0db0d1aa40ca", - "reference": "b1b974348750925b717fa8c8b97a0db0d1aa40ca", + "url": "https://api.github.com/repos/spatie/flare-client-php/zipball/ebb9ae0509b75e02f128b39537eb9a3ef5ce18e8", + "reference": "ebb9ae0509b75e02f128b39537eb9a3ef5ce18e8", "shasum": "" }, "require": { @@ -10420,7 +10553,7 @@ ], "support": { "issues": "https://github.com/spatie/flare-client-php/issues", - "source": "https://github.com/spatie/flare-client-php/tree/1.3.0" + "source": "https://github.com/spatie/flare-client-php/tree/1.3.1" }, "funding": [ { @@ -10428,7 +10561,7 @@ "type": "github" } ], - "time": "2022-08-08T10:10:20+00:00" + "time": "2022-11-16T08:30:20+00:00" }, { "name": "spatie/ignition", diff --git a/resources/views/vendor/webauthn/authenticate.blade.php b/resources/views/vendor/webauthn/authenticate.blade.php index 42d8643..0629e1f 100644 --- a/resources/views/vendor/webauthn/authenticate.blade.php +++ b/resources/views/vendor/webauthn/authenticate.blade.php @@ -114,7 +114,8 @@ function (data) { document.getElementById("id").value = data.id; document.getElementById("rawId").value = data.rawId; document.getElementById("authenticatorData").value = data.response.authenticatorData; - document.getElementById("clientDataJSON").value = data.response.clientDataJSON; + // Sort no padding issue + document.getElementById("clientDataJSON").value = data.response.clientDataJSON.replace('=', ''); document.getElementById("signature").value = data.response.signature; document.getElementById("userHandle").value = data.response.userHandle; document.getElementById("type").value = data.type; @@ -132,7 +133,8 @@ function (data) { document.getElementById("id").value = data.id; document.getElementById("rawId").value = data.rawId; document.getElementById("authenticatorData").value = data.response.authenticatorData; - document.getElementById("clientDataJSON").value = data.response.clientDataJSON; + // Sort no padding issue + document.getElementById("clientDataJSON").value = data.response.clientDataJSON.replace('=', ''); document.getElementById("signature").value = data.response.signature; document.getElementById("userHandle").value = data.response.userHandle; document.getElementById("type").value = data.type; diff --git a/tests/Feature/Api/RulesTest.php b/tests/Feature/Api/RulesTest.php index 028dc16..047e115 100644 --- a/tests/Feature/Api/RulesTest.php +++ b/tests/Feature/Api/RulesTest.php @@ -260,9 +260,11 @@ public function it_can_apply_user_rules() $parser = $this->getParser(base_path('tests/emails/email.eml')); + $sender = 'will@anonaddy.com'; + $size = 1500; - $emailData = new EmailData($parser, $size); + $emailData = new EmailData($parser, $sender, $size); $job = new ForwardEmail($alias, $emailData, $this->user->defaultRecipient); @@ -320,9 +322,11 @@ public function it_does_not_apply_rules_if_email_type_is_not_selected() $parser = $this->getParser(base_path('tests/emails/email.eml')); + $sender = 'will@anonaddy.com'; + $size = 1500; - $emailData = new EmailData($parser, $size); + $emailData = new EmailData($parser, $sender, $size); $job = new ForwardEmail($alias, $emailData, $this->user->defaultRecipient); @@ -404,9 +408,11 @@ public function it_can_apply_user_rules_in_correct_order() $parser = $this->getParser(base_path('tests/emails/email.eml')); + $sender = 'will@anonaddy.com'; + $size = 1000; - $emailData = new EmailData($parser, $size); + $emailData = new EmailData($parser, $sender, $size); $job = new ForwardEmail($alias, $emailData, $this->user->defaultRecipient);