-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
Bump @spruceid/siwe-parser to 2.1.0 #4141
Conversation
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/apg-js@4.3.0 |
74a113f
to
4613ae4
Compare
Each commit takes a different approach to testing. In the first commit, I am explicit about the expected return values within the code. However, comparing them to the output of the In the second commit, I switch this to be less explicit, but easier test maintainability/cleaner code. This is what i'm proposing in the final changes. Open to discussion if anyone feels strongly about the approach. |
@@ -251,12 +240,12 @@ describe('siwe', () => { | |||
origin, | |||
})}`, () => { | |||
const result = isValidSIWEOrigin({ | |||
from: '0x0', | |||
from: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing due to the fact the previous value was not a valid EIP-55 address which is required for SIWE: https://eips.ethereum.org/EIPS/eip-4361#abnf-message-format
address = "0x" 40*40HEXDIG
; Must also conform to capitalization
; checksum encoding specified in EIP-55
; where applicable (EOAs).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
#24138) ## **Description** Resolves @spruceid/siwe-parser 1.1.3 → 2.1.0 The updated @spruceid/siwe-parser allows `http` and `https` schemas in a transaction message's URL. Additional changes are included in the @spruceid/siwe-parser upgrade from v1.1.3 → v2.1.0. One important update is the requirement of [EIP-55](https://npmfs.com/package/@spruceid/siwe-parser/1.1.3/lib/abnf.ts) complaint addresses. This means that if a dapp attempts to sign a `personal_sign` message with a from address that is not EIP-55 compliant, SIWE will not be detected. This is what we want as [EIP-4361](https://eips.ethereum.org/EIPS/eip-4361) enforces EIP-55 addresses. There's a separate ticket that'll warn users if a `personal_sign` message looks like a SIWE but doesn't parse to a SIWE message: #24128 Issue to update test-dapp SIWE addresses to be EIP-55 complaint: MetaMask/test-dapp#326 Related Links (Thanks @NicholasEllul for these): - https://app.warp.dev/block/4eE6QC12lVuwARbpFj62VJ - https://npmfs.com/package/@spruceid/siwe-parser/1.1.3/lib/abnf.ts ## **Related issues** Fixes: MetaMask/MetaMask-planning#2256 Relates To: MetaMask/MetaMask-planning#2278 Related to: #24107 Related to: MetaMask/core#4153 Related to: MetaMask/core#4141 ## **Manual testing steps** 1. Go to the metamask test-dapp or run the test-dapp locally 2. When testing locally, optionally update the from addresses used by the buttons 3. Test Sign-in With Ethereum buttons 4. Observe MM ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com> Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Nicholas Ellul <nicholas.ellul1@gmail.com>
Explanation
This pull request bumps the siwe-parser to the latest version which adds additional support for the
scheme
parameter. I also refactor the tests to explicitly call the siwe-parser library to act as a smoke test that can catch any issues in the future. This will make breaking changes easier to catch.References
https://github.com/MetaMask/MetaMask-planning/issues/2278
Changelog
None
Checklist