Commit 864928e0 authored by Raleigh's avatar Raleigh
Browse files

HTTPUpload: Filename obfuscation feature

Instead of sending the actual filename to the server, user can choose to send a SHA1 hash. This can be useful when you use encryption and don't want to leak the filenames.
parent b7a974a7
Pipeline #5155 canceled with stages
......@@ -346,6 +346,7 @@ class Config:
'opened_chat_controls': [opt_str, '', _('List of XMPP Addresses (space separated) for which the chat window will be re-opened on next startup.')],
'recent_groupchats': [opt_str, ''],
'httpupload_verify': [opt_bool, True, _('HTTP File Upload: Enable HTTPS Verification.')],
'httpupload_obfuscate_filename': [opt_bool, False, _('HTTP File Upload: Obfuscate (sha1) the name of the file uploaded to a server.')],
'filetransfer_preference' : [opt_str, 'httpupload', _('Preferred file transfer mechanism for file drag&drop on a chat window. Can be \'httpupload\' (default) or \'jingle\'.')],
'allow_posh': [opt_bool, True, _('Allow certificate verification with POSH.')],
}, {}),
......
......@@ -19,6 +19,7 @@ import os
import io
from urllib.parse import urlparse
import mimetypes
import hashlib
from nbxmpp import NS_HTTPUPLOAD_0
from nbxmpp.util import is_error_result
......@@ -354,7 +355,12 @@ class HTTPFileTransfer(FileTransfer):
@property
def filename(self):
return os.path.basename(self._path)
basename = os.path.basename(self._path)
if app.config.get_per('accounts',self._account,'httpupload_obfuscate_filename'):
sha = hashlib.sha1(basename.encode('utf-8')).hexdigest()
return sha
else:
return basename
def set_error(self, text=''):
self._close()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment