Skip to content
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

fix: [spearbit-82] Session key init perms #80

Merged
merged 3 commits into from
Jan 22, 2024

Conversation

adam-alchemy
Copy link
Contributor

@adam-alchemy adam-alchemy commented Jan 19, 2024

Motivation

https://github.com/spearbit-audits/alchemy-nov-review/issues/82

Additionally, the account clients team requested the ability to add permission updates to addSessionKey and to the onInstall method of SessionKeyPlugin to improve the developer experience of working with session keys.

Solution

Change updateKeyPermissions from external visibility to public.

Add an extra bytes[] parameter to addSessionKey, which chains an internal call to updateKeyPermissions.

Add an extra bytes32[] and a bytes[][] parameter to the abi-decoding of the plugin install data, which contains tags and permissions for each key, respectively.

  • The logic within updateKeyPermissions depends on the updates being a calldata type, so we manually decode the type.

Add test cases using these two paths for updating key permissions.

Update existing test cases for the new parameter format.

Copy link
Collaborator

@howydev howydev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from adam/session-key-merge to audit-2023-11-20 January 19, 2024 21:38
@adam-alchemy adam-alchemy force-pushed the adam/session-key-init-perms branch from 44cf18d to 4dbf9d7 Compare January 19, 2024 22:24
Copy link
Collaborator

@jaypaik jaypaik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just need to rebase for the unchecked { ++i; } cleanup i think?

src/plugins/session/SessionKeyPlugin.sol Outdated Show resolved Hide resolved
@adam-alchemy adam-alchemy changed the title feat: Session key init perms fix: [spearbit-82] Session key init perms Jan 22, 2024
@adam-alchemy adam-alchemy force-pushed the adam/session-key-init-perms branch from 4dbf9d7 to 7b3108f Compare January 22, 2024 16:50
@adam-alchemy adam-alchemy merged commit fead83d into audit-2023-11-20 Jan 22, 2024
3 checks passed
@adam-alchemy adam-alchemy deleted the adam/session-key-init-perms branch January 22, 2024 17:29
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.

4 participants