-
Notifications
You must be signed in to change notification settings - Fork 1.2k
@azure/arm-appservice - webApps.getFunctionsAdminToken fails with error about Cookie #1008
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
Comments
@amarzavery - After looking into this further the Rest SDK should either not write the response cookies or at least provider an option to ignore these errors. Suspect code is @ https://github.com/Azure/ms-rest-js/blob/ea7ceb86f1e6e6f7879e7e7ddfe791113762b65d/lib/axiosHttpClient.ts#L197 |
API that is causing issues:The client does receive the 200 response. However, it fails on reading the cookie value present in the "Set-Cookie" response header.
I feel this is a server side issue. The server shouldn't be doing that. This seems to be a security flaw with the server. Why it does not work in the new JS sdk ?In the new sdk Why it works in the old node sdk?In the old node sdk
Cookies are important for browser scenario. However for node.js, it seems that the default approach that we would want is:
@daschult @bterlson @kpajdzik - What are your thoughts on this? @naveedaz - It would be nice if the AppService team can fix this bug on the server side. |
The ARM API you're using to get the function is returning that SCM domain header because many of the Functions ARM APIs delegate internally to the Kudu/SCM site which adds that header. We return that response from the ARM API. I wouldn't characterize this as an AppService bug. It sounds like you're just using an overly sensitive cookie library. Can't you just stop using that? |
I am ok with not throwing on cookie validation failures in Node assuming people more familiar with the security model are also OK with that. But wouldn't the cookie just fail to set in the browser, so this should be fixed regardless? |
@bterlson - That is true. This will fail in a browser. @mathewc - The cookie library that we are using is fairly popular in the JS world. If the strict validation would have been a problem then we would see some issues related to that on their github repo. It would be nice if the AppService can scrub those headers before returning that response to the customer. |
@mathewc would app service API still work fine if our SDK ignores the |
Describe the bug
client.webApps.getFunctionsAdminToken
returns an exception about Cookie not in expected domainUnhandledPromiseRejectionWarning: Error: Cookie not in this host's domain. Cookie:my-azfn.scm.azurewebsites.net Request:management.azure.com
Setting Cookie header myself did nothing and I couldn't find any other options to overwrite this behavior
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expect the call to complete
Screenshots
N/A
Additional context
I am using service principal authentication.
This works with the "azure-arm-website" package.
The text was updated successfully, but these errors were encountered: