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] : CORE - Handling of empty localStorage item, remove default of empty string and perform a falsey check #2236

Merged
merged 4 commits into from
Jun 17, 2024

Conversation

Adamj1232
Copy link
Member

@Adamj1232 Adamj1232 commented Jun 17, 2024

Description

Handling of empty localStorage item, remove default of empty string and perform a falsey check.
Ensure that if an empty connect config object is passed and the user doesnt have a localStorage wallet set as the last used then handle check for the last connected wallet properly.
Also properly handles empty object passed in through connect({})
Closes: #2227
Closes: #2237

Checklist

  • Increment the version field in package.json of the package you have made changes in following semantic versioning and using alpha release tagging
  • Check the box that allows repo maintainers to update this PR
  • Test locally to make sure this feature/fix works
  • Run yarn check-all to confirm there are not any associated errors
  • Confirm this PR passes Circle CI checks
  • Add or update relevant information in the documentation

Tests with demo app (injected)

  • send transaction
  • switch chains
  • sign message
  • sign typed message
  • disconnect

Copy link

socket-security bot commented Jun 17, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@babel/helper-environment-visitor@7.22.20 None 0 6.56 kB nicolo-ribaudo
npm/@babel/helper-validator-option@7.22.15 None 0 11.6 kB nicolo-ribaudo
npm/@babel/parser@7.23.0 None 0 1.89 MB nicolo-ribaudo
npm/@esbuild/android-arm@0.18.20 None 0 11.1 MB evanw
npm/@esbuild/android-arm64@0.18.20 None 0 9.57 MB evanw
npm/@esbuild/android-x64@0.18.20 None 0 11.1 MB evanw
npm/@esbuild/darwin-arm64@0.18.20 None 0 9.51 MB evanw
npm/@esbuild/darwin-x64@0.18.20 None 0 9.92 MB evanw
npm/@esbuild/freebsd-arm64@0.18.20 None 0 8.65 MB evanw
npm/@esbuild/freebsd-x64@0.18.20 None 0 9.35 MB evanw
npm/@esbuild/linux-arm@0.18.20 None 0 8.85 MB evanw
npm/@esbuild/linux-arm64@0.18.20 None 0 8.65 MB evanw
npm/@esbuild/linux-ia32@0.18.20 None 0 8.9 MB evanw
npm/@esbuild/linux-loong64@0.18.20 None 0 9.11 MB evanw
npm/@esbuild/linux-mips64el@0.18.20 None 0 10.2 MB evanw
npm/@esbuild/linux-ppc64@0.18.20 None 0 8.91 MB evanw
npm/@esbuild/linux-riscv64@0.18.20 None 0 8.85 MB evanw
npm/@esbuild/linux-s390x@0.18.20 None 0 9.77 MB evanw
npm/@esbuild/linux-x64@0.18.20 None 0 9.35 MB evanw
npm/@esbuild/netbsd-x64@0.18.20 None 0 9.33 MB evanw
npm/@esbuild/openbsd-x64@0.18.20 None 0 9.37 MB evanw
npm/@esbuild/sunos-x64@0.18.20 None 0 9.33 MB evanw
npm/@esbuild/win32-arm64@0.18.20 None 0 8.76 MB evanw
npm/@esbuild/win32-ia32@0.18.20 None 0 9.2 MB evanw
npm/@esbuild/win32-x64@0.18.20 None 0 9.55 MB evanw
npm/@jridgewell/resolve-uri@3.1.1 None 0 55.2 kB jridgewell
npm/@types/node@17.0.45 None 0 1.68 MB types
npm/@web3-onboard/core@2.22.2-alpha.2 None 0 0 B
npm/caniuse-lite@1.0.30001549 None 0 2.14 MB caniuse-lite
npm/color-name@1.1.3 None 0 9.36 kB dfcreative
npm/escape-string-regexp@1.0.5 None 0 2.69 kB jbnicolai
npm/html-entities@2.3.3 None 0 95.5 kB mdevils
npm/json5@2.2.3 None 0 235 kB jordanbtucker
npm/nanoid@3.3.6 None 0 21.7 kB ai
npm/nanoid@4.0.2 None 0 15.3 kB ai
npm/node-releases@2.0.13 None 0 32.2 kB chicoxyzzy
npm/rxjs@7.8.1 None 0 4.5 MB blesh
npm/yallist@3.1.1 None 0 14.8 kB isaacs

🚮 Removed packages: npm/@esbuild-plugins/node-globals-polyfill@0.2.3, npm/@esbuild-plugins/node-modules-polyfill@0.2.2, npm/@ethersproject/basex@5.7.0, npm/@ethersproject/networks@5.7.0, npm/@ethersproject/providers@5.5.0, npm/@ethersproject/web@5.7.0, npm/@fontsource/fira-mono@4.5.10, npm/@jridgewell/sourcemap-codec@1.4.14, npm/@lit/reactive-element@1.6.1, npm/@rollup/plugin-commonjs@25.0.7, npm/@stablelib/random@1.0.2, npm/@sveltejs/adapter-auto@1.0.0-next.91, npm/@sveltejs/kit@1.0.0-next.589, npm/@types/cookie@0.5.1, npm/@types/estree@1.0.0, npm/@typescript-eslint/eslint-plugin@5.49.0, npm/@typescript-eslint/parser@5.49.0, npm/@walletconnect/jsonrpc-provider@1.0.13, npm/@walletconnect/jsonrpc-types@1.0.3, npm/@walletconnect/jsonrpc-utils@1.0.8, npm/@walletconnect/safe-json@1.0.2, npm/@walletconnect/window-getters@1.0.1, npm/@web3-onboard/injected-wallets@2.10.1, npm/@web3-onboard/walletconnect@2.3.9, npm/assert@2.1.0, npm/browserify-aes@1.2.0, npm/browserify-rsa@4.1.0, npm/browserify-zlib@0.2.0, npm/buffer@6.0.3, npm/call-bind@1.0.7, npm/cipher-base@1.0.4, npm/create-hash@1.2.0, npm/create-hmac@1.1.7, npm/crypto-browserify@3.12.0, npm/decode-uri-component@0.2.2, npm/deepmerge@4.3.0, npm/define-data-property@1.1.4, npm/eslint-config-prettier@8.6.0, npm/eslint-plugin-svelte3@4.0.0, npm/eslint@8.33.0, npm/evp_bytestokey@1.0.3, npm/fast-glob@3.2.12, npm/get-intrinsic@1.2.4, npm/has-property-descriptors@1.0.2, npm/has-tostringtag@1.0.2, npm/hash-base@3.0.4, npm/ieee754@1.2.1, npm/is-typedarray@1.0.0, npm/minimist@1.2.6, npm/normalize-path@3.0.0, npm/parse-asn1@5.1.7, npm/pbkdf2@3.1.2, npm/prettier-plugin-svelte@2.9.0, npm/prettier@2.8.3, npm/randombytes@2.1.0, npm/readable-stream@2.3.8, npm/ripemd160@2.0.2, npm/rollup-plugin-polyfill-node@0.12.0, npm/rollup@3.29.4, npm/safe-buffer@5.2.1, npm/sha.js@2.4.11, npm/stream-browserify@3.0.0, npm/string-width@3.1.0, npm/svelte-check@3.0.3, npm/svelte-preprocess@5.0.1, npm/svelte@3.55.1, npm/tslib@2.5.0, npm/typescript@4.9.5, npm/uint8arrays@3.1.1

View full report↗︎

Copy link

socket-security bot commented Jun 17, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
Install scripts npm/secp256k1@3.8.0
  • Install script: install
  • Source: npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."
  • orphan: npm/secp256k1@3.8.0
Install scripts npm/keccak@1.4.0
  • Install script: install
  • Source: npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation will be used."
  • orphan: npm/keccak@1.4.0

View full report↗︎

Next steps

What is an install script?

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

  • @SocketSecurity ignore npm/secp256k1@3.8.0
  • @SocketSecurity ignore npm/keccak@1.4.0

@Adamj1232 Adamj1232 merged commit f145192 into develop Jun 17, 2024
2 of 3 checks passed
@Adamj1232 Adamj1232 deleted the fix/disconnect_with_empty_localStore branch June 17, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant