Skip to content

stages/captcha: add Cap and JSON verification support - #22373

Merged
dominic-r merged 11 commits into
mainfrom
sdko/captcha-json-providers
Jun 11, 2026
Merged

dominic-r merged 11 commits into
mainfrom
sdko/captcha-json-providers

Conversation

@dominic-r

@dominic-r dominic-r commented May 15, 2026 •

Copy link
Copy Markdown
Member

Add a configurable verification request content type so CAPTCHA providers can use either form-encoded or JSON token verification.

Add Cap as a preset and flow controller, including module-script loading, interactive widget handling, generated API/client types, tests, and docs.

image

Closes #22314

Add a configurable verification request content type so CAPTCHA providers can use either form-encoded or JSON token verification.

Add Cap as a preset and flow controller, including module-script loading, interactive widget handling, generated API/client types, tests, and docs.
@dominic-r dominic-r self-assigned this May 15, 2026
@dominic-r dominic-r added area:frontend Features or issues related to the browser, TypeScript, Node.js, etc area:backend labels May 15, 2026
@dominic-r
dominic-r requested review from a team as code owners May 15, 2026 01:00
@dominic-r
dominic-r requested a review from a team as a code owner May 15, 2026 01:00
@netlify

netlify Bot commented May 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit c7c6ff1
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6a2acf368f8f5c0008c4e35d
😎 Deploy Preview https://deploy-preview-22373--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented May 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit c7c6ff1
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a2acf365d6d9800087305b9
😎 Deploy Preview https://deploy-preview-22373--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented May 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit c7c6ff1
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a2acf3606f1bf000813d9f7
😎 Deploy Preview https://deploy-preview-22373--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented May 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.27%. Comparing base (b12416a) to head (c7c6ff1).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #22373      +/-   ##
==========================================
+ Coverage   93.26%   93.27%   +0.01%     
==========================================
  Files        1032     1032              
  Lines       60164    60186      +22     
  Branches      400      400              
==========================================
+ Hits        56109    56139      +30     
+ Misses       4055     4047       -8     
Flag Coverage Δ
conformance 36.53% <20.83%> (-0.01%) ⬇️
e2e 41.78% <20.83%> (-0.01%) ⬇️
integration 32.97% <20.83%> (-0.01%) ⬇️
rust 0.00% <ø> (ø)
unit 92.20% <100.00%> (+<0.01%) ⬆️
unit-migrate 92.24% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@dominic-r
dominic-r requested a review from GirlBossRush May 15, 2026 15:17

@kensternberg-authentik kensternberg-authentik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made comments for improvment; nothing here looks broken, but the documentation could be better and the semantic overload of publicKey where you (sometimes) put a URL is one of those things that can make looking at the raw database or at a blueprint confusing. There is one place where the user could type in a bad URL and I don't see that handled. That shouldn't stop deployment, but it should be addressed.

Comment thread web/src/admin/stages/captcha/shared.ts Resolved
Comment thread web/src/admin/stages/captcha/shared.ts Resolved
@dominic-r
dominic-r removed the request for review from GirlBossRush May 29, 2026 11:28
Treat the Cap endpoint as a form-only alias for the existing public key field and document Cap alongside the other CAPTCHA providers.

Agent-thread: https://sdko.org/internal/threads/019e737a-314e-72d0-98ae-201cb855df3a

A7k-product: product

A7k-product-repo: 2

Co-authored-by: Agent <[email protected]>
- **Public key**: public Cap endpoint for the site key path, for example `https://cap.example.com/site-key/`
- **Private key**: Cap secret key
- **Interactive**: enabled
- **JS URL**: `https://cdn.jsdelivr.net/npm/cap-widget`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add the recommendation to use a versioned JS URL, or a self-hosted version that cap's server exposes, so that people are aware about potential supply chain attacks that could result from always using the latest version of npm packages (since this has been common over the last few months).

