You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Securely expose databases to external clients with strict authentication, rate limiting, and query transformation to prevent runaway costs and data leaks."
A database gateway provides secure access to databases exposed to external clients. It enforces authentication, rate limiting, and logging before requests reach your database, while optionally transforming queries to prevent costly operations or data exposure.
15
13
16
14
With this setup, you can:
17
15
18
-
- Enforce strict authentication (API keys, mTLS) before any database access
16
+
- Enforce strict mTLS certificate authentication before any database access
19
17
- Rate limit requests per client to prevent abuse and runaway costs
20
-
- Log all database access attempts with client attribution for compliance and debugging
21
-
- Transform or block dangerous queries to protect sensitive data
18
+
- Block dangerous queries to protect sensitive data
22
19
- Support secure database replication across clouds without exposing credentials
23
20
24
21
## 1. Create an endpoint for your database service
@@ -44,106 +41,27 @@ For databases that don't natively support HTTP, consider using a database proxy
44
41
45
42
## 4. (Optional) Create a vault and secrets
46
43
47
-
For production environments, store your authentication secrets securely using [Traffic Policy Secrets](/docs/traffic-policy/secrets). This step is optional—you can also use plaintext credentials directly in your policy.
44
+
For production environments, store your CA certificate securely using [Traffic Policy Secrets](/docs/traffic-policy/secrets). This step is optional—you can also include the certificate directly in your policy.
48
45
49
-
Create a vault to store your authentication secrets:
"message": "DROP, DELETE, and TRUNCATE operations are not allowed through this gateway",
133
-
"timestamp": "${timestamp(time.now)}"
134
-
}
135
-
136
-
# Forward to database service
137
-
- actions:
138
-
- type: forward-internal
139
-
config:
140
-
url: https://database-service.internal
141
-
```
142
-
143
-
**What's happening here?** This policy uses API key authentication in username:password format with client-specific rate limiting tiers. Premium clients get higher request limits, dangerous SQL operations are blocked, and authenticated requests are forwarded to your database service.
# Use client certificates (after generating them with the commands above)
242
-
curl --cert client.crt --key client.key \
243
-
"https://$NGROK_DOMAIN/api/users?limit=10"
244
-
```
245
-
246
147
## What's next?
247
148
248
-
- Learn more about [basic authentication](/docs/traffic-policy/actions/basic-auth) including credential management and security best practices
249
-
-Explore [mTLS certificate authentication](/docs/traffic-policy/actions/terminate-tls) for high-security environments
149
+
- Learn more about [mTLS certificate authentication](/docs/traffic-policy/actions/terminate-tls) for high-security environments
150
+
-For token-based authentication, explore [JWT validation](/docs/traffic-policy/actions/jwt-validation) as a scalable alternative to basic authentication
250
151
- Set up [comprehensive logging](/docs/traffic-policy/actions/log) to send database access events to your SIEM or monitoring platform
251
152
- Use [URL rewriting](/docs/traffic-policy/actions/url-rewrite) to transform database queries or add security constraints
252
153
- View database access patterns in [Traffic Inspector](https://dashboard.ngrok.com/traffic-inspector) to identify potential security issues
Copy file name to clipboardExpand all lines: docs/universal-gateway/examples/webhook-gateway.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
-
title: "Webhook gateway"
2
+
title: "Webhook Gateway"
3
3
description: "Centralize webhook validation and routing from third-party providers like Stripe, Twilio, and Slack to secure your integrations and eliminate repetitive implementation."
@@ -11,7 +11,7 @@ import Back from "./snippets/_back-to-examples.mdx";
11
11
importTabItemfrom"@theme/TabItem";
12
12
importTabsfrom"@theme/Tabs";
13
13
14
-
Instead of implementing webhook validation and routing logic separately in every service, a webhook gateway provides a single, secure entry point for all third-party webhooks from providers like Stripe, Twilio, Slack, and GitHub. This centralized approach validates webhook signatures, prevents tampering, and routes authenticated requests to the appropriate internal services.
14
+
Instead of implementing webhook validation and routing logic separately in every service, a webhook gateway provides a single, secure entry point for all third-party webhooks from providers like Stripe, Twilio, Slack, and GitHub. This centralized approach validates webhook signatures, prevents tampering, and routes authenticated requests to the appropriate internal services in production environments.
0 commit comments