Repository navigation
stages/captcha: add Cap and JSON verification support - #22373
Conversation
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.
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
kensternberg-authentik
left a comment
There was a problem hiding this comment.
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.
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` |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
I think it would be a good idea to either:
- Use a placeholder url like
https://cdn.jsdelivr.net/npm/cap-widget@versionand 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.
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.
There was a problem hiding this comment.
hmmyea I'll do that. Thanks for bringing it up again
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your 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)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your 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-c7c6ff18f8ef1fd674037aa54a0d1bf68c257ba9Afterwards, 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
left a comment
There was a problem hiding this comment.
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.
* 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) ...
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.
Closes #22314