Sfoglia il codice sorgente

Updated OpenPGPEncrypter

Will Browning 2 anni fa
parent
commit
37d6af9719

+ 15 - 6
app/CustomMailDriver/Mime/Crypto/OpenPGPEncrypter.php

@@ -110,7 +110,7 @@ class OpenPGPEncrypter
      */
      */
     public function encrypt(Email $message): Email
     public function encrypt(Email $message): Email
     {
     {
-        $originalMessage = $message->toString();
+        $originalMessage = clone $message;
 
 
         $headers = $message->getPreparedHeaders();
         $headers = $message->getPreparedHeaders();
 
 
@@ -133,16 +133,23 @@ class OpenPGPEncrypter
             throw new RuntimeException('Signing has been enabled, but no signature has been added. Use autoAddSignature() or addSignature()');
             throw new RuntimeException('Signing has been enabled, but no signature has been added. Use autoAddSignature() or addSignature()');
         }
         }
 
 
-        $lines = preg_split('/(\r\n|\r|\n)/', rtrim($originalMessage));
+        // If the email does not have any text part then we need to add a text/plain legacy display part
+        if ($this->usesProtectedHeaders && is_null($originalMessage->getTextBody())) {
+            $originalMessage->text($headers->get('Subject')->toString());
+        }
+
+        $lines = preg_split('/(\r\n|\r|\n)/', rtrim($originalMessage->toString()));
 
 
         // Check if using protected headers or not
         // Check if using protected headers or not
         if ($this->usesProtectedHeaders) {
         if ($this->usesProtectedHeaders) {
             $protectedHeadersSet = false;
             $protectedHeadersSet = false;
             for ($i=0; $i<count($lines); $i++) {
             for ($i=0; $i<count($lines); $i++) {
-                if (! $protectedHeadersSet && Str::startsWith(strtolower($lines[$i]), 'content-type:')) {
+                if (Str::startsWith(strtolower($lines[$i]), 'content-type: text/plain') || Str::startsWith(strtolower($lines[$i]), 'content-type: multipart/')) {
                     $lines[$i] = rtrim($lines[$i])."; protected-headers=\"v1\"\r\n";
                     $lines[$i] = rtrim($lines[$i])."; protected-headers=\"v1\"\r\n";
-                    $headers->setHeaderBody('Text', 'Subject', '...');
-                    $protectedHeadersSet = true;
+                    if (! $protectedHeadersSet) {
+                        $headers->setHeaderBody('Text', 'Subject', '...');
+                        $protectedHeadersSet = true;
+                    }
                 } else {
                 } else {
                     $lines[$i] = rtrim($lines[$i])."\r\n";
                     $lines[$i] = rtrim($lines[$i])."\r\n";
                 }
                 }
@@ -222,7 +229,9 @@ class OpenPGPEncrypter
             throw new RuntimeException('Encryption has been enabled, but no recipients have been added. Use autoAddRecipients() or addRecipient()');
             throw new RuntimeException('Encryption has been enabled, but no recipients have been added. Use autoAddRecipients() or addRecipient()');
         }
         }
 
 
-        $text = $this->pgpEncryptAndSignString($message->getTextBody(), $this->recipientKey, $this->signingKey);
+        $body = $message->getTextBody() ?? '';
+
+        $text = $this->pgpEncryptAndSignString($body, $this->recipientKey, $this->signingKey);
 
 
         $headers = $message->getPreparedHeaders();
         $headers = $message->getPreparedHeaders();
         $headers->setHeaderBody('Parameterized', 'Content-Type', 'text/plain');
         $headers->setHeaderBody('Parameterized', 'Content-Type', 'text/plain');

+ 2 - 0
app/Http/Controllers/Api/RecipientKeyController.php

@@ -41,6 +41,8 @@ class RecipientKeyController extends Controller
 
 
         $recipient->update([
         $recipient->update([
             'should_encrypt' => false,
             'should_encrypt' => false,
+            'inline_encryption' => false,
+            'protected_headers' => false,
             'fingerprint' => null
             'fingerprint' => null
         ]);
         ]);
 
 

+ 11 - 11
composer.lock

@@ -1695,16 +1695,16 @@
         },
         },
         {
         {
             "name": "laravel/framework",
             "name": "laravel/framework",
-            "version": "v9.23.0",
+            "version": "v9.24.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/laravel/framework.git",
                 "url": "https://github.com/laravel/framework.git",
-                "reference": "c4eea9060d847b5c93957b203caa8f57544a76ab"
+                "reference": "053840f579cf01d353d81333802afced79b1c0af"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/framework/zipball/c4eea9060d847b5c93957b203caa8f57544a76ab",
-                "reference": "c4eea9060d847b5c93957b203caa8f57544a76ab",
+                "url": "https://api.github.com/repos/laravel/framework/zipball/053840f579cf01d353d81333802afced79b1c0af",
+                "reference": "053840f579cf01d353d81333802afced79b1c0af",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -1871,7 +1871,7 @@
                 "issues": "https://github.com/laravel/framework/issues",
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
                 "source": "https://github.com/laravel/framework"
             },
             },
