-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
4657 Allow users to select the preferred webhook version #4689
base: main
Are you sure you want to change the base?
Conversation
Seems easiest, right? |
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.
Looks about right. One little comment from me. Thank you Alberto!
cl/api/models.py
Outdated
V1 = 1, "V1" | ||
V2 = 2, "V2" |
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.
Small thing, but I prefer v1
over V1
.
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.
Done!
Process notes: I took this off your personal backlog, Alberto, since we're hoping not to use those anymore, and assigned it to you instead, since you're the one in charge of making sure it gets done. I added Eduardo as a reviewer. Thanks all! |
…use-selected-webhook-version
…use-selected-webhook-version
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.
…k-version 4653 Use the selected webhook version in the webhook payload
Semgrep found 8
Detected direct use of jinja2. If not done properly, this may bypass HTML escaping which opens up the application to cross-site scripting (XSS) vulnerabilities. Prefer using the Flask method 'render_template()' and templates with a '.html' extension in order to prevent XSS. Ignore this finding from direct-use-of-jinja2. |
- Applied suggestion to generate version_choices
As requested in #4657, this PR introduces changes in the webhooks UI, allowing users to select which version of the webhook to use when creating a webhook endpoint.
#4657 we planed to do:
However, while working on this, I realized this approach could complicate code maintainability. Specifically, it would require adding new Event Type options each time a new webhook version is introduced, and adjusting code to handle multiple versions of the same event type when sending webhooks.
Instead, I propose we continue using the same event types and allow users to select the version independently.
With this change, users can create only one webhook per
event_type
andversion
combination. Since we currently have only two versions, users can create up to two webhook endpoints per event type.The UI will display available versions based on the selected event type. If a user already has a webhook endpoint for a specific event type and version, only the remaining version will be shown for that event type:
Once created, the event type and version cannot be changed in the Edit view:
A new "Version" column has been added to the webhook endpoints list:
If a user has already created one endpoint for each
event_type
and versioncombination
, an alert will appear when they try to create a new webhook:For now, these changes are only in the UI. In #4653 and #4682, we will use the version to apply the correct serializer and version in the payload for each webhook event type. So my question is if when this is ready it's ok to merge or if we should put it behind a waffle to hide it temporarily, or wait until the other PRs are ready and merge them into this one to release everything as a unit?