node-red / node-red

Low-code programming for event-driven applications
http://nodered.org
Apache License 2.0
19.5k stars 3.37k forks source link

Latest-12 - 21 July - problems HTTP request handeling cookie #3075

Closed robiebab closed 3 years ago

robiebab commented 3 years ago

What are the steps to reproduce?

If i install the old version(for example: 1.3.5-12) i can use the http request module without any problems. if i install the Latest-12 - 21 July i get a error: RequestError: Cookie not in this host's domain.

What happens?

i get a cookie warning

What do you expect to happen?

the request would continue

Please tell us about your environment:

[ ] Platform/OS: RASPBIAN - docker

[ ] Browser: Safari

i get this error in the logging:

21 Jul 14:28:05 - [error] [http request:Get Token] RequestError: Cookie not in this host's domain. Cookie:auth.delta.electrolux.com Request:api.delta.electrolux.com

knolleary commented 3 years ago

Can you please share some details on what your flow is doing with the http request node? Is there a minimal example flow you can share?

This is not an issue specific to node-red-docker - so will move over to the core Node-RED repository.

hardillb commented 3 years ago

@knolleary Can you move this to the core project as it's very unlikely to be docker specific

robiebab commented 3 years ago

Can you please share some details on what your flow is doing with the http request node? Is there a minimal example flow you can share?

This is not an issue specific to node-red-docker - so will move over to the core Node-RED repository.

[{"id":"3daecb3a84194248","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"962647055dbed6db","type":"http request","z":"3daecb3a84194248","name":"Get Token","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.delta.electrolux.com/api/Clients/WellbeingAEG","tls":"","persist":false,"proxy":"","authType":"","x":570,"y":200,"wires":[["6608ecf575d34bac"]]},{"id":"1d487b5b307dec73","type":"function","z":"3daecb3a84194248","name":"ClientSecret","func":"msg.payload = {\"ClientSecret\": \"testmsgf\"};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":200,"wires":[["962647055dbed6db"]]},{"id":"1357a75d3caf7e38","type":"inject","z":"3daecb3a84194248","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":200,"wires":[["1d487b5b307dec73"]]},{"id":"6608ecf575d34bac","type":"debug","z":"3daecb3a84194248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":770,"y":200,"wires":[]}]

knolleary commented 3 years ago

Found it - https://github.com/sindresorhus/got/issues/984

Fix on its way

hardillb commented 3 years ago

Hmm, I think the server is out of spec and technically the cookie should be rejected. But if we can make it match requests behaviour then OK.

The Domain value of the cookie should include the server the request was sent to and in this case it doesn't. Testing with Curl gets:

< Set-Cookie: ARRAffinity=ad366d3a71c1ee352101dd38c4560a1653345bd9bb938f1f0d709852c05b0188;Path=/;HttpOnly;Secure;Domain=auth.delta.electrolux.com
< Set-Cookie: ARRAffinitySameSite=ad366d3a71c1ee352101dd38c4560a1653345bd9bb938f1f0d709852c05b0188;Path=/;HttpOnly;SameSite=None;Secure;Domain=auth.delta.electrolux.com

When the request was sent to api.delta.electrolux.com. The server should be responding with Domain=api.delta.electrolux.com (or Domain=delta.electrolux.com) or the request should have been made to auth.delta.electrolux.com (which does also work)

knolleary commented 3 years ago

Right - the 'fix' is to tell the node to ignore the invalid cookie rather than fail the whole request.