返回资讯中心
外部精选
软件工程
#开发者实时流

Show HN: ReplayGuard – Exploring replay attack prevention for APIs

Does your durable workflow charge the card twice when it crashes?

Hacker News 最新pragashvenkat2026/11/10 · 7 天前7 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

Does your durable workflow charge the card twice when it crashes?

▶ Watch the 5-minute demo: a checkout workflow that double-charges under a crash, the one-line fix, the three runtimes, and three engine behaviours ReplayGuard found (rivet-dev/workflows#17, #18, #19).

Rivet workflows replay safely after crashes and restarts, but calls to external systems (payments, email, APIs) sit outside that durability guarantee. ReplayGuard runs your workflow, injects crashes, lost responses and timeouts around each external call, restarts it the way a real host would, and reports the outcome for every effect:

Status: pre-release. Every spec in specs/ is implemented. Packages are not yet published. spikes/engine-assumptions/FINDINGS.md describes the engine behaviors ReplayGuard detects.

This example runs as a test in packages/replayguard/test/index.test.ts.

// vitest.config.ts: test: { setupFiles: ["replayguard/setup"] } import { createFakePayment, fault, idempotencyKey, scenario } from "replayguard"; import { workflowsRuntime } from "@replayguard/adapter-workflows";

const result = await scenario() .runtime(workflowsRuntime()) .effects((ctx) => ({ payment: createFakePayment(ctx) })) .workflow(({ payment }) => async (wf) => wf.step("charge", () => payment.charge({ orderId: "o-1", amount: 500, idempotencyKey: idempotencyKey(wf, "charge") }))) .case("crash after charge", [fault.crashAfter("payment.charge")]) .explore() .build() .run({ classify: true });

expect(result).toPassSideEffectPolicy();

Remove the idempotencyKey and the test fails, because the crash makes the payment duplicated. Each failing effect explains its cause and comes with a fix hint. See outcomes, fixing duplicates, fakes, reporters, Vitest matchers and RivetKit actors.

Package Purpose

replayguard Facade over core, fakes and Vitest matchers

@replayguard/core Effect ledger, faults, scenario runner, classifier, report model (pure TS)

@replayguard/fakes Fake payment, email, HTTP and webhook services

@replayguard/adapter-workflows @rivet-dev/workflows runtime (in-process and process-kill)

@replayguard/adapter-rivetkit RivetKit workflow actor runtime

@replayguard/reporter-console / -html Terminal table and self-contained HTML timeline

@replayguard/vitest toPassSideEffectPolicy() and other matchers

Repository

Constitution: principles, quality gates and design patterns

Architecture: HLD, ports and patterns; diagrams are in docs/architecture/diagrams/

Specs: one folder per feature, each with HLD, LLD, workflow and architecture diagrams

Backlog exports: Jira CSV/JSON, GitHub Issues and generic CSV

Contributing · Security · Releasing

License

Apache-2.0

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →