feat(security): Add explicit OAuth-style CallScope for cross-contract token calls (Closes #1578)#1668
Merged
Conversation
… token calls Closes QuickLendX#1578 Implement validation and include negative tests in .
Contributor
|
Add explicit OAuth-style CallScope for cross-contract token calls (Closes #1578) — nice work, merging 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a typed
CallScopeand validates it intransfer_funds_scopedto ensure every cross-contract token transfer is accompanied by an OAuth-style scope token that matches the intendedfrom→todirection.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
UnauthorizedScopebefore any token interaction.What this PR contains
CallScopeenum and scope validation inquicklendx-contracts/src/payments.rs.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 (
cargonot found). Please run the following locally or in CI to verify:Closes: #1578