From d735237e8f0a312edc5d9e87be56e071273bfac6 Mon Sep 17 00:00:00 2001 From: Maxime Cannoodt Date: Wed, 29 Jun 2022 16:05:25 +0200 Subject: [PATCH] add frontend error pages --- server/prisma/dev.db | Bin 815104 -> 815104 bytes server/server.ts | 2 +- webapp/src/lib/crypto/decrypt.ts | 6 ++-- webapp/src/routes/__error.svelte | 11 ++++++- webapp/src/routes/note/[id].svelte | 45 ++++++++++++++++++----------- 5 files changed, 42 insertions(+), 22 deletions(-) diff --git a/server/prisma/dev.db b/server/prisma/dev.db index b710468aca3c12b4caae7d73a1495c7d682fd4a3..c03f90810ae4fcaa17e88383aeaf3a787e992107 100644 GIT binary patch delta 14655 zcmZv@Nyt2Jo+ngQJyqR3Q&oQoMUZx|kArc@*q1{y#=h@+s5r4?>=7B6u?IqS>tWi1 z;Bsi^GI;Bw8(5+TaT(?~2l3v_2y+o>afP`UC1NA=3lF@%UnKbk5#Q(g{cO)4{u%U# ze+K>AzxRv3`=cNI=S|K{pcp#@GH*e`x_^-unZ^Yef9pZ}|W@xdJ~!274zmkmwFVtc*YU;gc1 zy?%DD-@e!H-0OGm^;duWtJh!q-~NN2{`MdL=(qp)*T1rU{Qd3k@XO!%n?L>OpZ(&G ze)0d@(d#eysvrN+fB0Yip8w;2U7`LF?Zd)ch(Q-YBw*RdQv`v6ehZ>zkBhjoY4@;N z^uY(7wp*W+#Uy~s$_VE_SK%n-y4JYcpc|fcB+W@cI(@mzzw#lWYTe{9reDw3vp+!Z zQg}!1m(cVihHk()gYn&*@GEmCQGZ(d!%qO*2S(d!*o2TL!B{ulJA3>p0wqvRaiDNM zWGVQ~8NfnLd{0GOy~e}as+%XV0Z#gmRY?A}ARFx28<5P`8!4j7$~vvff~5nZqY^`n zIHvGHmwwJrsvRdKOh;YMWBRAn)6r07qPG)AQPqbtZ`)IfkoTx032mswlUHlDrg@Fq zdQNF!u=Iqv7_6YRMvKE3Z?kQcQW6$`YIgvDguzR;k`2mtyG@ zfz=11Dndnkt(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ts @@ -28,7 +28,7 @@ app.listen(process.env.PORT, () => { app.post("/note/", async (req: Request<{}, {}, EncryptedNote>, res) => { const note = req.body; const savedNote = await prisma.encryptedNote.create({ - data: { ...note, expire_time: addDays(new Date(), 14) }, + data: { ...note, expire_time: addDays(new Date(), 30) }, }); res.json({ view_url: `${process.env.FRONTEND_URL}/note/${savedNote.id}`, diff --git a/webapp/src/lib/crypto/decrypt.ts b/webapp/src/lib/crypto/decrypt.ts index a0b16d1..aa0077a 100644 --- a/webapp/src/lib/crypto/decrypt.ts +++ b/webapp/src/lib/crypto/decrypt.ts @@ -1,16 +1,16 @@ import { AES, enc, HmacSHA256 } from 'crypto-js'; // TODO: should be same source code as used in the plugin!! -export default function decrypt(cryptData: { +export default async function decrypt(cryptData: { ciphertext: string; hmac: string; key: string; -}): string { +}): Promise { const hmac_calculated = HmacSHA256(cryptData.ciphertext, cryptData.key).toString(); const is_authentic = hmac_calculated == cryptData.hmac; if (!is_authentic) { - throw Error('Cannot decrypt ciphertext with this key.'); + throw Error('Failed HMAC check'); } const md = AES.decrypt(cryptData.ciphertext, cryptData.key).toString(enc.Utf8); return md; diff --git a/webapp/src/routes/__error.svelte b/webapp/src/routes/__error.svelte index 27c027c..a39ef63 100644 --- a/webapp/src/routes/__error.svelte +++ b/webapp/src/routes/__error.svelte @@ -2,9 +2,16 @@ import type { Load } from '@sveltejs/kit'; export const load: Load = ({ error, status }) => { + let explainText = ''; + + if (status == 404) { + explainText = `No note was found for this link. It may be that the note that was once connected to this link has expired.`; + } + return { props: { - title: `${status}: ${error?.message}` + title: `${status}: ${error?.message}`, + explainText: explainText } }; }; @@ -12,8 +19,10 @@

{title}

+

{explainText}

diff --git a/webapp/src/routes/note/[id].svelte b/webapp/src/routes/note/[id].svelte index 5e888f5..4de497d 100644 --- a/webapp/src/routes/note/[id].svelte +++ b/webapp/src/routes/note/[id].svelte @@ -41,13 +41,15 @@ export let note: EncryptedNote; let plaintext: string; let timeString: string; + let decryptFailed = false; onMount(() => { if (browser) { // Decrypt note - console.log(note); const key = location.hash.slice(1); - plaintext = decrypt({ ...note, key }); + decrypt({ ...note, key }) + .then((value) => (plaintext = value)) + .catch(() => (decryptFailed = true)); } }); @@ -74,19 +76,28 @@ } -
-

- - - e2e encrypted | Shared {timeString} ago - - -

- - {#if plaintext} +{#if plaintext} +
+

+ + + e2e encrypted | Shared {timeString} ago + + +

- {/if} -
+
+{/if} + +{#if decryptFailed} +
+

Error: Cannot decrypt file

+

This note could not be decrypted with this link.

+

+ If you think this is an error, please double check that you copied the entire URL. +

+
+{/if}