Skip to content

web: Improvements to ReCaptcha resizing #16171

Merged
GirlBossRush merged 3 commits intomainfrom
recaptcha-patch
Aug 18, 2025
Merged

web: Improvements to ReCaptcha resizing #16171
GirlBossRush merged 3 commits intomainfrom
recaptcha-patch

Conversation

@GirlBossRush
Copy link
Contributor

Details

This PR focuses on a few visual issues that arise in the Captcha stage when using ReCaptcha.
As reported in #15598, Recaptcha v2 and v3 do not resize in response to their parent iframe's change in height. Additionally, ReCaptcha's (latest?) logic for handling domain verification isn't compatible with our switch to blob URLs as a source for frames.

The current fix for this limited due to the nature of this three-layer deep iframe structure.
We have a few options for fixing this:

  1. Move the captcha out of the iframe, sacrificing the encapsulation of vendor scripts
  2. Apply an estimated height to reCaptcha's iframe and trigger a resize event
  3. Use a different captcha provider such as Turnstile or hCaptcha

This PR uses option 2, expanding our existing resize logic to traverse the DOM tree and resize all relevant elements. This is a bit of a hack, and it's limited to expanding the captcha's iframe, but it has the least impact on the other captcha vendors.

Also included is a fix captcha iframes not inheriting the color scheme of the parent page, ensuring fewer slivers of white around the captcha.

Screenshot 2025-08-13 at 19 57 09 Screenshot 2025-08-13 at 19 58 47

What's not included

  • The ability to configure recaptcha's size parameter
  • Shrinking reCaptcha's iframe after the challenge is completed

Closes #15598

@GirlBossRush GirlBossRush requested a review from a team as a code owner August 13, 2025 19:05
@netlify
Copy link

netlify bot commented Aug 13, 2025

Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 720907d
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/68a3241c8ae4f20008325fb5
😎 Deploy Preview https://deploy-preview-16171--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.

@netlify
Copy link

netlify bot commented Aug 13, 2025

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 720907d
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/68a3241c8ae4f20008325fb3
😎 Deploy Preview https://deploy-preview-16171--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
Copy link

netlify bot commented Aug 13, 2025

Deploy Preview for authentik-integrations canceled.

Name Link
🔨 Latest commit 720907d
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/68a3241c1bc9460008e700a2

@codecov
Copy link

codecov bot commented Aug 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.78%. Comparing base (4ce9795) to head (720907d).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16171   +/-   ##
=======================================
  Coverage   92.77%   92.78%           
=======================================
  Files         836      836           
  Lines       45213    45213           
=======================================
+ Hits        41946    41949    +3     
+ Misses       3267     3264    -3     
Flag Coverage Δ
e2e 46.57% <ø> (+<0.01%) ⬆️
integration 23.57% <ø> (+<0.01%) ⬆️
unit 90.92% <ø> (+<0.01%) ⬆️

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

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

Copy link
Contributor

@kensternberg-authentik kensternberg-authentik left a comment

Choose a reason for hiding this comment

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

So much fiddling.

@GirlBossRush GirlBossRush enabled auto-merge (squash) August 18, 2025 13:01
@GirlBossRush GirlBossRush merged commit a63c5b1 into main Aug 18, 2025
107 checks passed
@GirlBossRush GirlBossRush deleted the recaptcha-patch branch August 18, 2025 13:24
@github-actions
Copy link
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-720907d346f08e6497f720c24d65636e8c9e7437
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-720907d346f08e6497f720c24d65636e8c9e7437

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

GirlBossRush added a commit that referenced this pull request Aug 20, 2025
* web: Remove comments from serialized HTML.

* web: Apply color theme to iframe.

* web: Fix issues surrounding reCaptcha resize events not propagating.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug/confirmed Confirmed bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding a Google Recaptcha v3 stage during login causing the recaptcha verification popup to shrink

3 participants