Decide: a magic link shown as plain URL text can be fetched by WordPress and burn its single-use token
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 20/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Domaine
- authentication
Piste de recherche
The bare URL is printed in url mode in views/dashboard-widgets/magic-link-url.php, lines 20-24, and the mismatch handling is in verify_and_consume_token() in inc/sso/class-magic-link.php. Reproduce first: a page holding only the shortcode with display_as="url" in a block theme, then check whether a WordPress/ user-agent request reaches the token URL. The issue asks for a maintainer decision on the mismatch behaviour before any change, so the first step is to get that decision. Done means the url output no longer triggers autoembed and anchor and button modes are unchanged.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Decision needed
A magic link shown in the "Plain URL Text" display mode (display_as="url") can be fetched by WordPress itself while the page renders. That consumes the single-use token, so the customer's later click fails. How should that be prevented?
Found while re-verifying the account area after #2133. Not caused by it: neither file below changed there.
Premise check
Correct, reproduced on a block theme with a page containing only [wu_magic_link_url display_as="url"].
Evidence, in order:
- The page render generated a token bound to the browser's user agent. The server's own request log shows a request for that exact URL 23 seconds later, with the user agent
WordPress/<version>; <site url>(the WordPress HTTP API), which followed the 301 to a 200. The browser's use of the link came after it. - The
magic-linklog then readsUser agent mismatch. Expected: <browser UA>, Got: WordPress/<version>andSecurity context mismatch, followed byToken not found or expiredfor every later attempt. - A temporary
pre_http_requesthook recorded the caller. The stack is core only:render_block_core_patterncallsWP_Embed::autoembed, which callsWP_Embed::shortcode,wp_oembed_get,WP_oEmbed::discoverandwp_safe_remote_get. WordPress treats a URL that is alone on a line as an embed and runs oEmbed discovery on it. - Control: the same page in the default link mode (
display_asunset, rendered as an anchor) made zero server-side requests, and the link signed a fresh logged-out browser session in as the customer, landing in the subsite admin.
Where it comes from:
views/dashboard-widgets/magic-link-url.phplines 20-24 print the bare URL, surrounded by blank lines, with no wrapper, inurlmode. That is the shape autoembed matches. The anchor and button modes are inside an element and are unaffected.inc/sso/class-magic-link.php,verify_and_consume_token(): on a user-agent or IP mismatch it runsdelete_transient()on the token before returning false, so a single request from another client, including a server-side one, invalidates it for the real user.
Analysis
- The token is bound to the generator's user agent and IP on purpose. Deleting it on mismatch is a conservative choice: a token presented from another client is treated as leaked.
- Any automated client that follows links has the same effect: a mail scanner, a link previewer, a prefetcher. WordPress autoembed is one instance that is easy to trigger.
- Changing the
urloutput (for example wrapping it) would stop autoembed, but the mode exists to give raw URL text, possibly for use inside markup, so wrapping may break existing usage. - Not deleting the token on a mismatch removes the burn, but leaves a token that someone else presented valid until it expires (
TOKEN_EXPIRATION, 600 seconds).
Recommended path
- Keep the mismatch behaviour as is. It is a security decision and the evidence here is about one display mode.
- Make
urlmode not print the URL alone on a line, for example by emitting it with no surrounding newlines so it is inline wherever it is placed, and document in the shortcode catalogue and the element's description thatanchororbuttonshould be used when the link is shown on a page. - Reconsider the delete-on-mismatch behaviour separately if emailed magic links turn out to be burned by mail scanners.
Verification, if this is built
- A page containing only the shortcode in
urlmode, rendered in a block theme: the request log shows noWordPress/request for the token URL, and the link signs a fresh logged-out session in. - The
anchorandbuttonmodes are unchanged. - A temporary
pre_http_requesthook that logs requests to URLs containingwu_magic_tokenis a quick way to check for a server-side fetch.
Files Scope
views/dashboard-widgets/magic-link-url.phpinc/ui/class-magic-link-url-element.php
aidevops.sh v3.39.189 plugin for OpenCode
- Langage dominant
- PHP
- Étoiles
- 219
- Forks
- 88
- Merge moyen
- 1 j 7 h
- PR mergées (30 j)
- 58
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de Ultimate-Multisite/ultimate-multisite
-
bug origin:interactive status:available
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
Ultimate-Multisite/ultimate-multisite#2131 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement hold-for-review no-auto-dispatch origin:interactive status:available
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 15/100
Ultimate-Multisite/ultimate-multisite#2137 ·
Les mainteneurs répondent en général sous 1 jour
-
fix: customer site lists stop at 100 sites (BerlinDB default number)Peut-être pris @superdav42 l’a pris aujourd’hui. Ouverteauto-dispatch bug origin:interactive status:in-review tier:standard
Ultimate-Multisite/ultimate-multisite#2136 · 5 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
fix: My Sites, Limits and Current Membership columns above 3 collapse to one column (missing grid utilities)Peut-être pris @superdav42 l’a pris aujourd’hui. Ouverteauto-dispatch bug origin:interactive status:in-review tier:standard
Ultimate-Multisite/ultimate-multisite#2134 · 5 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
security(sso): apply mapped-domain token policy to admin-bar magic linksPeut-être pris @superdav42 l’a pris il y a 1 jour. Ouverteauto-dispatch origin:interactive status:in-review tier:standard
Ultimate-Multisite/ultimate-multisite#2125 · 5 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de Ultimate-Multisite/ultimate-multisite
Issues similaires
-
35-feedback
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
bug good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
quantum-php/framework#692 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 70/100
ajeetraina/awesome-docker-sbx#559 ·
-
PHP 8.6 supportOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
Saisie des adressesOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
pantaflex44/Tiquettes#116 · 1 commentaire ·