recaptcha-v3-verifier

by f3k-tech

Helm chartv1.110.0App 1.1.0Verified publisher

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

ResourceLink
Container (source)f3k-tech/recaptcha-v3-verifier
Container IssuesOpen issues
Helm Repository (index)https://f3k-tech.github.io/helm
Helm Chart (source)charts/recaptcha-v3-verifier
Helm IssuesOpen 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 (default docker.io).
  • image.repository: Image repository (default f3ktech/recaptcha-v3-verifier).
  • image.tag: Image tag (defaults to chart appVersion when empty).
  • image.digest: Optional sha256 digest (without prefix); when set, digest is used instead of tag.
  • service.type: Service type (default ClusterIP).
  • service.port: Container port (default 3000).
  • ingress.enabled: Should remain false for 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)

VariableDescriptionDefaultRequired
RECAPTCHA_SECRET_KEYGoogle reCAPTCHA secret key-Yes
ALLOWED_ORIGINSComma-separated CORS originshttp://localhost:3000,https://example.comNo
ALLOW_SCOREScore to automatically allow (0.0-1.0)0.6No
CHALLENGE_SCOREScore to challenge (0.0-1.0). Requests below this are denied.0.3No

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_KEY and its per-account variants as environment variables using valueFrom.secretKeyRef (see chart values).
  • If ALLOW_SCORE_<account> or CHALLENGE_SCORE_<account> are not provided, the defaults (ALLOW_SCORE, CHALLENGE_SCORE) are used for that account.

Decision Logic

  • allow when score >= ALLOW_SCORE
  • challenge when CHALLENGE_SCORE <= score < ALLOW_SCORE
  • deny when score < CHALLENGE_SCORE

Security & Exposure

  • Do not expose this service publicly. Keep ingress.enabled: false and the Service as ClusterIP.
  • Call this service only from trusted backend services within the cluster or via an internal network path.
  • Ensure ALLOWED_ORIGINS is 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.digest to 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.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartrecaptcha-v3-verifier is pinned at v1.110.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. 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