Malformed challenge markup

Created on 14 March 2025, 22 days ago

Problem/Motivation

Malformed markup emerging from turnstile_protect_captcha_alter causes the text < referrerpolicy="no-referrer"> to be displayed above the page content. See attached screenshot.

Steps to reproduce

There is a lot of configuration for captcha, turnstile, and this module, so I'm not sure if there is something unique about my case. So as far as I know, the steps to reproduce are simply to enable and configure this module.

The problem source appears to be here, where turnstile_protect_captcha_alter expects $captcha['form']['turnstile_widget']['#attached']['html_head'][0][0] to exist, and it doesn't. In fact, at this point, we have just a (empty) string at $captcha['form']['turnstile_widget']['#markup']

Proposed resolution

  1. Add a test for the existence of an array at $captcha['form']['turnstile_widget']['#attached']['html_head'][0][0] before adding attributes to it.
  2. Better yet, re-evaluate the purpose of this and make it work correctly (in all scenarios).

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States pdcarto

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024