Skip to content

fix: reject contract's own address as oracle in initialize#317

Merged
famvilianity-eng merged 2 commits intoStellarCheckMate:mainfrom
Sundriveauto:fix/oracle-address-validation
Mar 30, 2026
Merged

fix: reject contract's own address as oracle in initialize#317
famvilianity-eng merged 2 commits intoStellarCheckMate:mainfrom
Sundriveauto:fix/oracle-address-validation

Conversation

@Sundriveauto
Copy link
Copy Markdown
Contributor

@Sundriveauto Sundriveauto commented Mar 30, 2026

Closes #273


Problem

initialize accepted any Address as the oracle without validation. Passing the contract's own address as the oracle would make oracle.require_auth() in submit_result trivially satisfiable by the contract itself, permanently compromising result submission security.

Changes

errors.rs

  • Added Error::InvalidAddress = 12

lib.rs

  • Changed initialize return type from () to Result<(), Error>
  • Added guard: if oracle == env.current_contract_address() { return Err(Error::InvalidAddress) }
  • Updated doc comment to explain the constraint and why it matters

tests.rs

  • Added test_initialize_rejects_contract_address_as_oracle: registers a contract, passes its own address as oracle, asserts Error::InvalidAddress is returned

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@Sundriveauto 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

@famvilianity-eng famvilianity-eng merged commit 2efcdb9 into StellarCheckMate:main Mar 30, 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.

Fix: escrow contract does not validate that oracle address is not the zero address

2 participants