镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Tests fail - dummy SSL key too small #905

Closed

Description

@sgpinkus

When running the tests on latest (v1.17.3) I get:

  ...
  124 passing (3s)
  1 failing

  1) session()
       req.session
         .cookie
           .secure
             should set cookie when secure:
     Error: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
      at node:internal/tls/secure-context:65:13
      at Array.forEach (<anonymous>)
      at setCerts (node:internal/tls/secure-context:63:3)
      at configSecureContext (node:internal/tls/secure-context:152:5)
      at Object.createSecureContext (node:_tls_common:117:3)
      at Server.setSecureContext (node:_tls_wrap:1346:27)
      at Server (node:_tls_wrap:1205:8)
      at new Server (node:https:69:3)
      at Object.createServer (node:https:105:10)
      at Context.<anonymous> (test/session.js:2012:30)
      at processImmediate (node:internal/timers:466:21)

I believe SSL libs now think 1024 bit key is too small. Regenerating 2048 bit keys in fixtures fixes the test:

openssl req -new -x509 -keyout server.key -out server.crt -newkey rsa:4096 -days 3650 -nodes -subj "/CN=express-session.local/"

I would PR with new key but probably better it project member does this.

Activity

  1. dougwilson commented on Jul 29, 2022

    @dougwilson
    Contributor

    What version of Node.js does this happen on? We are running this on all versions on CI seemingly without issue. Ideally we need a way for it to fail on CI otherwise there is no guarantee the change will not accidentally be reverted, breaking you again. I can help set that up, just need information on your environment to replicate.

  2. sgpinkus commented on Jul 29, 2022

    @sgpinkus
    Author

    @dougwilson v16.15.0

  3. dougwilson commented on Jul 29, 2022

    @dougwilson
    Contributor
  4. sgpinkus commented on Jul 29, 2022

    @sgpinkus
    Author

    Yeah I think it's node relying on system crypto libraries.

  5. dougwilson commented on Jul 29, 2022

    @dougwilson
    Contributor

    AFAIK Node.js statically links the OpenSSL lib into their binaries. Our CI downloads the libs direct from nodejs.org

  6. dougwilson commented on Jul 29, 2022

    @dougwilson
    Contributor

    Anyway, we can def regenerate the key to fix the test, but we need a way to replicate the issue at least in CI to ensure the change stays and doesn't break again in the future.

  7. sgpinkus commented on Jul 29, 2022

    @sgpinkus
    Author

    AFAIK Node.js statically links the OpenSSL lib into their binaries. Our CI downloads the libs direct from nodejs.org

    Hmm, I'm not sure TBH. Maybe it depends? Local system was Debian Buster. I just replicated test failure with docker image node:16.15.0-buster-slim.

  8. dougwilson commented on Jul 29, 2022

    @dougwilson
    Contributor

    I'm pretty sure, otherwise Node.js wouldn't need to make new releases when there is an OpenSSL security vulnerability? Burt even then, it would seem to reason that if our CI isn't having trouble, and I just tried locally on 16.15.0 without issue, it would seem I wouldn't realistically be able to generate a new key, as I don't know the parameters needed. Project maintainers like myself can only reliable generate keys that meet known parameters, like what our local and CI Node.js need. You're welcome to PR a key that meets your needs and passes the CI as well, though if you don't update the CI to fail in the same way, I cannot guarantee that any future key changes will work for you. I hope that makes sense.

  9. sgpinkus commented on Jul 29, 2022

    @sgpinkus
    Author

    Makes sense.

    I'm pretty sure, otherwise Node.js wouldn't need to make new releases when there is an OpenSSL security vulnerability?

    OK confirmed it's statically linked SSL and most things on my system. I guess the build process for "v16.15.0" is different. Particular version was from the NodeSource apt repo. I'm not going to bother checking what SSL lib version is. I will PR a new 2048b dummy key though.

  10. bjohansebas commented on Feb 22, 2025

    @bjohansebas
    Member

    fixed by #1003

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions