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

Fixes for TLS termination #6

Merged
merged 2 commits into from
Feb 8, 2023
Merged

Fixes for TLS termination #6

merged 2 commits into from
Feb 8, 2023

Conversation

chris48s
Copy link
Member

@chris48s chris48s commented Feb 7, 2023

This is one part of the jigsaw to get badges/shields#8424 sorted.

The first one is a bit of a silly issue. ScoutCamp doesn't recognise -----BEGIN PRIVATE KEY----- as the start of a private key so it falls back to trying to load it from file. This PR loosens the regex.

The second one is: Once I got ScoutCamp using the CloudFlare keys, I started hitting this error:

ewr [info] node:internal/buffer:959
ewr [info] super(bufferOrLength, byteOffset, length);
ewr [info] ^
ewr [info] RangeError: Invalid typed array length: -4095
ewr [info] at new Uint8Array (<anonymous>)
ewr [info] at new FastBuffer (node:internal/buffer:959:5)
ewr [info] at Handle.onStreamRead [as onread] (node:internal/stream_base_commons:189:19)
ewr [info] at Stream.<anonymous> (/usr/src/app/node_modules/spdy/node_modules/handle-thing/lib/handle.js:120:12)
ewr [info] at Stream.emit (node:events:532:35)
ewr [info] at Stream.emit (node:domain:475:12)
ewr [info] at endReadableNT (/usr/src/app/node_modules/readable-stream/lib/_stream_readable.js:1010:12)
ewr [info] at processTicksAndRejections (node:internal/process/task_queues:83:21)

I traced that to this issue: spdy-http2/node-spdy#363

and updating spdy/handle-thing seems to do the trick. As far as I can tell, the only breaking change for spdy 3 --> 4 is dropping older node versions. Node-spdy itself seems to be unmaintaned and there is no changelog, so I had to read the diff.

Everything on this repo is bad and old and unloved so there is no CI, but I've run the tests locally. They all pass. Perhaps more importantly I've run the shields test suite against a copy of shields with this scoutcamp installed into it and they all pass, so that's good.

I probably should have had a look at socket.io while I am working on this repo, but I haven't. It can wait.

Obviously none of us have great detailed insight into this library, but anything else I should think about here?

Copy link
Member

@calebcartwright calebcartwright left a comment

Choose a reason for hiding this comment

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

Oof, good find

@chris48s chris48s merged commit 4f6e445 into badges:master Feb 8, 2023
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 this pull request may close these issues.

2 participants