Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export default defineConfig({
{ text: 'πŸ“¦ NPM Package (v0.1.4)', link: 'https://www.npmjs.com/package/n8n-nodes-devdeskapp' },
{ text: '🌟 n8n Template #21017', link: 'https://n8n.io/workflows/21017-format-json-and-secure-hr-payloads-with-devdeskapp-utilities' },
{ text: 'πŸ’° n8n Template #21130', link: 'https://n8n.io/workflows/21130-automate-salary-and-in-hand-ctc-calculations-with-devdeskapp' },
{ text: 'πŸ›‘οΈ n8n Template #21376', link: 'https://n8n.io/workflows/21376' },
{ text: 'πŸ™ Node GitHub Repo', link: 'https://github.com/DevdeskApp/n8n-nodes-devdeskapp' },
{ text: '🌐 DevDeskApp Web App', link: 'https://www.devdeskapp.com' }
]
Expand Down Expand Up @@ -123,7 +124,8 @@ export default defineConfig({
text: 'Official Blueprints',
items: [
{ text: '🌟 Developer Suite (#21017)', link: '/templates/developer-suite' },
{ text: 'πŸ’° CTC Salary Engine (#21130)', link: '/templates/ctc-salary-engine' }
{ text: 'πŸ’° CTC Salary Engine (#21130)', link: '/templates/ctc-salary-engine' },
{ text: 'πŸ›‘οΈ Payment Webhook Sanitizer (#21376)', link: '/templates/payment-webhook-sanitizer' }
]
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions src/templates/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,37 @@ Explore our published templates below. Each template has a dedicated documentati
</a>
</div>
</div>
<!-- Template 3 Card -->
<div style="border: 1px solid var(--vp-c-border); border-radius: 16px; padding: 1.5rem; background: var(--vp-c-bg-soft); display: flex; flex-direction: column; justify-content: space-between; transition: transform 0.2s ease, border-color 0.2s ease;" class="pipeline-step">
<div>
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem;">
<span style="font-size: 0.75rem; font-weight: 700; color: #f59e0b; background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.3); padding: 2px 8px; border-radius: 9999px;">
TEMPLATE #21376
</span>
<span class="badge-live" style="font-size: 0.7rem;">Live on n8n.io</span>
</div>
<h3 style="margin: 0 0 0.5rem 0; font-size: 1.15rem; font-weight: 700; color: var(--vp-c-text-1);">
Payment Webhook Sanitizer & Security Audit
</h3>
<p style="font-size: 0.88rem; color: var(--vp-c-text-2); line-height: 1.5; margin: 0 0 1rem 0;">
Zero-trust gateway for payment webhooks (Stripe, Razorpay, Lemon Squeezy): JSON normalization, SHA-256 cryptographic audit digest, RFC UUID v4 incident trace, and Slack notifications.
</p>
<div style="display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1.25rem;">
<span style="font-size: 0.72rem; padding: 2px 6px; border-radius: 6px; background: var(--vp-c-bg-mute); color: var(--vp-c-text-2);">Webhook Sanitizer</span>
<span style="font-size: 0.72rem; padding: 2px 6px; border-radius: 6px; background: var(--vp-c-bg-mute); color: var(--vp-c-text-2);">SHA-256 Digest</span>
<span style="font-size: 0.72rem; padding: 2px 6px; border-radius: 6px; background: var(--vp-c-bg-mute); color: var(--vp-c-text-2);">UUID v4 Audit</span>
<span style="font-size: 0.72rem; padding: 2px 6px; border-radius: 6px; background: var(--vp-c-bg-mute); color: var(--vp-c-text-2);">Payment Security</span>
</div>
</div>
<div style="display: flex; gap: 8px; flex-wrap: wrap; padding-top: 1rem; border-top: 1px solid var(--vp-c-border);">
<a href="/templates/payment-webhook-sanitizer" style="flex: 1; text-align: center; padding: 8px 12px; border-radius: 8px; background: #f59e0b; color: white !important; font-size: 0.82rem; font-weight: 700; text-decoration: none;">
View Blueprint β†’
</a>
<a href="https://n8n.io/workflows/21376" target="_blank" rel="noopener" style="padding: 8px 12px; border-radius: 8px; border: 1px solid var(--vp-c-border); background: var(--vp-c-bg); color: var(--vp-c-text-1) !important; font-size: 0.82rem; font-weight: 600; text-decoration: none;">
n8n Portal β†—
</a>
</div>
</div>

</div>

Expand Down
147 changes: 147 additions & 0 deletions src/templates/payment-webhook-sanitizer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
title: "Template #21376: Payment Webhook Sanitizer & Security Audit | DevDeskApp"
description: Complete blueprint and operational guide for official n8n template #21376. Sanitize payment webhooks, calculate cryptographic SHA-256 digests, generate UUID trace tokens, and audit Stripe/Razorpay transactions in <0.2ms.
---

# πŸ›‘οΈ Template #21376: Payment Webhook Sanitizer & Security Audit Pipeline

<div style="margin: 1rem 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center;">
<span class="badge-live">Published on n8n.io Creator Portal</span>
<span class="badge-live" style="background: rgba(245, 158, 11, 0.12); color: #f59e0b; border-color: rgba(245, 158, 11, 0.3);">Template ID: 21376</span>
</div>

πŸ”— **Direct n8n Template Link:**
[n8n.io/workflows/21376](https://n8n.io/workflows/21376)

---

## 🎯 Overview & Use Cases

In modern production payment gateways (**Stripe**, **Razorpay**, **Lemon Squeezy**, **Shopify**, **PayPal**), incoming webhook events carry mission-critical financial data. However, engineering teams face significant architectural challenges:

1. **Unformatted & Minified Payloads:** Gateways often stream compact, escaped, or minified JSON strings that risk malformed parsing errors and crash downstream database ingest pipelines.
2. **Replay & Tampering Vulnerabilities:** Financial and order transactions require deterministic cryptographic **SHA-256 integrity digests** to guarantee non-repudiation and verify payload authenticity.
3. **Traceability Gaps Across Systems:** Without unified identifiers, debugging failed payment events across PostgreSQL, Slack alerts, and application logs is slow and fragmented.

**Template #21376** acts as an in-memory security and audit gateway. It intercepts incoming webhook payloads, validates and formats JSON, generates cryptographic checksums and UUID v4 correlation tokens, normalizes order slugs, and routes verified audit records to Slack and downstream databasesβ€”running **100% in local memory with zero external cloud API latency**.

---

## πŸ“Έ Workflow Architecture

<div class="doc-image">
<img src="/images/screen_webhook_sanitizer_canvas.png" alt="Payment Webhook Sanitizer Canvas" />
</div>
<div class="doc-caption">Figure 1: Complete security audit and webhook sanitization canvas in n8n.</div>

### 🧩 Interactive Architecture & Multi-Stage Execution Flow

```mermaid
flowchart TD
subgraph Ingestion ["πŸ“₯ Stage 1: Ingestion Gateway"]
T1["⚑ 1-Click Manual Trigger (Testing)"]
T2["🌐 Production Webhook Trigger (Stripe / Razorpay)"]
Payload["πŸ“¦ Inbound Webhook Payload (Headers + Raw Body)"]
T1 --> Payload
T2 --> Payload
end

subgraph CoreEngine ["πŸ›‘οΈ Stage 2: DevDeskApp In-Memory Processing Engine (<0.2ms)"]
direction TB
N1["1️⃣ JSON Prettifier & Schema Validator
Unescapes raw JSON strings and formats cleanly"]
N2["2️⃣ SHA-256 Non-Repudiation Hasher
Computes timing-safe cryptographic payload checksum"]
N3["3️⃣ RFC UUID v4 Incident Generator
Injects distributed trace correlation token"]
N4["4️⃣ Audit Reference Slugifier
Creates URL-safe audit identifier (order + customer)"]
N1 --> N2 --> N3 --> N4
end

subgraph Decision ["βš–οΈ Stage 3: Security Validation & Condition Check"]
Check{"Payment Status == SUCCESS
& Payload Valid?"}
end

subgraph VerifiedPath ["βœ… Stage 4A: Authenticated Dispatch Pipeline"]
SuccessAudit["πŸ“„ Format Security Audit Record
Normalized JSON for PostgreSQL / Supabase Log"]
SlackSuccess["πŸ’¬ DevOps Slack Alert
#devops-security-alerts (Verified Transaction)"]
SuccessAudit --> SlackSuccess
end

subgraph IncidentPath ["🚨 Stage 4B: Security Incident & Tamper Pipeline"]
IncidentAudit["⚠️ Format Security Incident Record
Flags failed payment, tampered payload, or schema error"]
SlackIncident["🚨 Tamper Slack Alert
#security-tamper-alerts (Action Required)"]
IncidentAudit --> SlackIncident
end

Payload --> N1
N4 --> Check
Check -- "Verified (SUCCESS)" --> SuccessAudit
Check -- "Rejected / Tampered" --> IncidentAudit
```

### πŸ” Execution Walkthrough (Step-by-Step):
- **Stage 1 (Dual Ingest):** Supports instant 1-click test runs via manual trigger or live production webhooks from payment gateways with zero configuration changes.
- **Stage 2 (Local In-Memory Security):** In sub-millisecond local Node.js cycles, DevDeskApp prettifies the payload, computes a SHA-256 cryptographic digest, assigns an RFC 4122 UUID v4 trace ID, and generates a unified audit slug.
- **Stage 3 (Zero-Trust Condition):** The `If` node evaluates payment capture status and integrity verification.
- **Stage 4 (Multi-Channel Routing):**
- **Success Route:** Emits a compliant audit record and notifies `#devops-security-alerts`.
- **Incident Route:** Catches tampered or failed transactions and triggers an immediate escalation to `#security-tamper-alerts`.

---

## βš™οΈ Core Operations in Pipeline

| Node / Step | Tool / Operation | Purpose |
| :--- | :--- | :--- |
| **1. Webhook Ingest** | `manualTrigger` / `webhook` | Ingests live payment event headers and raw JSON body |
| **2. JSON Prettifier** | `devDeskApp` β†’ `prettify` | Normalizes and validates raw/minified payload into structured JSON |
| **3. Integrity Hasher** | `devDeskApp` β†’ `hash` (SHA-256) | Computes timing-safe SHA-256 cryptographic digest of payload |
| **4. Trace Token** | `devDeskApp` β†’ `uuid` (v4) | Injects RFC 4122 UUID v4 incident identifier for distributed audit tracing |
| **5. Audit Slugifier** | `devDeskApp` β†’ `slugify` | Generates clean URL-safe tracking slug from customer name and order ID |
| **6. Security Dispatch** | `code` + `slack` | Emits structured compliance payload and triggers real-time security alerts |

---

## ⚑ Consolidated Audit Output Sample

When executed, the workflow produces a structured, tamper-proof security record:

```json
{
"auditRecord": {
"traceId": "c47a2846-95e2-4bd1-bc91-236b3f7f02ea",
"eventChecksum": "a79c4a8b753f19e782e4e135d0e729a4a753697e8838ec6f4bf4b74e64903e1a",
"auditSlug": "priya-patel-ord-89421",
"gatewayEvent": "payment.captured",
"paymentId": "pay_N982kls823a",
"orderId": "ORD-89421",
"customer": {
"name": "Priya Patel",
"email": "priya.patel@example.com",
"tier": "enterprise"
},
"amountFormatted": "β‚Ή4,999.00",
"currency": "INR",
"paymentMethod": "UPI",
"status": "VERIFIED_SUCCESS",
"processedAt": "2026-10-23T19:40:00.000Z"
}
}
```

---

## πŸ“₯ How to Import into Your n8n Instance

1. Open the [official template page on n8n.io](https://n8n.io/workflows/21376).
2. Click **"Use workflow"** or copy the workflow JSON payload.
3. In your n8n workspace, navigate to **Workflows β†’ New Workflow**.
4. Press **`Ctrl + V`** (or **`Cmd + V`** on Mac).
5. Configure the **Production Webhook Trigger** URL in your payment gateway dashboard (Stripe / Razorpay webhooks) and connect your Slack alerts channel!
Loading