Skip to content

[Bug] DefindexAdapter does not authorize the token pull DeFindex makes from it #1128

Closed

Description

@collinsezedike

Summary

DefindexAdapter::deposit asks the DeFindex vault to move funds out of the adapter but never registers the nested token authorization that move consumes, so under real auth the call traps. BlendAdapter::deposit handles the identical call shape with env.authorize_as_current_contract; DefindexAdapter has no equivalent, and the adapter's tests run under mock_all_auths_allowing_non_root_auth, which hides the gap. It only surfaces once DEFINDEX_VAULT_ID is configured.

Tasks

  1. packages/contracts/defindex-adapter/src/lib.rs:175-193 calls client.deposit(&vec![...], &vec![...], &adapter, &true) after require_vault_auth but adds no env.authorize_as_current_contract(...) entry for the token transfer DeFindex performs from the adapter.
  2. packages/contracts/blend-adapter/src/lib.rs:123-133 shows the required pattern for this exact class of nested call.
  3. packages/contracts/defindex-adapter/src/lib.rs:228-258 has the same gap on the withdraw burn path.
  4. Add a positive auth-tree test mirroring blend-adapter's deposit_authorization_tree_matches_the_real_pool_call_shape, run without mock_all_auths_allowing_non_root_auth, so the requirement is exercised.

Scope

Field Value
Area Contracts
Protocol affected DeFindex
Network testnet and mainnet
Breaking change? No

Acceptance Criteria

  • deposit and withdraw register the nested token authorization the DeFindex vault consumes.
  • A test asserts the authorization tree without mocking all auths.
  • cargo fmt --all, cargo clippy --all-targets -- -D warnings, and cargo test --all pass under packages/contracts.

Additional Context

Found in a repository-wide code audit on 2026-10-18 and re-verified against the source at 66fad4d. Latent until DEFINDEX_VAULT_ID is set, which is also why no live test catches it.

Star the repo

Please star this repository before picking up this issue. It is a small ask that meaningfully helps the project reach more people.

Activity

  1. added
    bugSomething isn't working
    hardComplex implementation spanning multiple packages or involving Soroban contracts
    contractsInvolves writing or testing Rust/Soroban contracts in packages/contracts
    sorobanInvolves Soroban smart contract invocations or Soroban RPC calls
    on Oct 18, 2026
  2. MorsH14 commented on Oct 18, 2026

    @MorsH14

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

    I will love to work on this issue. Kindly assign

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

  3. liutingqiu commented on Oct 18, 2026

    @liutingqiu
    Contributor

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

    Plan: register the nested token authorization that DeFindex's pull consumes, using env.authorize_as_current_contract in DefindexAdapter::deposit exactly like BlendAdapter::deposit does for the same call shape. Then add a test that runs with the real auth path instead of mock_all_auths_allowing_non_root_auth so the gap cannot regress silently.Relevant: merged Rust-side security work in Sottara-Labs/sottara - #211 CSPRNG for mailbox device ids, #169 CSRF origins evaluated per request, plus the Soroban build/CI changes (#168).ETA: 1 day after assignment.

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

  4. ibochivincent-lang commented on Oct 18, 2026

    @ibochivincent-lang
    Contributor

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

    Hello maintainer can i work on this?

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

  5. drips-wave commented on Oct 18, 2026

    @drips-wave

    Congratulations, @ibochivincent-lang! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

    🧑‍💻 @ibochivincent-lang: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  6. grantfox-oss commented on Oct 25, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox!

    @ibochivincent-lang's PR #1173 was approved and merged by @collinsezedike.

    🏆 @ibochivincent-lang: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (796 total points). Track your full progress on GrantFox.

    👏 Great work, @ibochivincent-lang! Keep contributing to drydocs.

  7. drips-wave commented on Oct 25, 2026

    @drips-wave

    This issue has been completed by @ibochivincent-lang as part of the Stellar Wave Program's 10th Wave 🥳

    😎 @ibochivincent-lang: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

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

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't workingcontractsInvolves writing or testing Rust/Soroban contracts in packages/contractshardComplex implementation spanning multiple packages or involving Soroban contractssorobanInvolves Soroban smart contract invocations or Soroban RPC calls

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions