derhuerst / gemini

Gemini protocol server & client for Node.js.
ISC License
49 stars 8 forks source link

Uncaught exception with invalid client certificate causes server to crash #9

Closed abramsba closed 2 years ago

abramsba commented 2 years ago

node version: v10.19.0 library version: ^1.2.0 gemini client: lagrange

I don't have a lot of experience with this protocol so excuse any ignorance. I'm working on an app with a path that should only be accessible to a given list of fingerprints. For my first basic test, I just wanted to see if I can match a client fingerprint to one stored on the server. Using my normal identity it works just fine. If I disable my identity I get an expected unauthorized denial message. If I create a brand new identity to test further the client certificate used causes the server to crash.

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: CERT_NOT_YET_VALID
    at Server.onConnection (/home/gemini/gemibook/node_modules/@derhuerst/gemini/server.js:47:19)
    at Server.emit (events.js:198:13)
    ...

I've tried to catch the tlsClientError event from the server object returned, but I have the same issue. The ssl certificate on the server is from letsencrypt and not self signed, but since it works in the other two cases I'm not sure if this is an error on my part. Is there a way to property catch and handle this so it doesn't crash the server?

derhuerst commented 2 years ago

Thanks for reporting!

I can't reproduce this with Node.js v16.5.0. Note that Node.js v10 is not maintained anymore; Could you check if the error also appears with a maintained Node.js release?

abramsba commented 2 years ago

Ah that's indeed an error on my part. I didn't notice the version was so far behind. After updating to v16.5.0 I can confirm it no longer crashes. Thanks.