Skip to content

Add contract test: unauthorized access attempts#110

Open
WuXieSec wants to merge 1 commit intosorosave-protocol:mainfrom
WuXieSec:test/unauthorized-access
Open

Add contract test: unauthorized access attempts#110
WuXieSec wants to merge 1 commit intosorosave-protocol:mainfrom
WuXieSec:test/unauthorized-access

Conversation

@WuXieSec
Copy link
Copy Markdown

This PR adds comprehensive tests to verify that all admin and member functions properly reject unauthorized callers, as requested in #26.

Changes:

  • Test non-admin calling pause_groupUnauthorized error
  • Test non-admin calling resolve_disputeUnauthorized error
  • Test non-admin calling emergency_withdrawUnauthorized error
  • Test non-member calling contributeNotMember error
  • Verify correct error codes for each scenario

Test coverage:
These tests ensure the contract properly enforces:

  • Admin-only functions reject non-admin callers
  • Member-only functions reject non-member callers
  • Appropriate error codes are returned for each violation

Why this matters:
Access control is critical for security. These tests validate that:

  • Only group admins can pause/resume groups
  • Only group admins can resolve disputes
  • Only group admins can trigger emergency withdrawals
  • Only group members can contribute

Closes #26

Changes:
- Test non-admin calling pause_group (Unauthorized)
- Test non-admin calling resolve_dispute (Unauthorized)
- Test non-admin calling emergency_withdraw (Unauthorized)
- Test non-member calling contribute (NotMember)
- Verify correct error codes for each scenario

These tests ensure the contract properly enforces access
control for admin-only and member-only functions.

Closes sorosave-protocol#26
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 contract test: unauthorized access attempts

1 participant