Azure / azure-webpubsub

Azure Web PubSub Service helps you to manage WebSocket connections and do publish and subscribe in an easy way
https://azure.github.io/azure-webpubsub/
MIT License
132 stars 82 forks source link

AbuseProtection always fails in Replicas and custom domain #598

Open JialinXin opened 1 year ago

JialinXin commented 1 year ago

Describe the bug

When in Replicas and custom domain scenarios, the request origins will be multiple values. And current server side to validate the origin has a bug correctly deserialize it, so Abuse Protection will always fail and block further requests.

Impacts

Exceptions

Check live trace and find Abuse Protection request returns 400.

Further technical details

Multiple origins in header are not correctly parsed in server SDK where there's a space between multiple values.

See fix: https://github.com/Azure/azure-sdk-for-net/pull/38359

Workaround

Option 1. Disable AbuseProtection.

Option 2. Update to latest SDK.

a. Remove extensionBundle settings in host.json. For example, make it simple as below.

{
  "version": "2.0"
}

b. Explicit install required extensions.

> func extensions install --package Microsoft.Azure.WebJobs.Extensions.WebPubSub --version 1.7.0
### Tasks
- [x] Bug fix.
- [x] Release packages. Microsoft.Azure.WebPubSub.AspNetCore [v1.2.0](https://www.nuget.org/packages/Microsoft.Azure.WebPubSub.AspNetCore/1.2.0) Microsoft.Azure.WebJobs.Extensions.WebPubSub [v1.7.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.WebPubSub/1.7.0) Microsoft.Azure.Functions.Worker.Extensions.WebPubSub [v1.7.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.WebPubSub/1.7.0-beta.1)
- [ ] Update package version in Function extension bundle.
JialinXin commented 8 months ago

UPDATE: The issue is mitigated as service now return single request host as it is.