Skip to content

feat(security): Add explicit OAuth-style CallScope for cross-contract token calls (Closes #1578)#1668

Merged
Baskarayelu merged 1 commit into
QuickLendX:mainfrom
tebney:feat/scope-tokens-1578
Jun 27, 2026
Merged

feat(security): Add explicit OAuth-style CallScope for cross-contract token calls (Closes #1578)#1668
Baskarayelu merged 1 commit into
QuickLendX:mainfrom
tebney:feat/scope-tokens-1578

Conversation

@tebney

@tebney tebney commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a typed CallScope and validates it in transfer_funds_scoped to ensure every cross-contract token transfer is accompanied by an OAuth-style scope token that matches the intended fromto direction.

Threat mitigated

Prevents confused-deputy style cross-contract token transfers where a caller could trick the contract into making a transfer on an unintended path. Mismatch returns UnauthorizedScope before any token interaction.

What this PR contains

  • CallScope enum and scope validation in quicklendx-contracts/src/payments.rs.
  • Negative tests exercising the check in quicklendx-contracts/src/test_scope_tokens.rs.

Testing notes

I could not run the Rust build and tests in this environment because the container is missing the Rust toolchain (cargo not found). Please run the following locally or in CI to verify:

cd quicklendx-contracts
cargo build --target wasm32-unknown-unknown --release
cargo test -p quicklendx-contracts
cargo clippy --workspace --all-targets -- -D warnings

Closes: #1578

… token calls

Closes QuickLendX#1578

Implement  validation and include negative tests in .
@Baskarayelu

Copy link
Copy Markdown
Contributor

Add explicit OAuth-style CallScope for cross-contract token calls (Closes #1578) — nice work, merging 👍

@Baskarayelu Baskarayelu merged commit e709ac0 into QuickLendX:main Jun 27, 2026
1 check failed
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.

Add explicit OAuth-style scope tokens for cross-contract calls

2 participants