From 73739b5bc47faee27849f77e2e90e4ed02205c47 Mon Sep 17 00:00:00 2001 From: blek Date: Mon, 9 Oct 2023 20:13:07 +1000 Subject: [PATCH] add file password security notice --- filed/src/web/pages.rs | 22 ++++++++++ filed/templates/index.html | 33 +++++++++++---- filed/templates/passworded-files.html | 59 +++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 9 deletions(-) create mode 100644 filed/templates/passworded-files.html diff --git a/filed/src/web/pages.rs b/filed/src/web/pages.rs index 6bf88ad..19339ad 100644 --- a/filed/src/web/pages.rs +++ b/filed/src/web/pages.rs @@ -31,6 +31,13 @@ pub struct Uploaded { pub env: Env } +#[derive(Template)] +#[template( path = "passworded-files.html" )] +#[allow(dead_code)] +pub struct PasswordedFilesHelpPage { + pub env: Env +} + pub async fn uploaded(query: HashMap, state: SharedState) -> Result, Rejection> { @@ -67,7 +74,22 @@ pub fn index_f(state: SharedState) -> impl Filter Result, Rejection> { + let rendered = PasswordedFilesHelpPage { + env: state.env.clone() + }; + Ok(warp::reply::html(rendered.render().map_err(|err| warp::reject::custom(HttpReject::AskamaError(err)))?)) +} + +pub fn passworded_f(state: SharedState) -> impl Filter + Clone { + warp::path!("password-files") + .and(warp::path::end()) + .map(move || state.clone()) + .and_then(passworded) +} + pub fn get_routes(state: SharedState) -> impl Filter + Clone { index_f(state.clone()) .or(uploaded_f(state.clone())) + .or(passworded_f(state)) } \ No newline at end of file diff --git a/filed/templates/index.html b/filed/templates/index.html index b147042..a6777b9 100644 --- a/filed/templates/index.html +++ b/filed/templates/index.html @@ -42,15 +42,30 @@

-

- - -

+ + + + + + + +
+ + + +

+

Password-protected file uploads

+ +

+ When uploading a file to blek! File, you may add a password to it, if it has confidential data. +

+ +

+ However, be aware that even though the file won't be sent unless the user provides a password, + + the instance owner will still be able to see the file contents without a password. +

+ +

Why can't the site encrypt it for me?

+

+ There is a number of reasons why that is a stupid idea. +

+
    +
  1. + This site's only purpose is to store files for short periods of time. + It doesnt include "storing the files securely", or encrypting them. +
  2. +
  3. + When the encryption happens server-side, there is a risk that the password could be logged. +
  4. +
+ +

How do I encrypt a file, then?

+

+ Its dead simple: download a program for encrypting files on your computer and use it to handle + all encryption operations. +

+

+ As for the encryption program, it is recommended to use + GnuPG + ( + Windows + Android + ). + + + Kleopatra + + is a cross-platform easy to use GUI for GPG. +

+ +

+ + Go back to upload + +

+
+ +{% endblock %} \ No newline at end of file