-            "time": "2022-08-02T14:24:44+00:00"
+            "time": "2022-08-09T13:43:22+00:00"
         },
         },
         {
         {
             "name": "laravel/sanctum",
             "name": "laravel/sanctum",
@@ -10886,16 +10886,16 @@
         },
         },
         {
         {
             "name": "spatie/ray",
             "name": "spatie/ray",
-            "version": "1.34.5",
+            "version": "1.35.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/spatie/ray.git",
                 "url": "https://github.com/spatie/ray.git",
-                "reference": "2d64ea264eecbdc7ec01e4e8b45978cae80815d2"
+                "reference": "7196737c17718264aef9e446b773ee490c1563dd"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/spatie/ray/zipball/2d64ea264eecbdc7ec01e4e8b45978cae80815d2",
-                "reference": "2d64ea264eecbdc7ec01e4e8b45978cae80815d2",
+                "url": "https://api.github.com/repos/spatie/ray/zipball/7196737c17718264aef9e446b773ee490c1563dd",
+                "reference": "7196737c17718264aef9e446b773ee490c1563dd",
                 "shasum": ""
                 "shasum": ""
             },
             },
             "require": {
             "require": {
@@ -10945,7 +10945,7 @@
             ],
             ],
             "support": {
             "support": {
                 "issues": "https://github.com/spatie/ray/issues",
                 "issues": "https://github.com/spatie/ray/issues",
-                "source": "https://github.com/spatie/ray/tree/1.34.5"
+                "source": "https://github.com/spatie/ray/tree/1.35.0"
             },
             },
             "funding": [
             "funding": [
                 {
                 {
@@ -10957,7 +10957,7 @@
                     "type": "other"
                     "type": "other"
                 }
                 }
             ],
             ],
