diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c73387..9f46050 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,38 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added + +- 35 more platforms in **Source Type**, bringing it in line with what Hookdeck + supports today: AfterShip, Aircall, Auth0, Azure Event Grid, Bitbucket, + Calendly, Checkout.com, CircleCI, Clerk, Community.com, Cronofy, Deepgram, + Docker Hub, Fanvue, Formstack, Google Pub/Sub, Grafana, Hugging Face, Jira, + Klaviyo, Knock, MailerSend, MCP Events, Mollie, Notion, Onfleet, Ordinal, Quo, + SendGrid Inbound Parse, Snipcart, SparkPost, Supabase, Webflow, Whatnot and + WordPress.com. Azure Event Grid, Ordinal and SendGrid Inbound Parse offer a + choice of verification scheme, and Deepgram, Formstack, Google Pub/Sub, + Grafana, SparkPost and Supabase need several values. One **Webhook Secret** + cannot express either, so their verification goes in **Options → Source + Config (JSON)**. Docker Hub and WordPress.com take no secret, and Hookdeck does + not verify them. In each case the node says so at publish if you fill in + **Webhook Secret**, rather than sending something Hookdeck would reject or + silently drop. + +### Fixed + +- **AWS SNS** and **ShipStation** sources the trigger creates are now verified. + Hookdeck checks both platforms' signatures with keys it fetches itself, but + only for a source created with verification switched on. The node never + switched it on for AWS SNS, and for ShipStation only when **Webhook Secret** + held a public key, so those sources accepted unsigned requests. It now + switches it on whenever **Webhook Secret** is empty. ShipStation no longer + uses the public key it once asked for, so a new ShipStation source with one + filled in now stops at publish with "SHIPSTATION does not take a verification + secret". Clear the field and publish again. To + turn verification off, set **Options → Source Config (JSON)** to + `{"auth": null}`. An existing source you picked from the list is not changed + unless **Update Existing Source** is on. + ## [0.3.0] - 2026-09-09 ### Fixed diff --git a/nodes/Hookdeck/ConnectionPayload.ts b/nodes/Hookdeck/ConnectionPayload.ts index 6457017..821d67c 100644 --- a/nodes/Hookdeck/ConnectionPayload.ts +++ b/nodes/Hookdeck/ConnectionPayload.ts @@ -20,11 +20,12 @@ const DEFAULT_PLATFORM_AUTH_FIELD = 'webhook_secret_key'; * Resolve which auth field a single supplied secret should populate. * * Most platforms name it `webhook_secret_key`, but a sizeable minority use - * `api_key`, `public_key` or similar, and a secret in the wrong field is - * rejected by the API at activation. Three cases cannot be served by a single - * input at all — a type needing several values, one accepting a choice of - * schemes, and one taking no secret — and each is refused with the guidance that - * fits it, rather than being allowed through to surface as a 422. + * `api_key`, `public_key` or similar. Hookdeck drops a field it does not expect, + * so a secret in the wrong one fails activation with a 422 when the right field + * is required, and disappears without a word when it is not. Several cases + * cannot be served by a single input at all — a type needing several values, + * one accepting a choice of schemes, and one with nowhere to put a secret — and + * each is refused with the guidance that fits it. */ function platformAuthField(this: SourceConfigContext, sourceType: string): string { const shape = SOURCE_TYPE_AUTH[sourceType]; @@ -33,13 +34,26 @@ function platformAuthField(this: SourceConfigContext, sourceType: string): strin // best available guess, and the API says so plainly if it is wrong. if (!shape) return DEFAULT_PLATFORM_AUTH_FIELD; + // Refused rather than sent, because Hookdeck would drop it silently and the + // user would believe the secret was doing something. + if (shape.kind === 'keyless') { + throw new NodeOperationError( + this.getNode(), + `${sourceType} does not take a verification secret`, + { + description: + 'Leave Webhook Secret empty. Hookdeck verifies this platform with signing keys it fetches from the platform itself, and the node turns that on for you.', + }, + ); + } + if (shape.kind === 'none') { throw new NodeOperationError( this.getNode(), `${sourceType} does not take a verification secret`, { description: - 'Leave Webhook Secret empty. Hookdeck verifies this platform without one, and sending a secret it does not expect is rejected.', + 'Leave Webhook Secret empty. Hookdeck has nowhere to keep a secret for this platform and would drop one without saying so.', }, ); } @@ -124,6 +138,12 @@ export function buildSourceConfig( if (platformSecret) { config.auth_type = sourceType; config.auth = { [platformAuthField.call(this, sourceType)]: platformSecret }; + } else if (SOURCE_TYPE_AUTH[sourceType]?.kind === 'keyless') { + // Hookdeck only creates verification for a source sent with `auth`, even + // an empty one. Without it these platforms, which need nothing entered, + // accept unsigned requests. Source Config (JSON) of {"auth": null} below + // still turns it off, for anyone sending test payloads by hand. + config.auth = {}; } } diff --git a/nodes/Hookdeck/SourceTypes.ts b/nodes/Hookdeck/SourceTypes.ts index 6d73a68..03fb4e5 100644 --- a/nodes/Hookdeck/SourceTypes.ts +++ b/nodes/Hookdeck/SourceTypes.ts @@ -6,18 +6,21 @@ import type { INodePropertyOptions } from 'n8n-workflow'; * reads `Source.properties.type.enum` and the `SourceTypeConfig*` schemas * from https://api.hookdeck.com/2025-07-01/openapi. * - * Held as a constant rather than fetched at runtime: the spec is ~475KB and a + * Held as a constant rather than fetched at runtime: the spec is over 500KB and a * dropdown should not pay that cost every time it opens. `npm run * check:source-types` fails when this file no longer matches the spec. * - * Choosing a platform type makes Hookdeck apply that platform's own signature - * verification scheme. `WEBHOOK` is the generic type, where the verification + * Choosing a platform type lets Hookdeck apply that platform's own signature + * verification scheme, once the source carries what the scheme needs (see + * `SOURCE_TYPE_AUTH`). `WEBHOOK` is the generic type, where the verification * method is configured explicitly. */ export const SOURCE_TYPE_OPTIONS: INodePropertyOptions[] = [ { name: '3DEYE', value: 'THREE_D_EYE' }, { name: 'Adyen', value: 'ADYEN' }, + { name: 'AfterShip', value: 'AFTERSHIP' }, { name: 'Aiprise', value: 'AIPRISE' }, + { name: 'Aircall', value: 'AIRCALL' }, { name: 'Airtable', value: 'AIRTABLE' }, { name: 'Airwallex', value: 'AIRWALLEX' }, { name: 'Akeneo', value: 'AKENEO' }, @@ -27,26 +30,37 @@ export const SOURCE_TYPE_OPTIONS: INodePropertyOptions[] = [ { name: 'Ascend', value: 'ASCEND' }, { name: 'Ashby', value: 'ASHBY' }, { name: 'Attentive', value: 'ATTENTIVE' }, + { name: 'Auth0', value: 'AUTH0' }, { name: 'AWS SNS', value: 'AWS_SNS' }, + { name: 'Azure Event Grid', value: 'AZURE_EVENT_GRID' }, { name: 'Baselinker', value: 'BASELINKER' }, { name: 'BigCommerce', value: 'BIGCOMMERCE' }, + { name: 'Bitbucket', value: 'BITBUCKET' }, { name: 'Bondsmith', value: 'BONDSMITH' }, { name: 'Bridge (Stablecoins)', value: 'BRIDGE_XYZ' }, { name: 'Bridge API', value: 'BRIDGE_API' }, { name: 'Bunny Stream', value: 'BUNNY_STREAM' }, + { name: 'Calendly', value: 'CALENDLY' }, { name: 'Chaindots', value: 'CHAINDOTS' }, { name: 'Chargebee Billing', value: 'CHARGEBEE_BILLING' }, + { name: 'Checkout.com', value: 'CHECKOUT_COM' }, { name: 'Circle', value: 'CIRCLE' }, + { name: 'CircleCI', value: 'CIRCLECI' }, { name: 'Claude', value: 'CLAUDE' }, + { name: 'Clerk', value: 'CLERK' }, { name: 'Clio', value: 'CLIO' }, { name: 'Cloudinary', value: 'CLOUDINARY' }, { name: 'CloudSignal', value: 'CLOUDSIGNAL' }, { name: 'Coinbase', value: 'COINBASE' }, { name: 'Commerce Layer', value: 'COMMERCELAYER' }, + { name: 'Community.com', value: 'COMMUNITY' }, { name: 'Courier', value: 'COURIER' }, + { name: 'Cronofy', value: 'CRONOFY' }, { name: 'Cursor', value: 'CURSOR' }, { name: 'Customer.IO', value: 'CUSTOMERIO' }, + { name: 'Deepgram', value: 'DEEPGRAM' }, { name: 'Discord', value: 'DISCORD' }, + { name: 'Docker Hub', value: 'DOCKER_HUB' }, { name: 'DocuSign', value: 'DOCUSIGN' }, { name: 'Ebay', value: 'EBAY' }, { name: 'ElevenLabs', value: 'ELEVENLABS' }, @@ -54,6 +68,7 @@ export const SOURCE_TYPE_OPTIONS: INodePropertyOptions[] = [ { name: 'Ethoca', value: 'ETHOCA' }, { name: 'Exact Online', value: 'EXACT_ONLINE' }, { name: 'Facebook', value: 'FACEBOOK' }, + { name: 'Fanvue', value: 'FANVUE' }, { name: 'FastSpring', value: 'FASTSPRING' }, { name: 'Faundit', value: 'FAUNDIT' }, { name: 'Favro', value: 'FAVRO' }, @@ -61,35 +76,48 @@ export const SOURCE_TYPE_OPTIONS: INodePropertyOptions[] = [ { name: 'Fireflies.ai', value: 'FIREFLIES' }, { name: 'Fiserv', value: 'FISERV' }, { name: 'Flexport', value: 'FLEXPORT' }, + { name: 'Formstack', value: 'FORMSTACK' }, { name: 'Front', value: 'FRONTAPP' }, { name: 'FusionAuth', value: 'FUSIONAUTH' }, { name: 'GitHub', value: 'GITHUB' }, { name: 'GitLab', value: 'GITLAB' }, { name: 'GoCardless', value: 'GOCARDLESS' }, { name: 'Google Gemini', value: 'GEMINI' }, + { name: 'Google Pub/Sub', value: 'GOOGLE_PUBSUB' }, + { name: 'Grafana', value: 'GRAFANA' }, { name: 'GreenDot', value: 'GREENDOT' }, { name: 'Hookdeck Outpost', value: 'HOOKDECK_OUTPOST' }, { name: 'Hookdeck Publish API', value: 'PUBLISH_API' }, { name: 'HTTP', value: 'HTTP' }, { name: 'Hubspot', value: 'HUBSPOT' }, + { name: 'Hugging Face', value: 'HUGGING_FACE' }, { name: 'Intercom', value: 'INTERCOM' }, + { name: 'Jira', value: 'JIRA' }, + { name: 'Klaviyo', value: 'KLAVIYO' }, + { name: 'Knock', value: 'KNOCK' }, { name: 'Linear', value: 'LINEAR' }, { name: 'LinkedIn', value: 'LINKEDIN' }, { name: 'Lithic', value: 'LITHIC' }, { name: 'Mailchimp', value: 'MAILCHIMP' }, + { name: 'MailerSend', value: 'MAILERSEND' }, { name: 'Mailgun', value: 'MAILGUN' }, { name: 'Managed', value: 'MANAGED' }, + { name: 'MCP Events', value: 'MCP_EVENTS' }, { name: 'Meraki', value: 'MERAKI' }, { name: 'Microsoft Graph', value: 'MICROSOFT_GRAPH' }, { name: 'Microsoft SharePoint', value: 'MICROSOFT_SHAREPOINT' }, + { name: 'Mollie', value: 'MOLLIE' }, { name: 'Monday', value: 'MONDAY' }, { name: 'Neon', value: 'NEON' }, { name: 'NMI Payment Gateway', value: 'NMI' }, + { name: 'Notion', value: 'NOTION' }, { name: 'Nuvemshop', value: 'NUVEMSHOP' }, { name: 'Nylas', value: 'NYLAS' }, { name: 'Okta', value: 'OKTA' }, + { name: 'Onfleet', value: 'ONFLEET' }, { name: 'OpenAI', value: 'OPENAI' }, { name: 'Orb', value: 'ORB' }, + { name: 'Ordinal', value: 'ORDINAL' }, { name: 'Oura', value: 'OURA' }, { name: 'Paddle', value: 'PADDLE' }, { name: 'Paymob', value: 'PAYMOB' }, @@ -105,6 +133,7 @@ export const SOURCE_TYPE_OPTIONS: INodePropertyOptions[] = [ { name: 'Praxis', value: 'PRAXIS' }, { name: 'Property Finder', value: 'PROPERTY-FINDER' }, { name: 'Pylon', value: 'PYLON' }, + { name: 'Quo', value: 'QUO' }, { name: 'Quoter', value: 'QUOTER' }, { name: 'Razorpay', value: 'RAZORPAY' }, { name: 'Recharge', value: 'RECHARGE' }, @@ -118,6 +147,7 @@ export const SOURCE_TYPE_OPTIONS: INodePropertyOptions[] = [ { name: 'Sanity', value: 'SANITY' }, { name: 'Scrapfly', value: 'SCRAPFLY' }, { name: 'SendGrid', value: 'SENDGRID' }, + { name: 'SendGrid Inbound Parse', value: 'SENDGRID_INBOUND' }, { name: 'ShipBob', value: 'SHIPBOB' }, { name: 'ShipHero', value: 'SHIPHERO' }, { name: 'ShipStation', value: 'SHIPSTATION' }, @@ -126,11 +156,14 @@ export const SOURCE_TYPE_OPTIONS: INodePropertyOptions[] = [ { name: 'Slack', value: 'SLACK' }, { name: 'Smartcar', value: 'SMARTCAR' }, { name: 'Smile', value: 'SMILE' }, + { name: 'Snipcart', value: 'SNIPCART' }, { name: 'Solidgate', value: 'SOLIDGATE' }, + { name: 'SparkPost', value: 'SPARKPOST' }, { name: 'Square', value: 'SQUARE' }, { name: 'Statsig', value: 'STATSIG' }, { name: 'Strava', value: 'STRAVA' }, { name: 'Stripe', value: 'STRIPE' }, + { name: 'Supabase', value: 'SUPABASE' }, { name: 'Svix', value: 'SVIX' }, { name: 'Synctera', value: 'SYNCTERA' }, { name: 'Tally', value: 'TALLY' }, @@ -154,11 +187,14 @@ export const SOURCE_TYPE_OPTIONS: INodePropertyOptions[] = [ { name: 'Vercel Webhooks', value: 'VERCEL' }, { name: 'Volume', value: 'VOLUME' }, { name: 'Walmart', value: 'WALMART' }, + { name: 'Webflow', value: 'WEBFLOW' }, { name: 'Webhook (Generic)', value: 'WEBHOOK' }, { name: 'WeChat Pay', value: 'WECHAT' }, + { name: 'Whatnot', value: 'WHATNOT' }, { name: 'WhatsApp', value: 'WHATSAPP' }, { name: 'Wix', value: 'WIX' }, { name: 'WooCommerce', value: 'WOOCOMMERCE' }, + { name: 'WordPress.com', value: 'WORDPRESS_COM' }, { name: 'WorkOS', value: 'WORKOS' }, { name: 'X (Twitter)', value: 'TWITTER' }, { name: 'Xero', value: 'XERO' }, @@ -173,27 +209,37 @@ export const SOURCE_TYPE_OPTIONS: INodePropertyOptions[] = [ * from `SourceTypeConfig*.properties.auth` (following $refs, inline * definitions and `oneOf` alike). * - * The three cases are kept structurally distinct because they need different - * answers, and an array alone cannot tell "takes no secret" apart from "several - * possible schemes": + * The cases are kept structurally distinct because they need different answers, + * and an array alone cannot tell "takes no secret" apart from "several possible + * schemes": * - * - `fields` — the named fields. One means a single supplied secret can be - * placed correctly; several means it cannot. - * - `choice` — the type accepts a choice of schemes, so which fields apply - * cannot be inferred. - * - `none` — the type takes no secret at all. + * - `fields` — the named fields. One means a single supplied secret can be + * placed correctly; several means it cannot. A type offering a choice of + * schemes lands here when one of them is its own, because the node names the + * type as the `auth_type` and so selects that scheme. + * - `choice` — the type accepts a choice of schemes, none of them its own, so + * which fields apply cannot be inferred. + * - `keyless` — Hookdeck verifies the type with keys it fetches itself, but + * only once the source is created with an `auth` object, so the node sends an + * empty one. The spec cannot tell these from `none`; the generator lists them. + * - `none` — there is nowhere to put a secret. Hookdeck either does not + * verify the type or manages its credential itself. * - * Sending a secret the API does not expect is rejected at activation, so each - * case is answered explicitly rather than guessed at. + * Hookdeck drops a field it does not expect, so a secret in the wrong place + * either fails a required-field check at activation or vanishes without a word. + * Each case is answered explicitly rather than guessed at. */ export type SourceAuthShape = | { kind: 'fields'; fields: string[] } | { kind: 'choice' } + | { kind: 'keyless' } | { kind: 'none' }; export const SOURCE_TYPE_AUTH: Record = { 'ADYEN': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'AFTERSHIP': { kind: 'fields', fields: ['webhook_secret_key'] }, 'AIPRISE': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'AIRCALL': { kind: 'fields', fields: ['webhook_secret_key'] }, 'AIRTABLE': { kind: 'fields', fields: ['webhook_secret_key'] }, 'AIRWALLEX': { kind: 'fields', fields: ['webhook_secret_key'] }, 'AKENEO': { kind: 'fields', fields: ['webhook_secret_key'] }, @@ -203,26 +249,37 @@ export const SOURCE_TYPE_AUTH: Record = { 'ASCEND': { kind: 'fields', fields: ['webhook_secret_key'] }, 'ASHBY': { kind: 'fields', fields: ['webhook_secret_key'] }, 'ATTENTIVE': { kind: 'fields', fields: ['webhook_secret_key'] }, - 'AWS_SNS': { kind: 'none' }, + 'AUTH0': { kind: 'fields', fields: ['api_key'] }, + 'AWS_SNS': { kind: 'keyless' }, + 'AZURE_EVENT_GRID': { kind: 'choice' }, 'BASELINKER': { kind: 'none' }, 'BIGCOMMERCE': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'BITBUCKET': { kind: 'fields', fields: ['webhook_secret_key'] }, 'BONDSMITH': { kind: 'fields', fields: ['webhook_secret_key'] }, 'BRIDGE_API': { kind: 'fields', fields: ['webhook_secret_key'] }, 'BRIDGE_XYZ': { kind: 'fields', fields: ['public_key'] }, 'BUNNY_STREAM': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'CALENDLY': { kind: 'fields', fields: ['webhook_secret_key'] }, 'CHAINDOTS': { kind: 'fields', fields: ['webhook_secret_key'] }, 'CHARGEBEE_BILLING': { kind: 'fields', fields: ['password', 'username'] }, + 'CHECKOUT_COM': { kind: 'fields', fields: ['webhook_secret_key'] }, 'CIRCLE': { kind: 'fields', fields: ['api_key'] }, + 'CIRCLECI': { kind: 'fields', fields: ['webhook_secret_key'] }, 'CLAUDE': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'CLERK': { kind: 'fields', fields: ['webhook_secret_key'] }, 'CLIO': { kind: 'fields', fields: ['webhook_secret_key'] }, 'CLOUDINARY': { kind: 'fields', fields: ['webhook_secret_key'] }, 'CLOUDSIGNAL': { kind: 'fields', fields: ['api_key'] }, 'COINBASE': { kind: 'fields', fields: ['webhook_secret_key'] }, 'COMMERCELAYER': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'COMMUNITY': { kind: 'fields', fields: ['webhook_secret_key'] }, 'COURIER': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'CRONOFY': { kind: 'fields', fields: ['webhook_secret_key'] }, 'CURSOR': { kind: 'fields', fields: ['webhook_secret_key'] }, 'CUSTOMERIO': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'DEEPGRAM': { kind: 'fields', fields: ['password', 'username'] }, 'DISCORD': { kind: 'fields', fields: ['public_key'] }, + 'DOCKER_HUB': { kind: 'none' }, 'DOCUSIGN': { kind: 'fields', fields: ['webhook_secret_key'] }, 'EBAY': { kind: 'fields', fields: ['client_id', 'client_secret', 'dev_id', 'environment', 'verification_token'] }, 'ELEVENLABS': { kind: 'fields', fields: ['webhook_secret_key'] }, @@ -230,6 +287,7 @@ export const SOURCE_TYPE_AUTH: Record = { 'ETHOCA': { kind: 'none' }, 'EXACT_ONLINE': { kind: 'fields', fields: ['webhook_secret_key'] }, 'FACEBOOK': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'FANVUE': { kind: 'fields', fields: ['webhook_secret_key'] }, 'FASTSPRING': { kind: 'fields', fields: ['webhook_secret_key'] }, 'FAUNDIT': { kind: 'fields', fields: ['webhook_secret_key'] }, 'FAVRO': { kind: 'fields', fields: ['webhook_secret_key'] }, @@ -237,34 +295,47 @@ export const SOURCE_TYPE_AUTH: Record = { 'FIREFLIES': { kind: 'fields', fields: ['webhook_secret_key'] }, 'FISERV': { kind: 'fields', fields: ['store_name', 'webhook_secret_key'] }, 'FLEXPORT': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'FORMSTACK': { kind: 'fields', fields: ['header_key', 'webhook_secret_key'] }, 'FRONTAPP': { kind: 'fields', fields: ['webhook_secret_key'] }, 'FUSIONAUTH': { kind: 'fields', fields: ['webhook_secret_key'] }, 'GEMINI': { kind: 'fields', fields: ['webhook_secret_key'] }, 'GITHUB': { kind: 'fields', fields: ['webhook_secret_key'] }, 'GITLAB': { kind: 'fields', fields: ['api_key'] }, 'GOCARDLESS': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'GOOGLE_PUBSUB': { kind: 'fields', fields: ['audience', 'service_account_email'] }, + 'GRAFANA': { kind: 'fields', fields: ['header_key', 'timestamp_header', 'webhook_secret_key'] }, 'GREENDOT': { kind: 'fields', fields: ['password', 'username'] }, 'HOOKDECK_OUTPOST': { kind: 'none' }, 'HTTP': { kind: 'choice' }, 'HUBSPOT': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'HUGGING_FACE': { kind: 'fields', fields: ['api_key'] }, 'INTERCOM': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'JIRA': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'KLAVIYO': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'KNOCK': { kind: 'fields', fields: ['webhook_secret_key'] }, 'LINEAR': { kind: 'fields', fields: ['webhook_secret_key'] }, 'LINKEDIN': { kind: 'fields', fields: ['webhook_secret_key'] }, 'LITHIC': { kind: 'fields', fields: ['webhook_secret_key'] }, 'MAILCHIMP': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'MAILERSEND': { kind: 'fields', fields: ['webhook_secret_key'] }, 'MAILGUN': { kind: 'fields', fields: ['webhook_secret_key'] }, 'MANAGED': { kind: 'fields', fields: ['token'] }, + 'MCP_EVENTS': { kind: 'fields', fields: ['webhook_secret_key'] }, 'MERAKI': { kind: 'fields', fields: ['api_key'] }, 'MICROSOFT_GRAPH': { kind: 'none' }, 'MICROSOFT_SHAREPOINT': { kind: 'none' }, + 'MOLLIE': { kind: 'fields', fields: ['webhook_secret_key'] }, 'MONDAY': { kind: 'none' }, 'NEON': { kind: 'fields', fields: ['neon_auth_url'] }, 'NMI': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'NOTION': { kind: 'fields', fields: ['webhook_secret_key'] }, 'NUVEMSHOP': { kind: 'fields', fields: ['webhook_secret_key'] }, 'NYLAS': { kind: 'fields', fields: ['webhook_secret_key'] }, 'OKTA': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'ONFLEET': { kind: 'fields', fields: ['webhook_secret_key'] }, 'OPENAI': { kind: 'fields', fields: ['webhook_secret_key'] }, 'ORB': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'ORDINAL': { kind: 'choice' }, 'OURA': { kind: 'fields', fields: ['webhook_secret_key'] }, 'PADDLE': { kind: 'fields', fields: ['webhook_secret_key'] }, 'PAYMOB': { kind: 'fields', fields: ['webhook_secret_key'] }, @@ -280,6 +351,7 @@ export const SOURCE_TYPE_AUTH: Record = { 'PRAXIS': { kind: 'fields', fields: ['webhook_secret_key'] }, 'PUBLISH_API': { kind: 'none' }, 'PYLON': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'QUO': { kind: 'fields', fields: ['webhook_secret_key'] }, 'QUOTER': { kind: 'fields', fields: ['webhook_secret_key'] }, 'RAZORPAY': { kind: 'fields', fields: ['webhook_secret_key'] }, 'RECHARGE': { kind: 'fields', fields: ['webhook_secret_key'] }, @@ -293,19 +365,23 @@ export const SOURCE_TYPE_AUTH: Record = { 'SANITY': { kind: 'fields', fields: ['webhook_secret_key'] }, 'SCRAPFLY': { kind: 'fields', fields: ['webhook_secret_key'] }, 'SENDGRID': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'SENDGRID_INBOUND': { kind: 'choice' }, 'SHIPBOB': { kind: 'fields', fields: ['webhook_secret_key'] }, 'SHIPHERO': { kind: 'fields', fields: ['webhook_secret_key'] }, - 'SHIPSTATION': { kind: 'fields', fields: ['public_key'] }, + 'SHIPSTATION': { kind: 'keyless' }, 'SHOPIFY': { kind: 'fields', fields: ['webhook_secret_key'] }, 'SHOPLINE': { kind: 'fields', fields: ['webhook_secret_key'] }, 'SLACK': { kind: 'fields', fields: ['webhook_secret_key'] }, 'SMARTCAR': { kind: 'fields', fields: ['webhook_secret_key'] }, 'SMILE': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'SNIPCART': { kind: 'fields', fields: ['api_key'] }, 'SOLIDGATE': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'SPARKPOST': { kind: 'fields', fields: ['password', 'username'] }, 'SQUARE': { kind: 'fields', fields: ['webhook_secret_key'] }, 'STATSIG': { kind: 'fields', fields: ['webhook_secret_key'] }, 'STRAVA': { kind: 'none' }, 'STRIPE': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'SUPABASE': { kind: 'fields', fields: ['api_key', 'header_key'] }, 'SVIX': { kind: 'fields', fields: ['webhook_secret_key'] }, 'SYNCTERA': { kind: 'fields', fields: ['webhook_secret_key'] }, 'TALLY': { kind: 'fields', fields: ['webhook_secret_key'] }, @@ -331,11 +407,14 @@ export const SOURCE_TYPE_AUTH: Record = { 'VERCEL_LOG_DRAINS': { kind: 'fields', fields: ['webhook_secret_key'] }, 'VOLUME': { kind: 'fields', fields: ['environment'] }, 'WALMART': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'WEBFLOW': { kind: 'fields', fields: ['webhook_secret_key'] }, 'WEBHOOK': { kind: 'choice' }, 'WECHAT': { kind: 'fields', fields: ['public_key'] }, + 'WHATNOT': { kind: 'fields', fields: ['webhook_secret_key'] }, 'WHATSAPP': { kind: 'fields', fields: ['webhook_secret_key'] }, 'WIX': { kind: 'fields', fields: ['webhook_secret_key'] }, 'WOOCOMMERCE': { kind: 'fields', fields: ['webhook_secret_key'] }, + 'WORDPRESS_COM': { kind: 'none' }, 'WORKOS': { kind: 'fields', fields: ['webhook_secret_key'] }, 'XERO': { kind: 'fields', fields: ['webhook_secret_key'] }, 'ZENDESK': { kind: 'fields', fields: ['webhook_secret_key'] }, diff --git a/nodes/Hookdeck/descriptions/SourceProperties.ts b/nodes/Hookdeck/descriptions/SourceProperties.ts index 23f7ecd..3e5dd06 100644 --- a/nodes/Hookdeck/descriptions/SourceProperties.ts +++ b/nodes/Hookdeck/descriptions/SourceProperties.ts @@ -77,7 +77,7 @@ export function sourceConfigProperties(extraShow: ShowConditions = {}): INodePro }, }, description: - 'Signing secret issued by the platform. Leave empty to skip verification. Platforms whose verification needs more than a single secret can be configured with Source Config (JSON) under Options.', + 'Signing secret issued by the platform. Leave empty to skip verification, except on platforms such as AWS SNS and ShipStation that Hookdeck verifies without one. Platforms whose verification needs more than a single secret can be configured with Source Config (JSON) under Options.', }, { displayName: 'HMAC Secret', diff --git a/scripts/generate-source-types.mjs b/scripts/generate-source-types.mjs index c8cf0ea..963cf1b 100644 --- a/scripts/generate-source-types.mjs +++ b/scripts/generate-source-types.mjs @@ -2,7 +2,7 @@ /** * Regenerate `nodes/Hookdeck/SourceTypes.ts` from Hookdeck's live OpenAPI schema. * - * Both exports in that file are derived data — the ~150 platform source types + * Both exports in that file are derived data — the ~180 platform source types * and the auth shape each one expects — and both go stale silently as Hookdeck * adds platform support. Silently is the problem: a missing type is a platform * the node cannot offer, and a wrong auth shape is a secret sent in a field the @@ -42,8 +42,13 @@ const LABEL_OVERRIDES = { 'PROPERTY-FINDER': 'Property Finder', // The spec labels this "Managed", which collides with the MANAGED type above. HOOKDECK_OUTPOST: 'Hookdeck Outpost', - // The spec says "X". Alone in a 150-entry dropdown that is unrecognisable. + // The spec says "X". Alone in a 180-entry dropdown that is unrecognisable. TWITTER: 'X (Twitter)', + // A choice of auth schemes carries no `x-docs-type` of its own, so these fall + // through to title-casing. GitLab was labelled correctly until it gained a + // second scheme, after which it read "Gitlab". + GITLAB: 'GitLab', + SENDGRID_INBOUND: 'SendGrid Inbound Parse', // Vendor casing the spec gets wrong. SENDGRID: 'SendGrid', CLOUDSIGNAL: 'CloudSignal', @@ -52,37 +57,120 @@ const LABEL_OVERRIDES = { FRONTAPP: 'Front', }; -/** Resolve a `$ref`, or hand back an inline schema unchanged. */ +/** + * Types Hookdeck verifies with signing keys it fetches itself, once the source is + * created with an `auth` object, even an empty one. + * + * The spec cannot say this. Their auth schema is an empty object, identical to + * Docker Hub's or WordPress.com's, which Hookdeck does not verify at all. The + * difference lives in Hookdeck's own source type definitions, as a verification + * feature with no fields that its dashboard shows as an on/off toggle. A source + * created without `auth` gets no verification and accepts anything sent to it. + * That is what the node created for AWS SNS, while its refusal of a secret told + * users Hookdeck verified the platform without one. + */ +const KEYLESS_VERIFICATION = new Set([ + // The signing certificate is fetched from the URL each message names. + 'AWS_SNS', + // Keys come from ShipStation's published JWKS. This took a `public_key` until + // October 2026; Hookdeck now strips one silently rather than rejecting it. + 'SHIPSTATION', +]); + +/** + * Resolve a `$ref`, or hand back an inline schema unchanged. + * + * The schema name is everything after `#/components/schemas/`, not the last + * path segment. Hookdeck names schemas after display labels, and "Google + * Pub/Sub" puts an unescaped slash in the ref: a last-segment lookup found + * "SubAuth", which does not exist, and read Pub/Sub as taking no secret when it + * requires two values. `~1` and `~0` are JSON Pointer escapes, honoured in case + * the spec starts escaping properly. + */ function deref(schemas, schema) { if (!schema) return undefined; - if (schema.$ref) return schemas[schema.$ref.split('/').pop()]; + if (schema.$ref) { + const name = schema.$ref + .replace(/^#\/components\/schemas\//, '') + .replace(/~1/g, '/') + .replace(/~0/g, '~'); + return schemas[name]; + } return schema; } +/** The fields an auth schema names, or `none` when it names nothing. */ +function fieldsShape(auth) { + const fields = Object.keys(auth.properties ?? {}).sort(); + if (fields.length === 0) return { kind: 'none' }; + return { kind: 'fields', fields }; +} + /** - * Work out how a source type expects its verification secret to be supplied. + * The scheme a type's own name selects, when it offers a choice that includes it. * - * Three outcomes, because they need three different answers from the node: - * a single named field can hold a supplied secret, several cannot, a choice of - * schemes cannot be inferred, and some types take no secret at all. + * The node sends `auth_type` set to the source type itself with every platform + * secret (see `buildSourceConfig`), so a choice of schemes only leaves the node + * unable to answer when the type's own name is not one of the options. GitLab is + * the case that forced this: it gained a Standard Webhooks scheme beside its own + * `GITLAB` one, and reading that as a bare choice would have refused the secret + * that `GITLAB` scheme takes in `api_key` — the request the node already sends. + */ +function ownScheme(schemas, config, type) { + if (!config.properties.auth_type.enum?.includes(type)) return undefined; + const auth = deref(schemas, config.properties.auth); + return auth?.oneOf + ?.map((scheme) => deref(schemas, scheme)) + .find((scheme) => scheme?.['x-docs-type'] === type); +} + +/** + * How a source type expects verification to be set up, with the keyless + * exceptions the spec cannot express applied on top. */ function authShapeFor(schemas, type) { + const shape = specAuthShapeFor(schemas, type); + if (!KEYLESS_VERIFICATION.has(type)) return shape; + + // The exception only holds while the spec agrees there is nothing to enter. + // Failing here is what makes the weekly drift check report a stale entry, + // rather than the node going on sending an empty `auth` to a type that now + // wants something in it. + if (shape?.kind !== 'none') { + throw new Error( + `${type} is in KEYLESS_VERIFICATION, but the spec now gives it ${ + shape ? `kind "${shape.kind}"` : 'no config schema' + }. Check how Hookdeck verifies it and update the list.`, + ); + } + return { kind: 'keyless' }; +} + +/** + * Work out from the spec alone how a source type expects its verification + * secret to be supplied. + * + * Each outcome needs a different answer from the node: a single named field can + * hold a supplied secret, several cannot, a choice of schemes cannot be + * inferred, and some types have nowhere to put a secret at all. + */ +function specAuthShapeFor(schemas, type) { const config = schemas[`SourceTypeConfig${type}`]; // No config schema: an unknown or newer type. Left out of the map entirely so // the node falls back to the common field rather than asserting a shape. if (!config) return undefined; - // An `auth_type` property means the type accepts a choice of schemes, so - // which fields apply cannot be known from the type alone. - if (config.properties?.auth_type) return { kind: 'choice' }; + // An `auth_type` property means the type accepts a choice of schemes. Which + // fields apply can only be known when one of those schemes is the type's own. + if (config.properties?.auth_type) { + const own = ownScheme(schemas, config, type); + return own ? fieldsShape(own) : { kind: 'choice' }; + } const auth = deref(schemas, config.properties?.auth); if (!auth) return { kind: 'none' }; if (auth.oneOf) return { kind: 'choice' }; - - const fields = Object.keys(auth.properties ?? {}).sort(); - if (fields.length === 0) return { kind: 'none' }; - return { kind: 'fields', fields }; + return fieldsShape(auth); } function labelFor(schemas, type) { @@ -124,12 +212,13 @@ function render(options, authShapes) { * reads \`Source.properties.type.enum\` and the \`SourceTypeConfig*\` schemas * from ${DEFAULT_SPEC}. * - * Held as a constant rather than fetched at runtime: the spec is ~475KB and a + * Held as a constant rather than fetched at runtime: the spec is over 500KB and a * dropdown should not pay that cost every time it opens. \`npm run * check:source-types\` fails when this file no longer matches the spec. * - * Choosing a platform type makes Hookdeck apply that platform's own signature - * verification scheme. \`WEBHOOK\` is the generic type, where the verification + * Choosing a platform type lets Hookdeck apply that platform's own signature + * verification scheme, once the source carries what the scheme needs (see + * \`SOURCE_TYPE_AUTH\`). \`WEBHOOK\` is the generic type, where the verification * method is configured explicitly. */ export const SOURCE_TYPE_OPTIONS: INodePropertyOptions[] = [ @@ -141,22 +230,30 @@ ${optionLines} * from \`SourceTypeConfig*.properties.auth\` (following $refs, inline * definitions and \`oneOf\` alike). * - * The three cases are kept structurally distinct because they need different - * answers, and an array alone cannot tell "takes no secret" apart from "several - * possible schemes": + * The cases are kept structurally distinct because they need different answers, + * and an array alone cannot tell "takes no secret" apart from "several possible + * schemes": * - * - \`fields\` — the named fields. One means a single supplied secret can be - * placed correctly; several means it cannot. - * - \`choice\` — the type accepts a choice of schemes, so which fields apply - * cannot be inferred. - * - \`none\` — the type takes no secret at all. + * - \`fields\` — the named fields. One means a single supplied secret can be + * placed correctly; several means it cannot. A type offering a choice of + * schemes lands here when one of them is its own, because the node names the + * type as the \`auth_type\` and so selects that scheme. + * - \`choice\` — the type accepts a choice of schemes, none of them its own, so + * which fields apply cannot be inferred. + * - \`keyless\` — Hookdeck verifies the type with keys it fetches itself, but + * only once the source is created with an \`auth\` object, so the node sends an + * empty one. The spec cannot tell these from \`none\`; the generator lists them. + * - \`none\` — there is nowhere to put a secret. Hookdeck either does not + * verify the type or manages its credential itself. * - * Sending a secret the API does not expect is rejected at activation, so each - * case is answered explicitly rather than guessed at. + * Hookdeck drops a field it does not expect, so a secret in the wrong place + * either fails a required-field check at activation or vanishes without a word. + * Each case is answered explicitly rather than guessed at. */ export type SourceAuthShape = | { kind: 'fields'; fields: string[] } | { kind: 'choice' } + | { kind: 'keyless' } | { kind: 'none' }; export const SOURCE_TYPE_AUTH: Record = { diff --git a/test/live/api.test.mjs b/test/live/api.test.mjs index e9dde8e..6915d2a 100644 --- a/test/live/api.test.mjs +++ b/test/live/api.test.mjs @@ -221,6 +221,55 @@ test('live API surface', { skip, concurrency: false }, async (t) => { ); }); + await t.test('GitLab takes its secret in api_key, under its own scheme', async () => { + // GitLab's spec now offers Standard Webhooks beside its own GITLAB scheme. + // The node still sends `auth_type: 'GITLAB'` with the secret in `api_key`, + // and the spec saying that is valid is not the same as Hookdeck accepting it. + const { connection } = await provision(`${PREFIX}-gitlab`, { + sourceType: 'GITLAB', + platformSecret: 'gitlab-livetest-token', + }); + const source = await api('GET', `/sources/${connection.source.id}`); + + assert.equal(source.type, 'GITLAB'); + // Unlike the single-scheme platforms above, a type with a choice may echo + // the scheme it was given. If it does, that has to be GitLab's own. + if (source.config?.auth_type != null) assert.equal(source.config.auth_type, 'GITLAB'); + }); + + await t.test('AWS SNS and ShipStation are verified without a secret', async () => { + // Hookdeck verifies both with keys it fetches itself, but creates that + // verification only for a source sent with `auth`, even an empty one, and + // reports which happened as `authenticated`. The bare source is the + // control: if it ever comes back authenticated too, Hookdeck has made this + // the default and the node's empty `auth` is no longer doing anything. + for (const sourceType of ['AWS_SNS', 'SHIPSTATION']) { + const slug = sourceType.toLowerCase().replace(/_/g, '-'); + const { connection } = await provision(`${PREFIX}-${slug}`, { sourceType }); + const source = await api('GET', `/sources/${connection.source.id}`); + + assert.equal(source.type, sourceType); + assert.ok('authenticated' in source, 'the API stopped reporting authenticated'); + assert.equal(source.authenticated, true, `${sourceType}: the node's source is not verified`); + + const bare = await api('PUT', '/connections', { + name: `${PREFIX}-${slug}-bare`, + source: { name: `${PREFIX}-${slug}-bare`, type: sourceType }, + destination: { + name: `${PREFIX}-${slug}-bare-dest`, + type: 'HTTP', + config: { url: DESTINATION_URL }, + }, + }); + const bareSource = await api('GET', `/sources/${bare.source.id}`); + assert.equal( + bareSource.authenticated, + false, + `${sourceType}: a source sent without auth is verified anyway`, + ); + } + }); + await t.test('Source Config (JSON) overrides the generated config', async () => { // The merge is one level deep, so `auth` is replaced wholesale rather than // blended. That suits the documented purpose — expressing a scheme the diff --git a/test/unit.test.mjs b/test/unit.test.mjs index d5a6a28..1b3a048 100644 --- a/test/unit.test.mjs +++ b/test/unit.test.mjs @@ -283,20 +283,86 @@ test('platform auth shapes come from the spec, not assumption', () => { assert.deepEqual(SOURCE_TYPE_AUTH.GITLAB, { kind: 'fields', fields: ['api_key'] }); assert.deepEqual(SOURCE_TYPE_AUTH.POSTMARK, { kind: 'fields', fields: ['password', 'username'] }); - // The three non-field cases must stay distinguishable: they need different - // answers, and an array alone cannot tell "no secret" from "several schemes". + // The non-field cases must stay distinguishable: they need different answers, + // and an array alone cannot tell "no secret" from "several schemes". assert.equal(SOURCE_TYPE_AUTH.HTTP.kind, 'choice'); - assert.equal(SOURCE_TYPE_AUTH.AWS_SNS.kind, 'none'); assert.equal(SOURCE_TYPE_AUTH.MONDAY.kind, 'none'); for (const [type, shape] of Object.entries(SOURCE_TYPE_AUTH)) { - assert.ok(['fields', 'choice', 'none'].includes(shape.kind), `${type} has an unknown kind`); + assert.ok( + ['fields', 'choice', 'keyless', 'none'].includes(shape.kind), + `${type} has an unknown kind`, + ); if (shape.kind === 'fields') { assert.ok(shape.fields.length > 0, `${type} claims fields but names none`); } } }); +test('a choice of schemes that includes the type itself resolves to that scheme', () => { + // The node sends `auth_type` set to the source type, which selects the scheme + // named after it. GitLab gained a Standard Webhooks scheme beside its own, and + // reading that as an unanswerable choice would have refused the very request + // the node already sends. The live suite checks Hookdeck still accepts it. + assert.deepEqual(SOURCE_TYPE_AUTH.GITLAB, { kind: 'fields', fields: ['api_key'] }); + + // Without its own name among the options, a choice is still a choice. + assert.equal(SOURCE_TYPE_AUTH.AZURE_EVENT_GRID.kind, 'choice'); + assert.equal(SOURCE_TYPE_AUTH.SENDGRID_INBOUND.kind, 'choice'); +}); + +test('labels the spec cannot supply are not left to title-casing', () => { + // A choice of auth schemes carries no `x-docs-type` of its own, so these + // would otherwise read "Gitlab" and "Sendgrid Inbound". + const label = (value) => SOURCE_TYPE_OPTIONS.find((o) => o.value === value)?.name; + assert.equal(label('GITLAB'), 'GitLab'); + assert.equal(label('SENDGRID_INBOUND'), 'SendGrid Inbound Parse'); +}); + +test('a schema whose name holds a slash still resolves', () => { + // Hookdeck names schemas after labels, so "Google Pub/Sub" puts an unescaped + // slash in the $ref. Read as a path, it resolved to nothing and Pub/Sub was + // offered as taking no secret, when Hookdeck requires both of these. + assert.deepEqual(SOURCE_TYPE_AUTH.GOOGLE_PUBSUB, { + kind: 'fields', + fields: ['audience', 'service_account_email'], + }); + const label = SOURCE_TYPE_OPTIONS.find((o) => o.value === 'GOOGLE_PUBSUB')?.name; + assert.equal(label, 'Google Pub/Sub', 'the label comes from the same schema'); +}); + +test('a platform Hookdeck verifies without a secret is sent an empty auth', () => { + // Hookdeck creates verification only for a source sent with `auth`. These + // types need nothing entered, so without the empty object they were left + // accepting unsigned requests. The live suite checks Hookdeck agrees. + for (const type of ['AWS_SNS', 'SHIPSTATION']) { + assert.equal(SOURCE_TYPE_AUTH[type].kind, 'keyless', type); + const config = buildSourceConfig.call( + fakeSourceConfigContext({ platformSecret: '' }), + type, + {}, + ); + assert.deepEqual(config, { auth: {} }, type); + } + + // A secret would be dropped by Hookdeck, so it is refused rather than sent. + assert.throws( + () => + buildSourceConfig.call(fakeSourceConfigContext({ platformSecret: 'x' }), 'SHIPSTATION', {}), + (error) => { + assert.match(error.message, /does not take a verification secret/); + assert.match(error.description ?? '', /fetches from the platform itself/); + return true; + }, + ); + + // Source Config (JSON) still wins, so verification can be turned off. + const off = buildSourceConfig.call(fakeSourceConfigContext({ platformSecret: '' }), 'AWS_SNS', { + sourceConfigJson: '{"auth": null}', + }); + assert.deepEqual(off, { auth: null }); +}); + test('every mapped source type is one the UI actually offers', () => { // Both are generated from the same schema; a mapped type the UI never offers // is dead weight, and the reverse would mean offering something unprovisionable. @@ -1024,7 +1090,7 @@ test('platform auth covers inline, choice-of-scheme and no-secret types', () => // Types taking no secret need their own answer: telling someone to use // Source Config (JSON) here would send them after a secret that does not exist. assert.throws( - () => buildSourceConfig.call(fakeSourceConfigContext({ platformSecret: 'x' }), 'AWS_SNS', {}), + () => buildSourceConfig.call(fakeSourceConfigContext({ platformSecret: 'x' }), 'MONDAY', {}), (error) => { assert.match(error.message, /does not take a verification secret/); assert.match(error.description ?? '', /Leave Webhook Secret empty/); @@ -1033,7 +1099,11 @@ test('platform auth covers inline, choice-of-scheme and no-secret types', () => ); // And leaving it empty provisions cleanly. - const none = buildSourceConfig.call(fakeSourceConfigContext({ platformSecret: '' }), 'AWS_SNS', {}); + const none = buildSourceConfig.call( + fakeSourceConfigContext({ platformSecret: '' }), + 'MONDAY', + {}, + ); assert.deepEqual(none, {}); });