Lock down n8n webhooks with shared-secret header auth - #7
Draft
Frezertade wants to merge 2 commits into
Draft
Frezertade wants to merge 2 commits into
Frezertade wants to merge 2 commits into
Conversation
Workflows 01, 02, 03, 04a, 05, 07 now require
'X-Webhook-Secret: <N8N_WEBHOOK_SECRET>' on every call. n8n's native
'headerAuth' returns 401 when the header is missing or wrong. Public
exemptions: 04 (Etsy OAuth callback — Etsy can't send custom headers)
and 02b (mockup image proxy — browser <img> can't send headers either).
Internal cross-workflow calls were updated to send the header:
- wf 06 'Dispatch POD' → wf 07
- wf 03 'Validate + Visual' → wf 02
Workflow 04a switches from rendering an HTML page to returning JSON
{auth_url, state, shop_name}. The ToolJet Shops tab now has a query
that hits /webhook/etsy-connect with the auth header, then the button's
onSuccess redirects window.open(auth_url). This sidesteps the issue of
window.open being unable to send the secret header.
ToolJet's n8n_api datasource sends X-Webhook-Secret on every call,
sourced from a new N8N_WEBHOOK_SECRET workspace constant. README
documents the one-time credential setup.
https://claude.ai/code/session_019vtZjGwcACasFeauRYTQnj
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 32453737 | Triggered | Generic High Entropy Secret | 9036391 | tooljet-apps/etsy_dashboard.json | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
GitGuardian flagged 'set_to_match_n8n_env' as a high-entropy generic secret — it's a placeholder, not a real value, but tripping the detector is noise. Empty string signals 'operator MUST set this' without any entropy, and the _note already explains where to source it from. https://claude.ai/code/session_019vtZjGwcACasFeauRYTQnj
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.
Summary
Closes the open-webhook security gap. Every data-mutating webhook now requires
X-Webhook-Secret: <N8N_WEBHOOK_SECRET>on every call; n8n returns 401 otherwise.Locked down (require auth)
01 - AI Listing Generator02 - AI Visual Studio03 - AI Ads Studio04a - Etsy Connect (start OAuth)05 - Etsy Listing Publish07 - POD Route OrderPublic exemptions
04 - Etsy OAuth Callback— Etsy is the caller; can't send custom headers. State + PKCE provide CSRF protection.02b - Mockup View— used by<img src="…">; browsers can't send custom headers on image requests.Internal call updates
wf 06 - Etsy Order Sync→wf 07("Dispatch POD") now sendsX-Webhook-Secret.wf 03 - Ads Studio→wf 02(visual gen, optional) now sendsX-Webhook-Secret.Workflow 04a behavior change
Switched from rendering an HTML "Authorise on Etsy" page to returning JSON
{ auth_url, state, shop_name }. Without this, the ToolJet Shops tab button could no longer reach 04a (browsers can't send custom headers onwindow.open). The flow is now: button → REST query (with the auth header) →onSuccessopens the returnedauth_urlin a new tab.ToolJet
N8N_WEBHOOK_SECRET(operator sets to match n8n's env var).n8n_apidatasource sendsX-Webhook-Secreton every call.Setup (one-time, after merge)
openssl rand -hex 32→ setN8N_WEBHOOK_SECRETin.env;docker compose restart n8n.n8n Webhook Secret, headerX-Webhook-Secret, value = the secret.Test plan
curl http://localhost:5678/webhook/listing-generate -d '{}' -H 'content-type: application/json'returns 401-H "x-webhook-secret: $N8N_WEBHOOK_SECRET"succeedsauth_url/webhook/etsy-oauth-callbackwith no auth header (public exemption) and the shop upserts<img src="http://localhost:5678/webhook/mockup-view?id=1">still renders (public exemption)https://claude.ai/code/session_019vtZjGwcACasFeauRYTQnj
Generated by Claude Code