@dominic-r dominic-r Jun 3, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! Mentioned by Ken, but i've been thinking about a good way. #22373 (comment) Any ideas on a way to keep the versioned widget URL up to date without having to manually update it each time in the docs/code?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be a good idea to either:

  • Use a placeholder url like https://cdn.jsdelivr.net/npm/cap-widget@version and provide a link to find the latest on GitHub
  • Use a self hosted link instead https://captcha.example/assets/widget.js

We could also just link to the GitHub released for cap. This way we can avoid updating the docs to point to the newest widget URL in the case that it was the target of a supply chain attack.

https://github.com/tiagozip/cap/releases

The alternative would be to create a release script that updates the tag to the latest capjs version, but that still risks linking a version that has been compromised. A local version probably is the safest, since you have to host the API locally anyway to use cap.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmyea I'll do that. Thanks for bringing it up again

@github-actions

github-actions Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-c7c6ff18f8ef1fd674037aa54a0d1bf68c257ba9
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-c7c6ff18f8ef1fd674037aa54a0d1bf68c257ba9

Afterwards, run the upgrade commands from the latest release notes.

Default the Cap provider guidance to the self-hosted widget asset and keep CDN usage pinned to reviewed releases.

Agent-thread: https://sdko.org/internal/thr/ak/019ead31-2435-7e12-b933-e873155d6894

A7k-product: product

A7k-product-repo: 2

Co-authored-by: Agent <[email protected]>

@grivera64 grivera64 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀 I think we could also include a comment in the docs about only supporting the default widget and not the floating version of the widget (https://trycap.dev/guide/floating.html).

To keep consistent with other captcha providers, I think we can skip supporting the floating widget.

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in authentik Core Jun 10, 2026
@dominic-r
dominic-r enabled auto-merge (squash) June 11, 2026 15:07
@dominic-r
dominic-r merged commit fc8424a into main Jun 11, 2026
162 of 165 checks passed
@dominic-r
dominic-r deleted the sdko/captcha-json-providers branch June 11, 2026 16:15
@github-project-automation github-project-automation Bot moved this from In Progress to Done in authentik Core Jun 11, 2026
kensternberg-authentik added a commit that referenced this pull request Jun 12, 2026
* main: (68 commits)
  root: bump pyo3 (#23036)
  websites/integrations: specify redirect uri of type authorization or post logout (#22981)
  website/integrations: Update nextcloud to support post logout redirect uri (#22989)
  stages/captcha: add Cap and JSON verification support (#22373)
  web: bump @goauthentik/tsconfig from 1.0.9 to 2.0.0 in /web/packages/core in the goauthentik group across 1 directory (#22996)
  website/integrations: add kavita (#23000)
  website/integrations: add post logout to audiobookshelf (#22999)
  website/docs: additional scim provider docs (#22135)
  translate: Updates for project authentik and language fr_FR (#22986)
  translate: Updates for project authentik and language hu_HU (#22987)
  translate: Updates for project authentik and language no_NO (#22988)
  lifecycle/aws: bump aws-cdk from 2.1125.0 to 2.1126.0 in /lifecycle/aws (#22990)
  core: bump astral-sh/uv from 0.11.19 to 0.11.20 in /lifecycle/container (#22991)
  core: bump goauthentik/fips-python from `ede0a00` to `94d8805` in /lifecycle/container (#22992)
  core: bump uvicorn[standard] from 0.48.0 to 0.49.0 (#22993)
  core: bump which from 8.0.2 to 8.0.3 (#22994)
  ci: bump taiki-e/install-action from 2.81.7 to 2.81.8 in /.github/actions/setup (#22995)
  web/elements: extract mermaid runtime, modernize `<ak-diagram>` (#22980)
  core, web: update translations (#22983)
  website/integrations: dokuwiki: add post logout and logout urls (#22984)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend area:frontend Features or issues related to the browser, TypeScript, Node.js, etc

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Feaure Request: Add tiagozip/cap and other JSON-based CAPTCHA support

4 participants