-
Notifications
You must be signed in to change notification settings - Fork 0
Add emoji packs and encrypted log management #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| def send_encrypted(sock, payload, session_cipher, local_cipher): | ||
| """Encrypt payload with local and session keys then send.""" | ||
| locally_encrypted = local_cipher.encrypt(payload.encode()) | ||
| session_encrypted = session_cipher.encrypt(locally_encrypted) | ||
| sock.sendall(session_encrypted) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P0] Avoid encrypting payloads with unshared local key
Messages are encrypted twice in send_encrypted: first with a locally generated Fernet key and then with the Diffie‑Hellman session key. The receiver reverses this in receive_messages, but load_or_create_key produces a random key.key on each host and there is no step that exchanges or synchronises that key with peers. As soon as two different machines connect, local_cipher.decrypt(...) raises InvalidToken and the receive loop exits, making chat sessions unusable unless users manually copy the same key.key between devices. If the intent is that the DH handshake secures the wire, the local cipher should only be used for at‑rest storage, not for network payloads.
Useful? React with 👍 / 👎.
| while True: | ||
| encrypted = sock.recv(65536) | ||
| if not encrypted: | ||
| break | ||
| locally_encrypted = session_cipher.decrypt(encrypted) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Buffer complete Fernet tokens before decrypting
The receive loop calls sock.recv(65536) once per iteration and immediately decrypts the result (receive_messages). TCP does not preserve message boundaries, so a single sendall of an encrypted chunk can be split across multiple recv calls or coalesced with adjacent messages. When this happens—especially for 32 KB file chunks whose encrypted tokens are ~44 KB—session_cipher.decrypt or local_cipher.decrypt will fail and the thread prints “Receive error” then stops processing further messages. A framing protocol or length-prefixed reads are needed here (and similarly in the server’s handle_client).
Useful? React with 👍 / 👎.
Summary
/emojicommands/nickTesting
python -m py_compile encrypted_chat/*.py build_exe.pyhttps://chatgpt.com/codex/tasks/task_e_68ba7a272ecc832b95275853cb750de6