-            "time": "2022-06-03T12:32:57+00:00"
+            "time": "2022-08-09T14:35:12+00:00"
         },
         },
         {
         {
             "name": "symfony/filesystem",
             "name": "symfony/filesystem",

+ 18 - 18
package-lock.json

@@ -1976,9 +1976,9 @@
             "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ=="
             "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ=="
         },
         },
         "node_modules/@types/node": {
         "node_modules/@types/node": {
-            "version": "18.6.4",
-            "resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.4.tgz",
-            "integrity": "sha512-I4BD3L+6AWiUobfxZ49DlU43gtI+FTHSv9pE2Zekg6KjMpre4ByusaljW3vYSLJrvQ1ck1hUaeVu8HVlY3vzHg=="
+            "version": "18.6.5",
+            "resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.5.tgz",
+            "integrity": "sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw=="
         },
         },
         "node_modules/@types/parse-json": {
         "node_modules/@types/parse-json": {
             "version": "4.0.0",
             "version": "4.0.0",
@@ -2983,9 +2983,9 @@
             }
             }
         },
         },
         "node_modules/caniuse-lite": {
         "node_modules/caniuse-lite": {
-            "version": "1.0.30001374",
-            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001374.tgz",
-            "integrity": "sha512-mWvzatRx3w+j5wx/mpFN5v5twlPrabG8NqX2c6e45LCpymdoGqNvRkRutFUqpRTXKFQFNQJasvK0YT7suW6/Hw==",
+            "version": "1.0.30001375",
+            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001375.tgz",
+            "integrity": "sha512-kWIMkNzLYxSvnjy0hL8w1NOaWNr2rn39RTAVyIwcw8juu60bZDWiF1/loOYANzjtJmy6qPgNmn38ro5Pygagdw==",
             "funding": [
             "funding": [
                 {
                 {
                     "type": "opencollective",
                     "type": "opencollective",
@@ -4025,9 +4025,9 @@
             "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
             "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
         },
         },
         "node_modules/electron-to-chromium": {
         "node_modules/electron-to-chromium": {
-            "version": "1.4.211",
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.211.tgz",
-            "integrity": "sha512-BZSbMpyFQU0KBJ1JG26XGeFI3i4op+qOYGxftmZXFZoHkhLgsSv4DHDJfl8ogII3hIuzGt51PaZ195OVu0yJ9A=="
+            "version": "1.4.213",
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.213.tgz",
+            "integrity": "sha512-+3DbGHGOCHTVB/Ms63bGqbyC1b8y7Fk86+7ltssB8NQrZtSCvZG6eooSl9U2Q0yw++fL2DpHKOdTU0NVEkFObg=="
         },
         },
         "node_modules/elliptic": {
         "node_modules/elliptic": {
             "version": "6.5.4",
             "version": "6.5.4",
@@ -10722,9 +10722,9 @@
             "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ=="
             "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ=="
         },
         },
         "@types/node": {
         "@types/node": {
-            "version": "18.6.4",
-            "resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.4.tgz",
-            "integrity": "sha512-I4BD3L+6AWiUobfxZ49DlU43gtI+FTHSv9pE2Zekg6KjMpre4ByusaljW3vYSLJrvQ1ck1hUaeVu8HVlY3vzHg=="
+            "version": "18.6.5",
+            "resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.5.tgz",
+            "integrity": "sha512-Xjt5ZGUa5WusGZJ4WJPbOT8QOqp6nDynVFRKcUt32bOgvXEoc6o085WNkYTMO7ifAj2isEfQQ2cseE+wT6jsRw=="
         },
         },
         "@types/parse-json": {
         "@types/parse-json": {
             "version": "4.0.0",
             "version": "4.0.0",
@@ -11542,9 +11542,9 @@
             }
             }
         },
         },
         "caniuse-lite": {
         "caniuse-lite": {
-            "version": "1.0.30001374",
-            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001374.tgz",
-            "integrity": "sha512-mWvzatRx3w+j5wx/mpFN5v5twlPrabG8NqX2c6e45LCpymdoGqNvRkRutFUqpRTXKFQFNQJasvK0YT7suW6/Hw=="
+            "version": "1.0.30001375",
+            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001375.tgz",
+            "integrity": "sha512-kWIMkNzLYxSvnjy0hL8w1NOaWNr2rn39RTAVyIwcw8juu60bZDWiF1/loOYANzjtJmy6qPgNmn38ro5Pygagdw=="
         },
         },
         "chalk": {
         "chalk": {
             "version": "4.1.2",
             "version": "4.1.2",
@@ -12309,9 +12309,9 @@
             "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
             "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
         },
         },
         "electron-to-chromium": {
         "electron-to-chromium": {
-            "version": "1.4.211",
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.211.tgz",
-            "integrity": "sha512-BZSbMpyFQU0KBJ1JG26XGeFI3i4op+qOYGxftmZXFZoHkhLgsSv4DHDJfl8ogII3hIuzGt51PaZ195OVu0yJ9A=="
+            "version": "1.4.213",
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.213.tgz",
+            "integrity": "sha512-+3DbGHGOCHTVB/Ms63bGqbyC1b8y7Fk86+7ltssB8NQrZtSCvZG6eooSl9U2Q0yw++fL2DpHKOdTU0NVEkFObg=="
         },
         },
         "elliptic": {
         "elliptic": {
             "version": "6.5.4",
             "version": "6.5.4",

+ 1 - 5
resources/js/pages/Domains.vue

@@ -95,11 +95,7 @@
             />
             />
           </div>
           </div>
           <div v-else-if="props.row.description" class="flex items-centers">
           <div v-else-if="props.row.description" class="flex items-centers">
-            <span
-              class="tooltip outline-none"
-              :data-tippy-content="rows[props.row.originalIndex].description"
-              >{{ props.row.description | truncate(60) }}</span
-            >
+            <span class="outline-none">{{ props.row.description | truncate(60) }}</span>
             <icon
             <icon
               name="edit"
               name="edit"
               class="inline-block w-6 h-6 text-grey-300 fill-current cursor-pointer ml-2"
               class="inline-block w-6 h-6 text-grey-300 fill-current cursor-pointer ml-2"

+ 2 - 2
resources/js/pages/Recipients.vue

@@ -64,7 +64,7 @@
           PGP/Inline
           PGP/Inline
           <span
           <span
             class="tooltip outline-none"
             class="tooltip outline-none"
-            :data-tippy-content="`Use inline (PGP/Inline) instead of PGP/MIME encyption for forwarded messages. Please Note: This will ONLY encrypt and forward the plain text content!`"
+            data-tippy-content="Use inline (PGP/Inline) instead of PGP/MIME encryption for forwarded messages. Please Note: This will ONLY encrypt and forward the plain text content!"
           >
           >
             <icon name="info" class="inline-block w-4 h-4 text-grey-300 fill-current" />
             <icon name="info" class="inline-block w-4 h-4 text-grey-300 fill-current" />
           </span>
           </span>
@@ -73,7 +73,7 @@
           Hide Subject
           Hide Subject
           <span
           <span
             class="tooltip outline-none"
             class="tooltip outline-none"
-            :data-tippy-content="`Enabling this setting will hide and encrypt the email subject using protected headers. Many mail clients are able to automatically decrypt and display the subject once the email arrives.`"
+            data-tippy-content="Enabling this setting will hide and encrypt the email subject using protected headers. Many mail clients are able to automatically decrypt and display the subject once the email arrives."
           >
           >
             <icon name="info" class="inline-block w-4 h-4 text-grey-300 fill-current" />
             <icon name="info" class="inline-block w-4 h-4 text-grey-300 fill-current" />
           </span>
           </span>

+ 1 - 3
resources/js/pages/Usernames.vue

@@ -101,9 +101,7 @@
             />
             />
           </div>
           </div>
           <div v-else-if="props.row.description" class="flex items-centers">
           <div v-else-if="props.row.description" class="flex items-centers">
-            <span class="tooltip outline-none" :data-tippy-content="props.row.description">{{
-              props.row.description | truncate(60)
-            }}</span>
+            <span class="outline-none">{{ props.row.description | truncate(60) }}</span>
             <icon
             <icon
               name="edit"
               name="edit"
               class="inline-block w-6 h-6 text-grey-300 fill-current cursor-pointer ml-2"
               class="inline-block w-6 h-6 text-grey-300 fill-current cursor-pointer ml-2"

+ 4 - 1
resources/views/auth/verify.blade.php

@@ -19,8 +19,11 @@
                     <div class="mx-auto mt-6 w-24 border-b-2 border-grey-200"></div>
                     <div class="mx-auto mt-6 w-24 border-b-2 border-grey-200"></div>
 
 
                     <div class="w-full flex flex-wrap mt-8">
                     <div class="w-full flex flex-wrap mt-8">
+                    <p class="leading-normal mb-2 text-center">
+                            Before proceeding, please check your email <b>{{ user()->email }}</b> for a verification link. This link will expire after 1 hour.
+                        </p>
                         <p class="leading-normal mb-6 text-center">
                         <p class="leading-normal mb-6 text-center">
-                            {{ __('Before proceeding, please check your email for a verification link.') }} This link will expire after 1 hour.
+                            If that email address is incorrect you can update it on the <a href="{{ route('settings.show') }}" class="text-indigo-700">settings page</a>.
                         </p>
                         </p>
 
 
                         <form method="POST" action="{{ route('verification.resend') }}" class="w-full">
                         <form method="POST" action="{{ route('verification.resend') }}" class="w-full">

+ 14 - 0
tests/emails/email_html_only.eml

@@ -0,0 +1,14 @@
+Date: Wed, 20 Feb 2019 15:00:00 +0100 (CET)
+From: Will <will@anonaddy.com>
+To: <ebay@johndoe.anonaddy.com>
+Subject: Test HTML Email
+List-Unsubscribe: <mailto:unsubscribe@example.com>
+Message-ID: 3edc902304c446bb9cb904623c9e59fb
+Content-Type: text/html; charset=utf-8
+Content-Transfer-Encoding: quoted-printable
+
+Hi,<br>
+<br>
+This is a test email.<br>
+<br>
+Will