From e4c7f9405d5daef1f4e92bb8a2a1dd2df3953d62 Mon Sep 17 00:00:00 2001 From: Phil Leggetter Date: Thu, 22 Oct 2026 17:49:43 +0100 Subject: [PATCH] Say how the API key is stored and supplied, and stop saying every platform needs a secret Issue #12 asked for a note on how n8n stores the key and whether there is a route other than pasting it into the editor, because that is the first question a security review asks and the Cloud and self-hosted answers differ. It proposed saying there is no environment-variable route. Checked against n8n 2.44.6's source, there is one: CREDENTIALS_OVERWRITE_DATA fills a credential field from the environment without storing it in the credential, and the editor then hides that field. That pins every Hookdeck credential made in the editor to one project, which the docs now say. So Getting started lists what does work, with its catch: external secrets ($secrets, Enterprise on Cloud and self-hosted), credential overwrites on self-hosted, and the public API or `n8n import:credentials` for scripted setups. It also says why `$env` is not on the list: n8n 2.x blocks it unless N8N_BLOCK_ENV_ACCESS_IN_NODE=false, which reopens environment access to every node on the instance, and Cloud has no environment to read. Separately, four places told users verification needs a Webhook Secret. That stopped being true when #33 had the node switch verification on for AWS SNS and ShipStation, which Hookdeck verifies with keys it fetches itself. The README security model, Getting started, Security and the trigger reference now name the exception. Closes #12. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 7 +++++++ README.md | 2 +- docs/getting-started.md | 30 ++++++++++++++++++++++++++++-- docs/security.md | 10 +++++++++- docs/trigger.md | 4 ++-- 5 files changed, 47 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f46050..fd53768 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,13 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). **Webhook Secret**, rather than sending something Hookdeck would reject or silently drop. +### Changed + +- [Getting started](docs/getting-started.md) now says how n8n stores the API + key, and covers the routes other than pasting it into the editor: external + secrets, credential overwrites on self-hosted, and n8n's public API and CLI. + It also says why `$env` is not one of them. + ### Fixed - **AWS SNS** and **ShipStation** sources the trigger creates are now verified. diff --git a/README.md b/README.md index eb719eb..eaa954c 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Three importable workflows are in [`examples/`](examples/), all built and run ag Webhook payloads are third-party input, and these nodes treat them that way: -- Provider verification happens at the Hookdeck source, using that platform's own scheme, once you supply its signing secret. That secret lives at the Hookdeck source; the trigger sends it there on publish and never checks a signature with it itself. +- Provider verification happens at the Hookdeck source, using that platform's own scheme, once you supply its signing secret. AWS SNS and ShipStation need none, and the node switches theirs on. That secret lives at the Hookdeck source; the trigger sends it there on publish and never checks a signature with it itself. - Deliveries into n8n carry a second signature, in `x-hookdeck-n8n-signature`, made with a secret the trigger generates on publish. Requests that fail it get `401` and never start the workflow. - n8n's own webhook URL is hidden on the trigger. Sending a provider there bypasses Hookdeck and silently loses everything above. - A body that is not valid UTF-8 is rejected with `400`, outside the retryable range, rather than parsed into corrupted text. diff --git a/docs/getting-started.md b/docs/getting-started.md index 2a84307..af83e96 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -35,6 +35,30 @@ project, add a second credential. A key from an Outpost project will not work here. Outpost is the outbound path, with its own API; these nodes only speak to the Event Gateway. +### How the key is stored, and routes other than the editor + +n8n stores the key in its own database, encrypted with the instance's +`N8N_ENCRYPTION_KEY`, and shows it masked once saved. Pasting it into the +editor is the usual route, but not the only one: + +- **External secrets** (Enterprise, self-hosted or Cloud). Set **API Key** to + `{{ $secrets.. }}` and n8n reads the key from AWS Secrets + Manager, Azure Key Vault, GCP Secrets Manager, HashiCorp Vault, Infisical or + 1Password. This is the answer when policy says secrets are not pasted into + UIs. +- **Credential overwrites** (self-hosted). Setting + `CREDENTIALS_OVERWRITE_DATA='{"hookdeckEventGatewayApi":{"apiKey":""}}'` + fills **API Key** on Hookdeck credentials without storing the key in them. + The editor then hides the field, so every Hookdeck credential created there + uses that key, and so that one project. +- **Scripted provisioning.** n8n's public API and `n8n import:credentials` + create the credential without the editor. + +Not `{{ $env.HOOKDECK_API_KEY }}`. n8n 2.x blocks `$env` in expressions +unless `N8N_BLOCK_ENV_ACCESS_IN_NODE=false`, which reopens environment access +to every node and Code step on the instance, and n8n Cloud has no environment to +read. Credential overwrites do the same job without that cost. + ## Setting up the trigger Set a source name, pick the platform sending the events, and activate the @@ -56,8 +80,10 @@ configured on the node under **Options**. Every option is listed in the **Verification only starts when a secret is set.** Choosing a Source Type tells Hookdeck *which* signature scheme that platform uses; it does not enable verification on its own. Fill in **Webhook Secret** for platform sources, or -set **Verification** for generic ones. [Security](security.md) explains why this -is easy to miss and how to confirm a source is verifying. +set **Verification** for generic ones. AWS SNS and ShipStation are the +exception: Hookdeck fetches their signing keys itself, so they take no secret, +and the node turns their verification on. [Security](security.md) explains why +this is easy to miss and how to confirm a source is verifying. ### An existing source is adopted, not rewritten diff --git a/docs/security.md b/docs/security.md index 743ab79..314ecbb 100644 --- a/docs/security.md +++ b/docs/security.md @@ -13,7 +13,15 @@ no signing secret accepts an unsigned, forged payload and delivers it — the ed answers `200` and records `verified: false`. So fill in **Webhook Secret** for platform sources, or set **Verification** for -generic ones. Two things make this easy to miss: +generic ones. + +AWS SNS and ShipStation are the exception. Hookdeck fetches their signing keys +itself, so there is no secret to enter, but their verification is still off +unless the source is created with it on. The node does that whenever **Webhook +Secret** is empty. A source of either type created some other way may not have +it. + +Two things make this easy to miss: - **The status code is not the verdict.** Hookdeck answers `200` at the edge whether or not a payload verified. The answer is the `verified` field on the diff --git a/docs/trigger.md b/docs/trigger.md index 414bf0a..9827089 100644 --- a/docs/trigger.md +++ b/docs/trigger.md @@ -9,9 +9,9 @@ is covered in [Getting started](getting-started.md). | Parameter | Description | | --- | --- | | Source | The Hookdeck source. **From List** shows every source in the project with its public URL, so you can copy the URL for your provider without leaving the canvas. **By Name** takes a new name — letters, numbers, hyphens and underscores — and creates the source on publish. | -| Source Type | The platform sending events. This selects *which* signature scheme Hookdeck applies; it does not switch verification on by itself — see [Security](security.md#verification-only-starts-when-a-secret-is-set). Use **Webhook (Generic)** to configure verification yourself. Applies when the node creates the source; an existing source keeps its own type. | +| Source Type | The platform sending events. This selects *which* signature scheme Hookdeck applies; it does not switch verification on by itself, except for AWS SNS and ShipStation, which need no secret — see [Security](security.md#verification-only-starts-when-a-secret-is-set). Use **Webhook (Generic)** to configure verification yourself. Applies when the node creates the source; an existing source keeps its own type. | | Verification | For generic sources: HMAC, API Key, Basic Auth, or none. | -| Webhook Secret | For platform sources: the signing secret the platform issued you. Placed in whichever field that platform expects. A few platforms need more than one value — those ask you to use Source Config (JSON) instead, and name the fields. | +| Webhook Secret | For platform sources: the signing secret the platform issued you. Placed in whichever field that platform expects. A few platforms need more than one value — those ask you to use Source Config (JSON) instead, and name the fields. AWS SNS and ShipStation take none; leave it empty and the node switches their verification on. | | Acknowledgement Mode | **Async Retry** (default) or **Sync**. See [Acknowledgement modes](#acknowledgement-modes). | ## Options