Remove EPosition auth requirement from FlowALP beta cap transactions#175
Remove EPosition auth requirement from FlowALP beta cap transactions#175jordanschalm merged 10 commits intomainfrom
Conversation
…uthorized withdrawals The beta capability was granting both EParticipant and EPosition entitlements, which gave any beta user direct access to pool-level withdraw, withdrawAndPull, depositAndPush, lockPosition, unlockPosition, and borrowPosition methods. This allowed withdrawals from any user's position by ID. Beta users only need EParticipant (createPosition, depositToPosition) for normal operations. This removes EPosition from both the publish and claim transactions and their test copies. https://claude.ai/code/session_011G8tWcco9U7kPvNbf5kLgc
loic1
left a comment
There was a problem hiding this comment.
I think create position tx and create position not managed tx need to be updated too
https://github.com/onflow/FlowALP/blob/main/cadence/transactions/flow-alp/position/create_position.cdc#L79
cadence/tests/transactions/flow-alp/beta/claim_and_save_beta_cap.cdc
Outdated
Show resolved
Hide resolved
EPosition is an internal-only entitlement that should never be granted to external users. Replace with EParticipant (for position creation) or ERebalance (for rebalancing) as appropriate. Update adversarial reentrancy test connector to use EParticipant and depositToPosition instead of withdrawAndPull. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update AdversarialReentrancyConnectors to hold a PositionManager capability instead of a Pool capability. The adversarial source now attempts a reentrant withdrawal through the Position resource, which is the realistic attack vector since external users access positions through PositionManager, not the Pool directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cadence/tests/transactions/flow-alp/pool-management/03_grant_beta.cdc
Outdated
Show resolved
Hide resolved
Co-authored-by: Bastian Müller <bastian@turbolent.com>
👍 There were a few others too. Conceptually, |
Conflicts: cadence/contracts/FlowALPv0.cdc cadence/tests/contracts/AdversarialReentrancyConnectors.cdc cadence/tests/transactions/flow-alp/beta/claim_and_save_beta_cap.cdc cadence/tests/transactions/flow-alp/beta/publish_beta_cap.cdc cadence/tests/transactions/flow-alp/pool-management/03_grant_beta.cdc cadence/tests/transactions/flow-alp/pool-management/04_create_position.cdc cadence/tests/transactions/position-manager/create_position_reentrancy.cdc cadence/tests/transactions/position-manager/create_position_spoofing_source.cdc cadence/transactions/flow-alp/beta/claim_and_save_beta_cap.cdc cadence/transactions/flow-alp/beta/publish_beta_cap.cdc cadence/transactions/flow-alp/pool-management/rebalance_position.cdc cadence/transactions/flow-alp/position/create_position.cdc cadence/transactions/flow-alp/position/create_position_not_managed.cdc
…t exposing EPosition Resolves conflicts from merging main into the EPosition removal branch. Entitlements now reference FlowALPModels (main's refactor) while keeping EPosition out of all user-facing beta capabilities (this branch's fix). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Conflicts: cadence/tests/transactions/flow-alp/beta/claim_and_save_beta_cap.cdc cadence/tests/transactions/flow-alp/beta/publish_beta_cap.cdc cadence/tests/transactions/flow-alp/pool-management/04_create_position.cdc
m-Peter
left a comment
There was a problem hiding this comment.
Looks solid 👏
EPosition has been replaced by either EParticipant or ERebalance, but I think a few tests are now failing due to this replacement.
tim-barry
left a comment
There was a problem hiding this comment.
LGTM; seems the failing tests are ones marked related to the over-grant of capabilities, which should no longer be an issue after the changes made in this PR. We probably want to remove those tests, and may also want to add additional capability tests to ensure users aren't granted EPosition.
… test Remove EPosition and EParticipantPosition test sections from cap_test.cdc since EPosition-entitled pool capabilities are not used. Fix flaky test_supervisor_stale_uuid_does_not_panic by letting the initial cron tick fire before setting up stale state, avoiding a race with the scheduler. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Description
This PR removes the
FlowALPv0.EPositionauthorization requirement from all FlowALP transactions. This should have been done while implementing per-position positions in #130.This PR also re-works the
AdversarialReentrancyConnectors, which are used in testing. Previously they used theEPositionentitlement; here they are changed to use aPositionresource.https://claude.ai/code/session_011G8tWcco9U7kPvNbf5kLgc