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(siwe): createSiweMessage domain validation #2299

Merged
merged 1 commit into from
May 23, 2024
Merged

Conversation

tmm
Copy link
Member

@tmm tmm commented May 23, 2024

Domain validation was overly restrictive.

Fixes #2295


PR-Codex overview

This PR focuses on fixing createSiweMessage domain validation by adding tests for valid and invalid domains and updating the regex patterns.

Detailed summary

  • Added tests for valid and invalid domains in createSiweMessage.test.ts
  • Updated createSiweMessage to validate domains using new regex patterns
  • Added ipRegex and localhostRegex for domain validation

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented May 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
viem ✅ Ready (Inspect) Visit Preview May 23, 2024 7:44pm

Copy link

changeset-bot bot commented May 23, 2024

🦋 Changeset detected

Latest commit: fdfcbab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tmm tmm changed the title tmm/fix domain validation fix(siwe): createSiweMessage domain validation May 23, 2024
@tmm tmm force-pushed the tmm/fix-domain-validation branch from c9756ee to fdfcbab Compare May 23, 2024 19:39
Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
viem (esm) 56.85 KB (0%) 1.2 s (0%) 7.8 s (-36.5% 🔽) 9 s
viem (cjs) 68.21 KB (0%) 1.4 s (0%) 13.4 s (+12.69% 🔺) 14.8 s
viem (minimal surface - tree-shaking) 3.3 KB (0%) 67 ms (0%) 90 ms (-8.95% 🔽) 156 ms
viem/accounts 73.9 KB (0%) 1.5 s (0%) 4.2 s (+10.46% 🔺) 5.7 s
viem/accounts (tree-shaking) 19.17 KB (0%) 384 ms (0%) 1.3 s (-27.36% 🔽) 1.7 s
viem/actions 41.72 KB (0%) 835 ms (0%) 3.5 s (+15.73% 🔺) 4.4 s
viem/actions (tree-shaking) 318 B (0%) 10 ms (0%) 32 ms (-11.68% 🔽) 42 ms
viem/chains 27.85 KB (0%) 557 ms (0%) 5.9 s (+12.58% 🔺) 6.4 s
viem/chains (tree-shaking) 324 B (0%) 10 ms (0%) 53 ms (+42.86% 🔺) 63 ms
viem/chains/utils 1.02 KB (0%) 21 ms (0%) 80 ms (-20.01% 🔽) 100 ms
viem/ens 41.72 KB (0%) 835 ms (0%) 1.6 s (-58.69% 🔽) 2.5 s
viem/ens (tree-shaking) 18.41 KB (0%) 369 ms (0%) 4.9 s (+42.84% 🔺) 5.3 s

Copy link

codecov bot commented May 23, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 97.12%. Comparing base (f3d77e7) to head (fdfcbab).

Files Patch % Lines
src/utils/siwe/createSiweMessage.ts 75.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2299      +/-   ##
==========================================
- Coverage   99.70%   97.12%   -2.58%     
==========================================
  Files         680      675       -5     
  Lines       57684    57295     -389     
  Branches     2749     2455     -294     
==========================================
- Hits        57511    55647    -1864     
- Misses        156     1630    +1474     
- Partials       17       18       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tmm tmm marked this pull request as ready for review May 23, 2024 19:45
@jxom jxom merged commit 144d90e into main May 23, 2024
20 of 27 checks passed
@jxom jxom deleted the tmm/fix-domain-validation branch May 23, 2024 21:02
@github-actions github-actions bot mentioned this pull request May 23, 2024
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.

bug: SIWE Domain validation does not account for localhost:${port}.
2 participants