Skip to content

Fix/38 reveal key seller auth - #111

Merged
fejilaup-cloud merged 8 commits into
AtomicIP:mainfrom
Escelit:fix/38-reveal-key-seller-auth
Mar 27, 2026
Merged

fejilaup-cloud merged 8 commits into
AtomicIP:mainfrom
Escelit:fix/38-reveal-key-seller-auth

Conversation

@Escelit

@Escelit Escelit commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

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

@drips-wave

drips-wave Bot commented Mar 27, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@Escelit

Escelit commented Mar 27, 2026

Copy link
Copy Markdown
Contributor Author

Please merge

@fejilaup-cloud
fejilaup-cloud merged commit 3f7f6d2 into AtomicIP:main Mar 27, 2026
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.

Fix: reveal_key does not verify caller is the seller

2 participants