recaptcha-v3-verifier
by f3k-tech
A Helm chart for Kubernetes to deploy a reCAPTCHA v3 verification service
About this chart
reCAPTCHA v3 Verifier β Helm Chart
This Helm chart deploys a lightweight service that securely validates Google reCAPTCHA v3 tokens server-side and returns an allow/challenge/deny decision based on configurable score thresholds.
Important: Do not expose this service publicly (e.g., via Ingress). It should only be reachable from your backend and never directly from the internet or frontend clients.
Features
- π Secure reCAPTCHA v3 token verification
- βΈοΈ Kubernetes Helm chart (ClusterIP by default)
- π‘οΈ Hardened container image (distroless base, minimal attack surface)
- π₯ Health and readiness probes
- π Horizontal Pod Autoscaling
- π Non-root container execution
- π Production-ready with security best practices
Project Links
| Resource | Link |
|---|---|
| Container (source) | f3k-tech/recaptcha-v3-verifier |
| Container Issues | Open issues |
| Helm Repository (index) | https://f3k-tech.github.io/helm |
| Helm Chart (source) | charts/recaptcha-v3-verifier |
| Helm Issues | Open issues |
API Endpoints
POST /verify
Verify a reCAPTCHA v3 token and return a decision.
Request:
{
"token": "recaptcha_token_here",
"action": "optional_action_name",
"accountId": "optional_account_id"
}
Response (examples):
Allow
{
"success": true,
"accountId": "default",
"decision": "allow",
"allow": true,
"challenge": false,
"deny": false,
"score": 0.9,
"action": "submit",
"thresholds": { "allow": 0.6, "challenge": 0.3 },
"challenge_ts": "2025-12-12T10:00:00Z",
"hostname": "yourdomain.com"
}
Challenge
{
"success": true,
"accountId": "default",
"decision": "challenge",
"allow": false,
"challenge": true,
"deny": false,
"score": 0.42,
"action": "submit",
"thresholds": { "allow": 0.6, "challenge": 0.3 },
"challenge_ts": "2025-12-12T10:00:00Z",
"hostname": "yourdomain.com"
}
Deny
{
"success": true,
"accountId": "default",
"decision": "deny",
"allow": false,
"challenge": false,
"deny": true,
"score": 0.12,
"action": "submit",
"thresholds": { "allow": 0.6, "challenge": 0.3 },
"challenge_ts": "2025-12-12T10:00:00Z",
"hostname": "yourdomain.com"
}
GET /health
Health check endpoint for liveness probe.
GET /ready
Readiness check endpoint.
Test From Cluster
Because this service is internal-only, test it from inside the cluster using a curl pod:
NAMESPACE=recaptcha
RELEASE=recaptcha
SERVICE="${RELEASE}-recaptcha-v3-verifier" # chart fullname
kubectl run -it --rm curl -n "$NAMESPACE" --image=curlimages/curl:8.10.1 --restart=Never -- \
sh -c "curl -s -X POST http://${SERVICE}.${NAMESPACE}.svc.cluster.local:3000/verify \
-H 'Content-Type: application/json' -d '{\"token\":\"test_token\"}' | sed -e 's/{/\n{/g'"
Install
Add the Helm repo and install the chart. Replace the secret value with your reCAPTCHA v3 secret key.
helm repo add f3k https://f3k-tech.github.io/helm
helm repo update
# install (recommended: set secret via values override file or --set)
helm upgrade --install recaptcha f3k/recaptcha-v3-verifier \
--namespace recaptcha --create-namespace \
--set secrets.app.RECAPTCHA_SECRET_KEY="<your-recaptcha-secret-key>"
Upgrade with a values file:
cat > values.override.yaml <<'YAML'
secrets:
app:
RECAPTCHA_SECRET_KEY: "<your-recaptcha-secret-key>"
# Optional: additional environment variables
env:
- name: ALLOWED_ORIGINS
value: "https://example.com,https://app.example.com"
- name: ALLOW_SCORE
value: "0.6"
- name: CHALLENGE_SCORE
value: "0.3"
YAML
helm upgrade --install recaptcha f3k/recaptcha-v3-verifier \
-n recaptcha -f values.override.yaml
Configuration
Values
image.registry: Container registry host (defaultdocker.io).image.repository: Image repository (defaultf3ktech/recaptcha-v3-verifier).image.tag: Image tag (defaults to chartappVersionwhen empty).image.digest: Optional sha256 digest (without prefix); when set, digest is used instead of tag.service.type: Service type (defaultClusterIP).service.port: Container port (default3000).ingress.enabled: Should remainfalsefor security; do not expose publicly.env: List of additional environment variables.secrets.app.RECAPTCHA_SECRET_KEY: Required reCAPTCHA secret; creates a Kubernetes Secret and is injected into the pod.
Environment Variables (runtime)
| Variable | Description | Default | Required |
|---|---|---|---|
RECAPTCHA_SECRET_KEY | Google reCAPTCHA secret key | - | Yes |
ALLOWED_ORIGINS | Comma-separated CORS origins | http://localhost:3000,https://example.com | No |
ALLOW_SCORE | Score to automatically allow (0.0-1.0) | 0.6 | No |
CHALLENGE_SCORE | Score to challenge (0.0-1.0). Requests below this are denied. | 0.3 | No |
Optional: Multi-Account Configuration
You can define additional verifier accounts by suffixing the account ID to the environment variables. Requests can target an account by sending a body that includes an accountId to the /verify endpoint. If no accountId is provided, the service uses the default account.
Example base configuration:
ALLOWED_ORIGINS=http://localhost:3000,https://yourdomain.com
RECAPTCHA_SECRET_KEY=your_recaptcha_secret_key_here
ALLOW_SCORE=0.6
CHALLENGE_SCORE=0.3
Example additional account "account1":
RECAPTCHA_SECRET_KEY_account1=your_recaptcha_secret_for_account1
ALLOW_SCORE_account1=0.7 # optional, falls back to ALLOW_SCORE
CHALLENGE_SCORE_account1=0.4 # optional, falls back to CHALLENGE_SCORE
Example additional account "account2":
RECAPTCHA_SECRET_KEY_account2=your_recaptcha_secret_for_account2
ALLOW_SCORE_account2=0.5
CHALLENGE_SCORE_account2=0.2
Targeting an account:
{
"token": "recaptcha_token_here",
"accountId": "account1"
}
Notes:
- Only set secrets via Kubernetes Secrets in production. You can inject
RECAPTCHA_SECRET_KEYand its per-account variants as environment variables usingvalueFrom.secretKeyRef(see chart values). - If
ALLOW_SCORE_<account>orCHALLENGE_SCORE_<account>are not provided, the defaults (ALLOW_SCORE,CHALLENGE_SCORE) are used for that account.
Decision Logic
allowwhenscore >= ALLOW_SCOREchallengewhenCHALLENGE_SCORE <= score < ALLOW_SCOREdenywhenscore < CHALLENGE_SCORE
Security & Exposure
- Do not expose this service publicly. Keep
ingress.enabled: falseand theServiceasClusterIP. - Call this service only from trusted backend services within the cluster or via an internal network path.
- Ensure
ALLOWED_ORIGINSis set to only the domains that will access your backend.
Security Features
- β Non-root user execution
- β Read-only root filesystem
- β Dropped capabilities
- β Security headers via Helmet.js
- β CORS protection
- β Secret management via Kubernetes Helm Chart and Secrets
- β Resource limits and requests
Monitoring
Metrics
The service logs verification events with:
- Timestamp
- Score
- Action
- Decision (allow/challenge/deny)
- Hostname
Troubleshooting
Image pull errors
- Ensure the image tag exists for your cluster architecture (e.g.,
amd64/arm64). - Optionally set
image.digestto pin an immutable digest for your platform.
CORS errors
Update ALLOWED_ORIGINS via values (see examples) to include your frontend domain(s).
License
MIT
Deploy recaptcha-v3-verifier with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has recaptcha-v3-verifier on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartrecaptcha-v3-verifier is pinned at v1.110.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply