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

Add signature validation #5

Closed
anthonychu opened this issue Jun 24, 2021 · 2 comments · Fixed by #6
Closed

Add signature validation #5

anthonychu opened this issue Jun 24, 2021 · 2 comments · Fixed by #6

Comments

@anthonychu
Copy link

It looks like the current sample is vulnerable to spoofing. The function should validate the signature on every request: https://azure.github.io/azure-webpubsub/references/protocol-cloudevents.html#web-pubsub-service-atrribute-extension

const userId = req.headers['ce-userid']

@benc-uk
Copy link
Owner

benc-uk commented Jun 24, 2021

Good catch, this is probably one of the downsides of using my own HTTP trigger rather than the Function extensions & bindings/triggers for Web PubSub
But I couldn't find a way to get them to work in a Static Web App

I'll see if I can tighten this up

@anthonychu
Copy link
Author

I think it’s totally valid to use your own http function. There’ll be an input binding that will do this work for you that should be available in a few months to simplify this a lot.

In the meantime it would be great to update this sample in case someone copies it. Maybe just adding a comment near that userId line that indicates this is missing would be helpful. Thanks for putting this together!

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 a pull request may close this issue.

2 participants