Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

MemoryStore should evict claims once their challenge expires

Đang mở
#25 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
java
Lĩnh vực
backend, payments, security

Hướng nghiên cứu

Xem xét interface Store và triển khai MemoryStore, sau đó theo dõi TempoChargeIntent.matchTransferLogs và flow challenge đã được xác minh của nó. Xác nhận cách memo giao dịch có thể liên kết một khoản thanh toán với một challenge duy nhất trước khi thay đổi cách xử lý claim. Hoàn thành khi có thể loại bỏ các claim đã hết hạn mà không cho phép replay attack, đồng thời vẫn giữ interface và payment flow nhất quán.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Bind replay claims to challenge expiry. Ex. tryClaim(key, expiresAt).

Background

Store.tryClaim(key) (added in #24) retains transaction-hash claims forever. Every verified payment leaves a permanent entry, so any durable store grows without bound.

The typescript mppx SDK solved this by storing a marker that lapses at the challenge's expiry. One a challenge has expired, there's no reason to keep a cache entry for its associated transaction as it can no longer be claimed by an agent.

Using an expiry/TTL is safe in the typescript SDK because it cryptographically binds on-chain transaction memos to to a specific challenge. Therefore, a settled transaction can only satisfy exactly one challenge.

The mpp-java SDK has no such binding. TempoChargeIntent.matchTransferLogs compares only
currency, recipient, amount, and sender. Adding claim expiry would be a regression and make servers susceptible to replay attacks.

Proposed change

Implement memo binding between on-chain transactions and challenges. Then, once memo binding is in place, update the Store interface:

@FunctionalInterface
public interface Store {
    boolean tryClaim(String key);

    /** Claims {@code key} until {@code expiresAt}, after which the claim may be dropped. */
    default boolean tryClaim(String key, Instant expiresAt) {
        return tryClaim(key);
    }
}

TempoChargeIntent should pass the verified challenge's expires as expiresAt.

Why?

  • Prevents unbound growth in MemoryStore
  • Achieves parity with other SDKs
Ngôn ngữ chính
Java
Star
8
Fork
8
Merge trung bình
14 giờ 52 phút
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của stripe/mpp-java

Tất cả issue của stripe/mpp-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.