-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Framework] Safe onchain key rotation address mapping for standard accounts #14309
Conversation
⏱️ 9s total CI duration on this PR
|
This issue is stale because it has been open 45 days with no activity. Remove the |
Bumping per stale label and recently merged AIP |
This PR is related to AIP-101 and has been approved/ready to land. aptos-foundation/AIPs#487 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
7b40e76
to
59b7f51
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
47a7642
to
1956a21
Compare
cc @junkil-park: just a heads up that a new private |
1956a21
to
91cf802
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
91cf802
to
5a591c2
Compare
5a591c2
to
63fe9d6
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
63fe9d6
to
9394252
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
@banool @gregnazario
Closes #13517
AIP: aptos-foundation/AIPs#487
Background
There are currently several issues with the
OriginatingAddress
table (which issupposed to be a one-to-one lookup table) that render the mapping unsafe in
practice:
OriginatingAddress
followup reconciliation function for key rotations without a proof challenge #13517,rotate_authentication_key_call
does not update theOriginatingAddress
table for an "unproven" key rotation without aRotationProofChallenge
(resolved in this PR with newset_originating_address
private entry function).already been mapped) to a different originating address, the inner function
update_auth_key_and_originating_address_table
overwrites the initialmapping, rather than aborting. This oversight can lead to account loss if
someone accidentally attempts to rotate to the same authentication key twice
(resolved in this PR with
ENEW_AUTH_KEY_ALREADY_MAPPED
check), because theywill not be able to identify their account from private key alone unless they
keep an external record of the rotated accounts the private key in question
has been used to secure.
in the
OriginatingAddress
table, such that two accounts can beauthenticated by the same authentication key: the original account whose
address is its authentication key, and another account that has had its
authentication key rotated to the authentication key of the original account.
Since
OriginatingAddress
is one-to-one, a dual-account situation caninhibit indexing and OpSec (resolved in this PR with
set_originating_address
private entry function).Contribution history
I originally proposed a large set of changes associated with authentication key
rotation for accounts secured by a Ledger wallet in #11151, which paired with a
docs PR at aptos-labs/developer-docs#367. Due to the key
rotation issues raised during development functionality, I included the features
now isolated in this PR.
However, due to the difficulty of merging large sets of changes as an external
contributor, I'm splitting off into this PR the minimum amount of functionality
required to support safe authentication key rotation mapping, as I did similarly
in #14084 and #14266.
Verifying the changes in this PR
Install the Aptos CLI from source using the changes in this PR.
Make a new test directory called
localnet-data
, then use it to start alocalnet with the framework changes in this PR:
Save the localnet shell running off to the side.
In a new shell, create a private key file:
Use it to create a localnet profile:
aptos init \ --network local \ --private-key-file keyfile-a \ --profile localnet-a
Store the address:
Use the new
originating_address
view function to observe that the accountdoes not have an entry in the
OriginatingAddress
table:aptos move view \ --args address:$ADDR_A \ --function-id 0x1::account::originating_address \ --profile localnet-a
Use the new
set_originating_address
private entry function to set a mappingin the table:
Check the
originating_address
view function again and note the result:aptos move view \ --args address:$ADDR_A \ --function-id 0x1::account::originating_address \ --profile localnet-a
Now that you've established a one-to-one mapping for the authentication key,
the new check for
ENEW_AUTH_KEY_ALREADY_MAPPED
inupdate_auth_key_and_originating_address_table
will prevent another accountfrom rotating its authentication key to that of
keyfile-a
, thus preservinga one-to-one mapping. To verify this, create a new profile:
aptos init \ --network local \ --profile localnet-b
Press
enter
when prompted to generate a new private key for the profile.Then observe the new guard against breaking the one-to-one mapping, by
trying to rotate the authentication key to that of
keyfile-a
:Housekeeping
The following was run from repository root to ensure CI passes:
cargo build -p aptos-cached-packages pre-commit run --all-files scripts/rust_lint.sh aptos move test --package-dir aptos-move/framework/aptos-framework/ --dev