Skip to content

feat(api-integration): add Nango webhook handling#3716

Merged
yujonglee merged 9 commits intomainfrom
devin/1770477192-api-integration-webhook
Feb 8, 2026
Merged

feat(api-integration): add Nango webhook handling#3716
yujonglee merged 9 commits intomainfrom
devin/1770477192-api-integration-webhook

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Feb 7, 2026

feat(api-integration): add Nango webhook endpoint

Summary

Adds a POST /webhook endpoint to crates/api-integration for receiving Nango auth webhooks. The endpoint verifies the X-Nango-Hmac-Sha256 signature against a configured secret and deserializes the payload into the existing hypr_nango::ConnectWebhook type.

Changes:

  • New webhook.rs route with HMAC-SHA256 signature verification
  • nango_webhook_secret (required String) added to IntegrationConfig and Env
  • hmac and sha2 added as workspace dependencies
  • Route registered at /webhook alongside existing /connect-session

Note: The handler currently logs the webhook event and returns { "status": "ok" } — it does not persist the connection_id. Persistence/callback logic will need to be added by the consumer.

Review & Testing Checklist for Human

  • Signature comparison is not constant-timeverify_signature uses != on hex strings instead of hmac's built-in mac.verify() which does constant-time comparison. Evaluate whether this timing side-channel matters for your threat model.
  • IntegrationConfig::new() defaults nango_webhook_secret to String::new() — if a caller forgets .with_webhook_secret(...), verification will silently use an empty secret. Consider whether the secret should be a required constructor parameter instead.
  • ConnectWebhook type drops fields — Nango sends success, providerConfigKey, provider, authMode, environment etc. in auth webhooks, but the current ConnectWebhook struct in hypr_nango doesn't capture these. serde will silently ignore them, but you may want these fields (especially success and providerConfigKey) for production use.
  • No persistence — the webhook logs but doesn't save the connection_idend_user_id mapping, which the Nango docs say is the primary purpose of the webhook. Verify this is intentional scaffolding vs. an oversight.
  • Verify the webhook works end-to-end by configuring a Nango environment webhook URL (e.g. via ngrok) and triggering a test connection flow.

Notes

Link to Devin run: https://app.devin.ai/sessions/67e3cd84b2784186b83fda3739d5891c
Requested by: @yujonglee


Open with Devin

devin-ai-integration bot and others added 2 commits February 7, 2026 15:17
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@netlify
Copy link

netlify bot commented Feb 7, 2026

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit 7b80e50
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/6987d9c9116c34000821a860

@netlify
Copy link

netlify bot commented Feb 7, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit 7b80e50
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/6987d9c9f17522000825f0d5

Copy link
Contributor Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 4 additional findings in Devin Review.

Open in Devin Review

devin-ai-integration bot and others added 2 commits February 7, 2026 15:28
…egration

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Copy link
Contributor Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

devin-ai-integration bot and others added 5 commits February 7, 2026 15:37
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
…w; adapt webhook signature verification to nango API

Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
@yujonglee yujonglee merged commit b30864e into main Feb 8, 2026
19 of 20 checks passed
@yujonglee yujonglee deleted the devin/1770477192-api-integration-webhook branch February 8, 2026 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant