Skip to content

[ANCHOR-1154] Validate SEP-38 quote expiration#1893

Open
philipliu wants to merge 1 commit intodevelopfrom
philip/anchor-1154-validate-sep38-quote-expiry
Open

[ANCHOR-1154] Validate SEP-38 quote expiration#1893
philipliu wants to merge 1 commit intodevelopfrom
philip/anchor-1154-validate-sep38-quote-expiry

Conversation

@philipliu
Copy link
Contributor

@philipliu philipliu commented Feb 26, 2026

Description

Validate that the SEP-38 quote expires in SEP-6/24/31 request handlers.

Context

The endpoints should not accept expired quotes by default but validating the expiration at this stage is not enough because the quote can expire when the funds arrive. This is more of a hardening fix.

Testing

  • ./gradlew test

Documentation

N/A

Known limitations

N/A

@philipliu philipliu changed the title 'Validate SEP-38 quote expiration [ANCHOR-1154] Validate SEP-38 quote expiration Feb 26, 2026
@philipliu philipliu force-pushed the philip/anchor-1154-validate-sep38-quote-expiry branch from 03f75b1 to 7e5bdf9 Compare February 26, 2026 22:50
@philipliu philipliu marked this pull request as ready for review February 27, 2026 21:15
Copilot AI review requested due to automatic review settings February 27, 2026 21:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds server-side hardening to reject expired SEP-38 quotes during request handling for SEP-6/24/31 flows by introducing consistent, injectable time sources and enforcing expires_at checks where quotes are validated/consumed.

Changes:

  • Introduce a shared UTC Clock bean and inject it into SEP wiring and time-dependent components.
  • Enforce quote-expiration validation in ExchangeAmountsCalculator (affecting SEP-6/24 quote usage) and in Sep31Service quote pre-validation.
  • Update and extend unit tests to cover expired-quote scenarios and constructor signature changes.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
platform/src/main/java/org/stellar/anchor/platform/component/sep/SepBeans.java Adds a UTC Clock bean and wires it into NonceManager, ExchangeAmountsCalculator, and Sep31Service.
core/src/main/java/org/stellar/anchor/util/ExchangeAmountsCalculator.java Validates quote.expiresAt against an injected Clock when validating quotes for SEP-6/24.
core/src/main/java/org/stellar/anchor/sep31/Sep31Service.java Rejects expired quotes during SEP-31 postTransaction pre-validation using an injected Clock.
core/src/test/kotlin/org/stellar/anchor/util/ExchangeAmountsCalculatorTest.kt Updates constructor usage and adds a test to ensure expired quotes are rejected.
core/src/test/kotlin/org/stellar/anchor/sep31/Sep31ServiceTest.kt Updates constructor usage and adds coverage for expired quote_id.
core/src/test/kotlin/org/stellar/anchor/sep24/Sep24ServiceTest.kt Updates ExchangeAmountsCalculator construction to include Clock.
core/src/test/kotlin/org/stellar/anchor/util/ClientFinderTest.kt Removes cross-test coupling by using the local token reference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants