feat(webhooks): add signing secret rotation endpoint - #277
Open
gabrielmfern wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
| rotated: resend.Webhooks.RotateSigningSecretResponse = ( | ||
| resend.Webhooks.rotate_signing_secret(webhook["id"]) | ||
| ) | ||
| print(f"Rotated signing secret: {rotated['signing_secret']}") |
Contributor
There was a problem hiding this comment.
2 issues found across 4 files
Confidence score: 2/5
examples/webhooks.pyprintsrotated['signing_secret'], exposing the webhook signing secret through stdout and captured logs; print only the webhook ID or omit the output.Webhooks.rotate_signing_secretmay require permissions that existing productionRESEND_API_KEYvalues do not have, potentially preventing rotation after deployment; verify API-key permissions before deployment.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="examples/webhooks.py">
<violation number="1" location="examples/webhooks.py:88">
P2: Custom agent: **API Key Permission Check SDK Methods**
Confirm that existing production `RESEND_API_KEY` values have the permissions required for `Webhooks.rotate_signing_secret` before deployment; otherwise this new operation can fail with an authorization error after release.</violation>
<violation number="2" location="examples/webhooks.py:90">
P1: Do not print `rotated['signing_secret']` because this exposes the webhook signing secret in stdout and any captured logs. Print only the webhook ID or omit this output.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| rotated: resend.Webhooks.RotateSigningSecretResponse = ( | ||
| resend.Webhooks.rotate_signing_secret(webhook["id"]) | ||
| ) | ||
| print(f"Rotated signing secret: {rotated['signing_secret']}") |
Contributor
There was a problem hiding this comment.
P1: Do not print rotated['signing_secret'] because this exposes the webhook signing secret in stdout and any captured logs. Print only the webhook ID or omit this output.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At examples/webhooks.py, line 90:
<comment>Do not print `rotated['signing_secret']` because this exposes the webhook signing secret in stdout and any captured logs. Print only the webhook ID or omit this output.</comment>
<file context>
@@ -84,6 +84,11 @@
+rotated: resend.Webhooks.RotateSigningSecretResponse = (
+ resend.Webhooks.rotate_signing_secret(webhook["id"])
+)
+print(f"Rotated signing secret: {rotated['signing_secret']}")
+
rm_webhook: resend.Webhooks.DeleteWebhookResponse = resend.Webhooks.remove(
</file context>
Suggested change
| print(f"Rotated signing secret: {rotated['signing_secret']}") | |
| print(f"Rotated signing secret for webhook: {rotated['id']}") |
| print("No webhook events available") | ||
|
|
||
| rotated: resend.Webhooks.RotateSigningSecretResponse = ( | ||
| resend.Webhooks.rotate_signing_secret(webhook["id"]) |
Contributor
There was a problem hiding this comment.
P2: Custom agent: API Key Permission Check SDK Methods
Confirm that existing production RESEND_API_KEY values have the permissions required for Webhooks.rotate_signing_secret before deployment; otherwise this new operation can fail with an authorization error after release.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At examples/webhooks.py, line 88:
<comment>Confirm that existing production `RESEND_API_KEY` values have the permissions required for `Webhooks.rotate_signing_secret` before deployment; otherwise this new operation can fail with an authorization error after release.</comment>
<file context>
@@ -84,6 +84,11 @@
print("No webhook events available")
+rotated: resend.Webhooks.RotateSigningSecretResponse = (
+ resend.Webhooks.rotate_signing_secret(webhook["id"])
+)
+print(f"Rotated signing secret: {rotated['signing_secret']}")
</file context>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
resend.Webhooks.rotate_signing_secret(webhook_id)and its async twin forPOST /webhooks/{webhook_id}/signing-secret/rotate, returningRotateSigningSecretResponsewith the sameobject,id,signing_secretshape as create webhook. Mirrors the event replay endpoint from #274 in layout, tests, and the examples/webhooks.py walkthrough.Spec: resend/resend-openapi#113
Linear: https://linear.app/resend/issue/DEV-2072
🤖 Generated with Claude Code
Summary by cubic
Adds a signing secret rotation endpoint so users can rotate a webhook's signing secret without recreating it.
resend.Webhooks.rotate_signing_secret(webhook_id)and the async twinrotate_signing_secret_async.RotateSigningSecretResponsewith the sameobject,id, andsigning_secretshape as the create webhook response.examples/webhooks.pywalkthrough.Written for commit 482dd5d. Summary will update on new commits.