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

Tenant PATCH request may lose webhook configuration for non-global Webhooks #2411

Closed
robotdan opened this issue Aug 5, 2023 · 4 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@robotdan
Copy link
Member

robotdan commented Aug 5, 2023

Tenant PATCH request may lose webhook configuration for non-global Webhooks

Description

If you have one or more webhooks configured with global: false which means you have to assign one or more tenants to the webhook instead of just receiving events for all tenants - calling PATCH w/out providing the webhookIds in the JSON body will remove this tenant from all webhooks.

Observed in version

1.46.1

Affects versions

TBD

Steps to reproduce

  1. Create a tenant and enable at least one event.
  2. Create a webhook as global: false with this tenant configured.
  3. Make a PATCH request and change only tenant.name..
  4. This tenant will be removed from the Webhook configuration.

Expected behavior

The webhook configuration should not be modified on a PATCH request unless webhookIds are specified in the JSON request body.

Workaround

Various options:

  1. Provide the webhookIds in the request body just as you would with a PUT request.
  2. Use PUT instead of PATCH
  3. Configure webhooks to be global instead.

Community guidelines

All issues filed in this repository must abide by the FusionAuth community guidelines.

Additional context

Add any other context about the problem here.

Release Notes

When using the PATCH method on the Tenant API, if you previously had any explicit webhooks configured for this tenant, the association between the tenant and the webhook was lost. If you are not using webhooks, or all of your webhooks are configured for All tenants (webhook.global), this bug would not affect you.

@robotdan robotdan self-assigned this Aug 5, 2023
@robotdan robotdan added the bug Something isn't working label Aug 5, 2023
@robotdan robotdan added this to Backlog in FusionAuth Issues via automation Aug 5, 2023
@robotdan robotdan added this to the 1.48.0 milestone Aug 5, 2023
@robotdan robotdan moved this from Backlog to In progress in FusionAuth Issues Aug 5, 2023
@robotdan robotdan moved this from In progress to Code complete in FusionAuth Issues Aug 5, 2023
@labiang
Copy link

labiang commented Aug 6, 2023

PUT also has the same effect if retrieving the tenant using GET and then including it in the next PUT call (with any other data that you want to update).

This is happening because when you retrieve a tenant, it does not have a JSON key for the tenant's webhook configuration.

Although patch/put tenant does accept a webhookIds property (in the same JSON hierarchical level as tenant and not inside), if you retrieve a tenant using GET, that property will not be returned to you.

@robotdan robotdan moved this from Code complete to Reviewer approved in FusionAuth Issues Aug 7, 2023
@robotdan
Copy link
Member Author

robotdan commented Aug 7, 2023

Thanks for the additional detail @itstriolink this is helpful.

This is perhaps a confusing feature of this API. However, we do document the webhookIds for the PUT request so I think this is working as designed. I would be hesitant to change this documented behavior.

https://fusionauth.io/docs/v1/tech/apis/tenants#update-a-tenant

Maybe we should consider adding a flag to this API to indicate if you are trying to update the webhook config on a Tenant Update.

@robotdan
Copy link
Member Author

robotdan commented Aug 7, 2023

I opened a separate issue to track this request @itstriolink thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
FusionAuth Issues
  
Delivered
Development

No branches or pull requests

2 participants