Skip to content

Commit c1af592

Browse files
committed
fix: use proper Argon2 params
1 parent 93d4f07 commit c1af592

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

core/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@
8181
}
8282

8383
# hash parameters
84-
ARGON2_MEMORY = 1024 * 1024 # MB
85-
ARGON2_ITERS = 2000
84+
ARGON2_MEMORY = 1 * 1024**3 # GB
85+
ARGON2_ITERS = 4
8686
ARGON2_OUTPUT_LEN = 64 # bytes
8787
ARGON2_SALT_LEN = 16 # bytes (Must be always 16 for interoperability with implementations using libsodium.)
8888
ARGON2_LANES = 4

core/requests.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ def http_request(url: str, method: str, auth_token: str = None, metadata: dict =
101101
if metadata is not None:
102102
body += encode_field("metadata", json.dumps(metadata), boundary, CRLF)
103103

104-
body += encode_file("blob", "blob.bin", blob, boundary, CRLF)
104+
# typical maxmimum filename is around 255 characters long.
105+
blob_filename = ''.join(secrets.choice(ALPHABET_ASCII) for _ in range(secrets.randbelow(255) + 1))
106+
107+
body += encode_file("blob", blob_filename + ".bin", blob, boundary, CRLF)
105108

106109
if not body.endswith(CRLF.encode("utf-8")):
107110
body += CRLF.encode("utf-8")

logic/storage.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import json
1212
import copy
1313
import logging
14+
import secrets
1415

1516

1617
logger = logging.getLogger(__name__)
@@ -36,10 +37,14 @@ def load_account_data(password = None) -> dict:
3637

3738
user_data = json.loads(crypto.decrypt_xchacha20poly1305(password_kdf, blob[:12], blob[12:]))
3839

39-
40+
41+
with open(Path("assets") / "browsers_headers.json", "r") as f:
42+
browser_headers = json.load(f)
43+
4044

4145
user_data["tmp"] = {
4246
"password": password,
47+
"session_headers": secrets.choice(list(browser_headers.values())),
4348
"new_ml_kem_keys": {},
4449
"new_code_kem_keys": {}
4550
}

0 commit comments

Comments
 (0)