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

Depends on vulnerable versions of elliptic #187

Closed
IBlasterus opened this issue Aug 6, 2024 · 3 comments · Fixed by #189
Closed

Depends on vulnerable versions of elliptic #187

IBlasterus opened this issue Aug 6, 2024 · 3 comments · Fixed by #189

Comments

@IBlasterus
Copy link

npm audit report

elliptic >=2.0.0
Elliptic allows BER-encoded signatures - GHSA-49q7-c7j4-3p7m
Elliptic's ECDSA missing check for whether leading bit of r and s is zero - GHSA-977x-g7h5-7qgw
Elliptic's EDDSA missing signature length check - GHSA-f7q4-pwc6-w24p
fix available via npm audit fix --force
Will install jwk-to-pem@1.2.0, which is a breaking change
node_modules/elliptic
jwk-to-pem >=1.2.1
Depends on vulnerable versions of elliptic
node_modules/jwk-to-pem

2 low severity vulnerabilities

@rlsf
Copy link

rlsf commented Aug 6, 2024

can be solved by using node's native crypto library, as explained here: https://stackoverflow.com/a/75074566

const { createPublicKey } = require('crypto')
function jwkToPem(webKey) {
  const pubKey = createPublicKey({
    key: webKey,
    format: 'jwk'
  });

  return pubKey.export({ format: "pem", type: "spki"}).toString();
}

@omsmith
Copy link
Contributor

omsmith commented Aug 6, 2024

Good morning and thanks for raising the issue.

As @rlsf points out, this library doesn't serve much need for modern node any longer, especially if your goal is to work with the key within node - you can use the KeyObject returned by createPublicKey instead of a PEM string.

That said, will certainly review the issue today.

@omsmith
Copy link
Contributor

omsmith commented Aug 7, 2024

Update: the areas of concerns raised within the elliptic library are around signature validation. jwk-to-pem does not interact with signatures and as such is not impacted by the issues raised.

We will update the package once a new version is available.

Additionally, we will also consider doing a major version bump to use node:crypto before deprecating the package.

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 a pull request may close this issue.

3 participants