Fix alpha crypto crash and harden IRC transport #1

Open
kossy wants to merge 1 commit from fix/alpha-crypto-and-transport-hardening into master
Owner

Repair the broken key-derivation path and close several ways the
prototype could silently expose or drop message content, plus
cross-implementation interop fixes found in review.

Security:

  • Strip CR/LF/NUL from decrypted plaintext before it re-enters the
    client protocol stream (WeeChat modifier, ZNC), preventing IRC
    line injection by a key-sharing peer.
  • Fail closed instead of downgrading to plaintext when keys.json is
    corrupt/unreadable (WeeChat, irssi, ZNC).
  • Encrypt /msg and /notice in irssi, which bypassed the send-text
    hook and went out in cleartext.
  • Sign and verify the whole invite envelope, not just the embedded
    identity document, so created/transport/tor/note are tamper-evident.
  • Refuse to overwrite an already-verified contact with a different
    identity unless forced.

Fixed:

  • Use crypto_scalarmult for X25519 DH; the previous .exchange() call
    crashed every invite/accept with AttributeError.
  • Unify key fingerprints on SHA-256 128-bit colon-grouped form so the
    ZNC bouncer and the Python clients agree (was BLAKE2b/base64, 64-bit).
  • Accept empty-plaintext capsules (off-by-one on the length check) in
    the core and ZNC.
  • Decrypt inbound NOTICE and locally echo own messages in irssi.
  • Treat + and ! channels as channels in the WeeChat receive path.
  • Trim whitespace in ZNC NormalizeTarget to match the other clients.

Added:

  • Split over-long messages into self-contained AISM1 capsules that each
    fit an IRC line and decrypt independently (core, both clients, ZNC).

Changed:

  • Rewrite the test suite into discoverable test_* functions with new
    coverage; cache keys.json by mtime; drop the unused trust.json.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

Repair the broken key-derivation path and close several ways the prototype could silently expose or drop message content, plus cross-implementation interop fixes found in review. Security: - Strip CR/LF/NUL from decrypted plaintext before it re-enters the client protocol stream (WeeChat modifier, ZNC), preventing IRC line injection by a key-sharing peer. - Fail closed instead of downgrading to plaintext when keys.json is corrupt/unreadable (WeeChat, irssi, ZNC). - Encrypt /msg and /notice in irssi, which bypassed the send-text hook and went out in cleartext. - Sign and verify the whole invite envelope, not just the embedded identity document, so created/transport/tor/note are tamper-evident. - Refuse to overwrite an already-verified contact with a different identity unless forced. Fixed: - Use crypto_scalarmult for X25519 DH; the previous .exchange() call crashed every invite/accept with AttributeError. - Unify key fingerprints on SHA-256 128-bit colon-grouped form so the ZNC bouncer and the Python clients agree (was BLAKE2b/base64, 64-bit). - Accept empty-plaintext capsules (off-by-one on the length check) in the core and ZNC. - Decrypt inbound NOTICE and locally echo own messages in irssi. - Treat + and ! channels as channels in the WeeChat receive path. - Trim whitespace in ZNC NormalizeTarget to match the other clients. Added: - Split over-long messages into self-contained AISM1 capsules that each fit an IRC line and decrypt independently (core, both clients, ZNC). Changed: - Rewrite the test suite into discoverable test_* functions with new coverage; cache keys.json by mtime; drop the unused trust.json. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repair the broken key-derivation path and close several ways the
prototype could silently expose or drop message content, plus
cross-implementation interop fixes found in review.

Security:
- Strip CR/LF/NUL from decrypted plaintext before it re-enters the
  client protocol stream (WeeChat modifier, ZNC), preventing IRC
  line injection by a key-sharing peer.
- Fail closed instead of downgrading to plaintext when keys.json is
  corrupt/unreadable (WeeChat, irssi, ZNC).
- Encrypt /msg and /notice in irssi, which bypassed the send-text
  hook and went out in cleartext.
- Sign and verify the whole invite envelope, not just the embedded
  identity document, so created/transport/tor/note are tamper-evident.
- Refuse to overwrite an already-verified contact with a different
  identity unless forced.

Fixed:
- Use crypto_scalarmult for X25519 DH; the previous .exchange() call
  crashed every invite/accept with AttributeError.
- Unify key fingerprints on SHA-256 128-bit colon-grouped form so the
  ZNC bouncer and the Python clients agree (was BLAKE2b/base64, 64-bit).
- Accept empty-plaintext capsules (off-by-one on the length check) in
  the core and ZNC.
- Decrypt inbound NOTICE and locally echo own messages in irssi.
- Treat + and ! channels as channels in the WeeChat receive path.
- Trim whitespace in ZNC NormalizeTarget to match the other clients.

Added:
- Split over-long messages into self-contained AISM1 capsules that each
  fit an IRC line and decrypt independently (core, both clients, ZNC).

Changed:
- Rewrite the test suite into discoverable test_* functions with new
  coverage; cache keys.json by mtime; drop the unused trust.json.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/alpha-crypto-and-transport-hardening:fix/alpha-crypto-and-transport-hardening
git switch fix/alpha-crypto-and-transport-hardening

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff fix/alpha-crypto-and-transport-hardening
git switch fix/alpha-crypto-and-transport-hardening
git rebase master
git switch master
git merge --ff-only fix/alpha-crypto-and-transport-hardening
git switch fix/alpha-crypto-and-transport-hardening
git rebase master
git switch master
git merge --no-ff fix/alpha-crypto-and-transport-hardening
git switch master
git merge --squash fix/alpha-crypto-and-transport-hardening
git switch master
git merge --ff-only fix/alpha-crypto-and-transport-hardening
git switch master
git merge fix/alpha-crypto-and-transport-hardening
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kossy/aism-alpha!1
No description provided.