feat: add webhook edit UI and signing secret status indicator#6027
feat: add webhook edit UI and signing secret status indicator#6027YigesMx wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds webhook signing secret management across the API contract, backend implementation, and frontend UI. It defines a new has_signing_secret output-only field in the UserWebhook proto message, implements backend logic to populate it, refactors the webhook creation dialog to separately track existing versus newly generated signing secrets, enables editing existing webhooks, and adds localized UI strings for the signing secret workflow. ChangesWebhook Signing Secret Management
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/router/api/v1/user_service.go`:
- Around line 1274-1277: The UserWebhook response builders are inconsistent: add
the HasSigningSecret field in the webhook mapping inside
convertUserSettingFromStore so it matches the other builder that sets
HasSigningSecret; specifically, in convertUserSettingFromStore where you
construct the UserWebhook (or equivalent struct) add HasSigningSecret:
webhook.SigningSecret != "" (or the boolean expression used elsewhere) and
ensure the field name matches the struct field (HasSigningSecret /
has_signing_secret) so both endpoints return the same secret-status value.
In `@web/src/components/CreateWebhookDialog.tsx`:
- Around line 109-117: getPendingLabel currently treats an empty signingSecret
("") as "cleared", which incorrectly shows a pending clear for brand-new
webhooks; update getPendingLabel (and any caller logic in CreateWebhookDialog)
to first detect create mode (e.g., mode === 'create' or an isCreate/isEditing
flag used by this component) and, when in create mode, treat state.signingSecret
=== "" the same as undefined (return the "no changes" label); keep the existing
"cleared" semantics only when not in create/edit mode.
In `@web/src/components/Settings/WebhookSection.tsx`:
- Around line 102-109: The icon-only action buttons for edit/delete lack
accessible names; update the Button components that render the PencilIcon and
TrashIcon (the ones invoking handleEditWebhook(webhook) and
handleDeleteWebhook(webhook)) to provide an accessible name—e.g., add
aria-label="Edit webhook" and aria-label="Delete webhook" (or use
aria-labelledby/hidden visually-readable text for i18n) so assistive tech can
identify each action while keeping the icon-only visual design.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7f631b0d-ebe6-4e67-bbf5-5f8993bd268a
⛔ Files ignored due to path filters (2)
proto/gen/api/v1/user_service.pb.gois excluded by!**/*.pb.go,!**/gen/**proto/gen/openapi.yamlis excluded by!**/gen/**
📒 Files selected for processing (8)
proto/api/v1/user_service.protoserver/router/api/v1/user_service.goserver/router/api/v1/user_webhook_test.goweb/src/components/CreateWebhookDialog.tsxweb/src/components/Settings/WebhookSection.tsxweb/src/locales/en.jsonweb/src/locales/zh-Hans.jsonweb/src/types/proto/api/v1/user_service_pb.ts
Follow-up to #6013.
What this does
whsec_prefix) to guarantee they meet the Standard Webhooks 24–64 byte requirement.Why
Per Standard Webhooks, signing secrets should be 24–64 random bytes. Letting users type arbitrary strings would allow invalid secrets to be persisted. System-generated secrets also match the spec's
whsec_<base64>serialization convention and work correctly with Standard Webhooks verification libraries.The edit button was missing entirely — once created, a webhook's URL and name could not be changed without deleting and recreating it.
Technical notes
has_signing_secret(OUTPUT_ONLY boolean) added to the UserWebhook proto so the frontend knows whether a secret exists without ever seeing it.undefined= don't update,""= clear, non-empty = set new secret.aria-labelattributes for accessibility.