fix(asserter-consumer): add admin authentication and pinned tholos storage (#157) - #162
Closed
s6pa1rta3n-lab wants to merge 1 commit into
Closed
fix(asserter-consumer): add admin authentication and pinned tholos storage (#157)#162s6pa1rta3n-lab wants to merge 1 commit into
s6pa1rta3n-lab wants to merge 1 commit into
Conversation
…orage to prevent unauthorized assertion spoofing (drydocs#157)
Collaborator
|
@s6pa1rta3n-lab Closing. #157 has no assignee. Comment on the issue and wait to be assigned before opening a PR. |
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.
Summary
Resolves #157 by adding admin-gated initialization and caller authentication to
contracts/asserter-consumer.Root Cause
Previously,
AsserterConsumer::create_assertion_as_selfaccepted caller-suppliedtholos_id,token_id, andbond_amountparameters with no caller authentication (require_auth()). This allowed arbitrary callers to execute pre-authorized transfers of arbitrary tokens held by the contract address to arbitrary contract targets.Changes
DataKeyenum (Admin,TholosId,TokenId) andErrorenum (AlreadyInitialized,NotInitialized) incontracts/asserter-consumer/src/lib.rs.initialize(env, admin, tholos_id, token_id) -> Result<(), Error>entrypoint that verifiesadmin.require_auth()and pins the configuration in contract instance storage once.create_assertion_as_self(env, bond_amount, outcome) -> Result<u64, Error>to read stored configuration and enforceadmin.require_auth().get_status(env, id) -> Result<tholos::Assertion, Error>to read pinnedtholos_idfrom instance storage.contracts/asserter-consumer/src/test.rscovering:AlreadyInitialized).NotInitialized).NotInitialized).initializeandcreate_assertion_as_self.Verification
cargo test --workspace: all 183 tests passed (0 failures).cargo clippy --workspace --all-targets -- -D warnings: 0 warnings.cargo fmt --check: clean formatting.make build-wasm: WASM compilation verified.Payout Routing
0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC