Fix/38 reveal key seller auth - #111
Merged
fejilaup-cloud merged 8 commits intoMar 27, 2026
Merged
Conversation
|
@Escelit Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…rt warnings in ip_registry tests
Contributor
Author
|
Please merge |
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.
Description:
reveal_key called require_auth() on the stored seller address but never verified the caller was the seller. Any address could pass auth checks (especially under mock_all_auths) and trigger payment release without being the legitimate seller.
Root cause: missing explicit caller == swap.seller assertion before auth.
Fix:
Added caller: Address parameter to reveal_key
Assert caller == swap.seller before caller.require_auth() — the identity check is a hard assert that cannot be bypassed by auth mocking or transaction crafting
Added test_unauthorized_reveal_key_rejected in basic_tests.rs: sets up a real Accepted swap, calls reveal_key with an attacker address, and expects a panic with "only the seller can reveal the key"
Also fixed (pre-existing blockers preventing compilation):
ip_registry: duplicate mod test, missing testutils feature flag, missing symbol_short import, owner borrow-after-move
lib.rs
: removed 5 duplicate stale mod tests blocks that were never compiling
Updated all reveal_key call sites in tests.rs and tests_simple.rs to pass the new caller arg
Tests: cargo test --workspace — 7/7 passing, 0 failures.
Closes #38