Fix: Harden Quick Auth replay protection, error handling, and Ed25519 consensus codecs - #29
Open
mertcano wants to merge 1 commit into
Open
Fix: Harden Quick Auth replay protection, error handling, and Ed25519 consensus codecs#29mertcano wants to merge 1 commit into
mertcano wants to merge 1 commit into
Conversation
… consensus codecs ### Description This PR applies the workspace-wide audit across the Farcaster/XMTP repositories, hardening Quick Auth replay protection, standardizing error propagation, eliminating unhandled async paths, updating supply-chain dependencies, and implementing strict Ed25519 consensus signature codecs in Snapchain. **Vulnerabilities & Security Defects Remediated:** * **Authentication & Replay Protection (`quick-auth/hono-cloudflare-worker/src/siwf.ts`):** Fixed a security vulnerability where signature verification and nonce consumption were executed in parallel. The function now strictly verifies the signature first and consumes the nonce only upon successful verification, preventing invalid signature requests from draining valid nonces. * **Error Propagation & Information Disclosure (`quick-auth/hono-cloudflare-worker/src/app.ts`):** The `/verify-siwf` endpoint previously returned raw exception details to callers. It now logs exceptions with full context internally and returns a stable public error message (`Failed to verify message`). * **Async Failure Handling (`quick-auth/hono-cloudflare-worker/src/durable-objects/noncePool.ts`):** `scheduleCleanup()` was previously invoked without awaiting its returned promise. It is now properly awaited so failures remain observable to the Durable Object request lifecycle. * **Consensus Runtime Safety (`snapchain/src/core/types.rs`):** Replaced placeholder `todo!()` implementations for Ed25519 `decode_signature` and `encode_signature` with strict validation logic that enforces an exact 64-byte signature length and handles lossless encoding/decoding. * **Supply-Chain Security & Toolchain Correctness:** Upgraded vulnerable versions of Hono and `ws` dependencies, and explicitly declared `typescript` in `package.json` to ensure clean typechecking across the worker environment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR applies the workspace-wide audit across the Farcaster/XMTP repositories, hardening Quick Auth replay protection, standardizing error propagation, eliminating unhandled async paths, updating supply-chain dependencies, and implementing strict Ed25519 consensus signature codecs in Snapchain.
Vulnerabilities & Security Defects Remediated:
quick-auth/hono-cloudflare-worker/src/siwf.ts): Fixed a security vulnerability where signature verification and nonce consumption were executed in parallel. The function now strictly verifies the signature first and consumes the nonce only upon successful verification, preventing invalid signature requests from draining valid nonces.quick-auth/hono-cloudflare-worker/src/app.ts): The/verify-siwfendpoint previously returned raw exception details to callers. It now logs exceptions with full context internally and returns a stable public error message (Failed to verify message).quick-auth/hono-cloudflare-worker/src/durable-objects/noncePool.ts):scheduleCleanup()was previously invoked without awaiting its returned promise. It is now properly awaited so failures remain observable to the Durable Object request lifecycle.snapchain/src/core/types.rs): Replaced placeholdertodo!()implementations for Ed25519decode_signatureandencode_signaturewith strict validation logic that enforces an exact 64-byte signature length and handles lossless encoding/decoding.wsdependencies, and explicitly declaredtypescriptinpackage.jsonto ensure clean typechecking across the worker environment.