feat(build-sdk)!: verify trigger deliveries with Ed25519 public keys only
Type of change
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
What this changes
Reflex Build's trigger deliveries are signed with Ed25519 instead of a shared HMAC secret. The platform signs each delivery with a key pair of the app's own, one pair per environment, in Standard Webhooks' asymmetric format (v1a). The app receives only the public half, in REFLEX_TRIGGER_PUBLIC_KEY. A public key cannot sign anything, so a sandbox .env or a deployed app's environment holds no credential that could forge a delivery, for that app or any other.
HMAC is removed rather than kept beside it: the platform never sent an HMAC-signed delivery, so no app depends on it, and keeping it would leave a path where a secret in an app's environment signs something the app accepts.
reflex_build_sdk.triggers:
verifyandparse_deliverytakepublic_key=, or readREFLEX_TRIGGER_PUBLIC_KEY. Onlyv1asignatures are accepted. With several keys separated by spaces, any of them verifies, which is how a key is rotated out.- Removed: the
secret=argument,SECRET_ENV(REFLEX_TRIGGER_SECRET) andv1signatures. signtakeswhsk_signing keys only and makes onev1asignature per key;public_key(signing_key)gives thewhpk_half. Keys are base64 of the 32 raw Ed25519 bytes.- Ed25519 comes from
cryptography, which the newtriggersextra installs. It is imported when a key is first used, so the package keeps no required dependencies; without it, signing or verifying raises anImportErrorthat names the extra.
The pinned wire test now pins the v1a headers (Ed25519 signatures are deterministic), which flexgen's delivery tests match on the platform side. The old pinned HMAC headers stay as a vector that is refused.
Testing
uv run pytest tests/units/reflex_build_sdk: 825 passed. The trigger tests cover the pinnedv1aheaders, refusal ofv1signatures (including an HMAC made with the app's own public key, under either version), rotation across two keys, malformed keys and signatures, a tampered body, id or timestamp, and the missing-cryptographyerror.ruff check,ruff format,pyrighton the package and tests,pre-commiton the changed files, andscripts/check_min_deps.py reflex-build-sdkpass.
Releasing this needs a reflex-hosting-cli release that widens its cap on reflex-build-sdk in the same dispatch, as with 0.1.2.
Linear: ENG-14674
Generated by Claude Code