-
Notifications
You must be signed in to change notification settings - Fork 7
Improvements to webhooks endpoints #142
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
Conversation
samdbmg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM - couple of docs nits inlined
api/TimeAddressableMediaStore.yaml
Outdated
| Register to receive event notifications as webhooks on a specified URL. Webhook messages will conform to the | ||
| format in the `webhooks` section of the API docs, depending on the event type (as defined in the same section). | ||
| Availability of this endpoint is indicated by the name "webhooks" appearing in the `event_stream_mechanisms` | ||
| list on the service endpoint. | ||
| HTTP requests from the service SHOULD include a `api_key_name` header with the 'api_key_value' value. Clients SHOULD verify this against the value they provided when registering the webhook. | ||
| API implementations MAY partially support event filtering and transformations. | ||
| API implementations SHALL return a 400 response code if the filtering or transformation specified in the request is not supported. | ||
| API implementations SHOULD consider the security implementations of providing webhooks, and include appropriate mitigations against Server Side Request Forgery (SSRF) attacks and similar. API implementations SHOULD take appropriate steps to authorize the modification of existing webhooks. This may take the form of RBAC, or ABAC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might need a tweak to match this being an update endpoint now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tweaked in fdcd744
|
Something that came up in a conversation today and may be something to include in this PR. Should we be supplying more "data" in the deleted events payload, for flows and sources? We had a use case where we wanted to be notified if a "multi" Source is deleted. Since the payload for deleted events only has the id this is not currently easy/possible. |
I think that sounds reasonable. Would you be able to provide some user stories/use cases we can use to inform the change? I'm mainly wondering if that data should be the whole Source/Flow metadata, or just a subset. I wonder if it should be a separate ADR and/or PR to avoid adding even more to this very large change set! |
Separate PR is best plan. I just figured it was worth "sounding out" the idea here first in case it was considered "silly" ;) |
| "204": | ||
| description: No content. The webhook has been deleted. | ||
| "403": | ||
| description: Forbidden. You do not have permission to modify this webhook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we don't have a read-only field on the webhook, like we do on Flows i was just wondering if this 403 is needed explicitly? Since i guess this will be produced by the RBAC/ABAC/Coarse access rules? Unless i have missed something. Feels like if we are including a 403 here we should go back and add 403 to all methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This was added for access control use cases. We should make sure we're consistent with this.
|
I think it might be a good idea to have a
In our implementation i need to solve the problem of repeated failures and thought about adding a disabled flag but it think this might be useful in the main spec, and also worth adding as part of this PR as it is the same schema? |
210a94b to
087510c
Compare
|
Rebased |
Initial solution proposed in #150 was merged into this PR. This was expanded on in 087510c |
52b8493 to
c051a0d
Compare
|
Rebased |
samdbmg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question, but LGTM
…state will be omitted
…eld to Webhooks sem-ver: api-break
Co-authored-by: Sam Mesterton-Gibbons <sam.mesterton-gibbons@bbc.co.uk>
c051a0d to
77f528b
Compare
|
Rebasing again |
Details
While developing fine-grained auth approaches in #115 , several deficiencies were noticed with the Webhooks endpoints:
api_key_valuein the Webhooks listing, could result in multiple identical looking Webhooks being returnedflows/createdevents, but onlyflows/segments_addedfor specific flows)This PR proposes changes to the Webhooks endpoint to fix these issues.
Jira Issue (if relevant)
Jira URL: https://jira.dev.bbc.co.uk/browse/CLOUDFIT-5461
Related PRs
If merged before #115, add the new endpoints to the auth logic listings in that PR. If merged after, add that logic in this PR
Submitter PR Checks
(tick as appropriate)
Reviewer PR Checks
(tick as appropriate)
Info on PRs
The checks above are guidelines. They don't all have to be ticked, but they should all have been considered.