Skip to content

Enforce Authentication and Validation on Fee Sponsorship Route #330

Open

Description

@thisisouvik

Description

The /api/sponsor endpoint (app/api/sponsor/route.ts) provides gasless transaction support by wrapping client transactions in a Stellar FeeBumpTransaction signed with the platform's ADMIN_SECRET_KEY.

Currently, this endpoint does not enforce session authentication or role authorization via requireAuthenticatedUser(). Furthermore, it does not inspect the operations inside the inner transaction XDR to verify that the target is a legitimate TrustLend protocol contract or valid platform operation. As a result, arbitrary unauthenticated requests could request fee bumps for unrelated Stellar transactions, depleting the platform treasury's XLM reserves.

Acceptance Criteria

  • Require authenticated borrower sessions via requireAuthenticatedUser("borrower").
  • Validate the inner transaction XDR to ensure it targets official TrustLend smart contracts or approved protocol operations before wrapping.
  • Implement strict per-user and per-wallet rate limits for fee sponsorship requests.
  • Ensure proper error handling and logging for unauthorized or malformed sponsorship attempts.

Activity

  1. Faymorce commented on Oct 21, 2026

    @Faymorce

    @Faymorce has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

    Hi Maintainer, I’ve looked through the issue and understand what needs to be done. I’m confident I can work on it successfully. Please consider assigning it to me.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Faymorce to this issue.

  2. huangji6693-max commented on Oct 26, 2026

    @huangji6693-max

    Submitted PR #461 implementing borrower session authentication (requireAuthenticatedUser("borrower")), inner transaction XDR contract/operation validation (validateSponsoredTransactionXdr), per-user and per-wallet rate limiting (enforceSponsorRateLimit), and unit tests (app/api/sponsor/route.test.ts).

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions