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: NWC connection URL and improve checks to see if balance is supported #226

Merged
merged 3 commits into from
May 12, 2024

Conversation

rolznz
Copy link
Collaborator

@rolznz rolznz commented May 12, 2024

Fixes #224
Fixes #225

  • update js-sdk dependency to support passing NWC URLs without // in protocol scheme
  • Improved checks to see if getBalance is supported, and balance components will no longer be shown if it is not

Copy link

socket-security bot commented May 12, 2024

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

Package New capabilities Transitives Size Publisher
npm/@getalby/sdk@3.5.1 Transitive: network +5 2.84 MB
npm/eslint-visitor-keys@3.4.1 None 0 32.3 kB eslintbot
npm/eslint@8.57.0 environment, filesystem Transitive: eval, shell, unsafe +54 8.9 MB eslintbot
npm/espree@9.6.1 None +1 98 kB eslintbot
npm/estraverse@5.3.0 None 0 37.1 kB michaelficarra
npm/extend-shallow@3.0.2 None +2 21.4 kB phated
npm/fast-deep-equal@3.1.3 None 0 13 kB esp
npm/fast-glob@3.3.0 filesystem +1 154 kB mrmlnc
npm/get-value@2.0.6 None 0 3.71 kB jonschlinkert
npm/glob-parent@5.1.2 None 0 12.1 kB phated
npm/globby@11.1.0 filesystem +5 90.5 kB sindresorhus
npm/http-errors@1.8.1 Transitive: environment, eval +3 57.5 kB dougwilson
npm/is-descriptor@1.0.2 None +2 27.2 kB jonschlinkert
npm/is-extendable@0.1.1 None 0 5.09 kB jonschlinkert
npm/is-extglob@2.1.1 None 0 6.22 kB jonschlinkert
npm/is-glob@4.0.3 None 0 13.6 kB phated
npm/is-plain-object@2.0.4 None 0 7.5 kB jonschlinkert
npm/isobject@3.0.1 None 0 6.93 kB doowb
npm/kind-of@6.0.3 None 0 22.8 kB doowb
npm/koa-send@5.0.1 filesystem, network +4 44.7 kB niftylettuce
npm/lit-analyzer@1.2.1 filesystem Transitive: environment, network +70 3.22 MB runebm
npm/lit-element@4.0.5 Transitive: environment +4 2.69 MB lit-robot
npm/lit-html@3.1.0 None +1 1.66 MB lit-robot
npm/lit@3.1.3 None +1 114 kB lit-robot
npm/lodash@4.17.21 None 0 1.41 MB bnjmnt4n
npm/merge2@1.4.1 None 0 8.9 kB zensh
npm/mime-types@2.1.35 None +1 224 kB dougwilson
npm/normalize-path@3.0.0 None 0 9.22 kB jonschlinkert
npm/prettier@2.8.8 environment, filesystem, unsafe 0 11.2 MB prettier-bot
npm/punycode@2.3.0 None 0 32.9 kB google-wombot
npm/readable-stream@3.6.2 environment +1 138 kB matteo.collina
npm/regex-not@1.0.2 None +2 32.2 kB jonschlinkert
npm/resolve@1.22.2 environment, filesystem +5 216 kB ljharb
npm/semver@7.5.4 None 0 93.4 kB npm-cli-ops
npm/set-value@2.0.1 None 0 10.3 kB doowb
npm/split-string@3.1.0 None 0 13.8 kB jonschlinkert
npm/statuses@1.5.0 None 0 11 kB dougwilson
npm/to-regex@3.0.2 None +3 47.1 kB jonschlinkert
npm/tslib@2.6.1 None 0 84 kB typescript-bot
npm/type-check@0.4.0 None +1 57.9 kB gkz

🚮 Removed packages: npm/@babel/code-frame@7.22.10, npm/@babel/helper-compilation-targets@7.22.10, npm/@babel/helper-create-class-features-plugin@7.22.11, npm/@babel/parser@7.22.11, npm/@babel/plugin-transform-optional-chaining@7.22.12, npm/@babel/plugin-transform-regenerator@7.22.10, npm/@babel/runtime@7.22.11, npm/@babel/types@7.22.11, npm/@getalby/bitcoin-connect@3.4.0, npm/@jridgewell/trace-mapping@0.3.19, npm/@types/react@18.2.21, npm/browserslist@4.21.10, npm/caniuse-lite@1.0.30001523, npm/lit@3.0.0, npm/resolve@1.22.4, npm/tslib@2.6.2, npm/typescript@5.1.6, npm/vite@4.4.8, npm/which-typed-array@1.1.11, npm/yaml@1.10.2

View full report↗︎

Copy link

🚨 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 NoteSource
Install scripts npm/playwright@1.36.0
  • Install script: install
  • Source: node install.js

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/playwright@1.36.0

@rolznz rolznz merged commit 29ac2ef into master May 12, 2024
1 of 2 checks passed
Comment on lines +90 to +93
if (
!info?.methods ||
info.methods.indexOf('getBalance') < 0 ||
!provider.getBalance
Copy link
Contributor

Choose a reason for hiding this comment

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

to me these checks are always a bit of a code-smell. and if is one already and then the more complicated it is the more problematic it is to read it easily and understand what is going for a new developer.

in this PR you do this check already at 3 places that would need to be kept in sync.
be careful there and we need to think about the clear defined API (internal and external)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree. Maybe we calculate this once when the connection is initialized and remove the check from the balance component (it should never reach that). I'll try clean this up tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants