Skip to content

test(forge-oracle): verify attacker signing for admin address is rejected#1

Open
Markodiba6399 wants to merge 3 commits into
mainfrom
test/oracle-initialize-auth-attacker-rejected
Open

test(forge-oracle): verify attacker signing for admin address is rejected#1
Markodiba6399 wants to merge 3 commits into
mainfrom
test/oracle-initialize-auth-attacker-rejected

Conversation

@Markodiba6399
Copy link
Copy Markdown
Owner

Summary

Adds test_attacker_signing_for_admin_address_is_rejected to the forge-oracle test suite.

Motivation

The existing test_initialize_admin_must_sign_for_supplied_address covers a caller nominating a third-party address without that party's signature. No test covered the complementary scenario: an attacker explicitly forging the admin's auth (i.e. mock_auths with address: &attacker but passing &admin as the initialize argument) and still being rejected.

What this test does

Phase 1 (attacker): Mocks auth as attacker signing for an initialize call that passes admin as the admin argument. admin.require_auth() fails because attacker did not sign for admin. Asserts try_initialize returns Err.

Phase 2 (admin): Mocks auth as admin signing for their own address. require_auth() is satisfied. Asserts try_initialize returns Ok.

Post-init: Asserts get_admin() == admin and get_admin() != attacker.

Notes

  • No mock_all_auths() used anywhere in the test
  • The 2 pre-existing failures (test_get_price_reverts_if_staleness_threshold_missing, test_transfer_admin_new_admin_can_submit_old_admin_cannot) are unrelated to this change and fail on main as well

Add requirements, design, and tasks for optional start_time
parameter in ForgeVesting::initialize(). Allows deployers to
pre-schedule a future vesting start rather than always starting
at deployment time. Past timestamps are rejected with InvalidConfig.
… gaps

- Create 5 proposals in sequence
- Assert returned IDs are exactly [0, 1, 2, 3, 4]
- Assert get_proposal_count() returns 5
- Assert get_proposal(0..4) all return valid proposals with correct proposer
- Assert get_proposal(5) returns ProposalNotFound
…cted

Add test_attacker_signing_for_admin_address_is_rejected which covers
the two-phase auth scenario for initialize():

Phase 1 — attacker mocks auth for the admin address but is not that
address; admin.require_auth() fails because attacker did not sign for
admin.

Phase 2 — real admin mocks auth for their own address; require_auth()
succeeds and get_admin() returns admin, not attacker.

The existing test_initialize_admin_must_sign_for_supplied_address covers
a caller nominating a third-party without that party's signature. This
new test covers the complementary case: an attacker explicitly forging
the admin's auth and still being rejected.
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.

2 participants