-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(node): Compression headers leak between requests #5203
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thanks!
This took me so long to work out what was going on and I found it after telling Abhi the PR was good to go... I'm trying to think how we can make bugs like this less likely. Making the options |
Yup. Thought exactly the same thing. |
At a minimum we could make the parameters in transports export function makeNodeTransport(options: Readonly<NodeTransportOptions>): Transport { We can't make sentry-javascript/packages/node/src/client.ts Lines 36 to 40 in 409f8fd
|
I think we could rewrite the constructor of the clients so that it passes a new options object to super instead of a modified one. But yeah bare minimum we could make the node transport options readonly. I believe it's generally good practice to make as much readonly as possible. |
Note: This is an exact duplicate of #5139 and #5203, both originally by @timfish, which accidentally got merged into the 7.x branch rather than master. #5139: This is mostly stolen straight from the [Electron transport](https://github.com/getsentry/sentry-electron/blob/master/src/main/transports/electron-net.ts). This will help with attachments! #5203: #5139 introduced a subtle bug where `options.headers` was modified which causes headers to leak between requests. This means requests after a compressed request will be incorrectly marked with `content-encoding: gzip`.
#5139 introduced a subtle bug where
options.headers
was modified which causes headers to leak between requests. This means requests after a compressed request will be incorrectly marked withcontent-encoding: gzip
.