Skip to content

Fix forms lost from content opened by the site's own JavaScript (3.4.4) - #117

Merged
puikinsh merged 3 commits into
masterfrom
fix/116-trust-own-script-content
Dec 1, 2026
Merged

puikinsh merged 3 commits into
masterfrom
fix/116-trust-own-script-content

Conversation

@puikinsh

@puikinsh puikinsh commented Dec 1, 2026

Copy link
Copy Markdown
Member

Fixes #116.

Problem

3.4.3 marks every slide opened from an element as untrusted, including one whose src was passed in the site's own JavaScript:

jQuery("#login_launch_selector").fancyboxforwp({ type: 'ajax', src: 'https://example.com/login-2/' });

Its Ajax, HTML and inline content then went through the strict elementHtmlRules allow-list, so a Theme My Login form opened this way lost all its inputs. That contradicts the library's own policy that options passed to the JavaScript API are the site's own.

Fix

An element-opened slide now carries two flags:

  • untrusted: unchanged. It covers everything read from the element, such as captions, thumbs and the download link.
  • untrustedContent: new, and set only when src came from data-src or href. The URL-scheme check, the HTML and Ajax sanitizing and the inline-selector handling follow this flag.

jquery.fancybox.min.js is rebuilt, and verify:assets passes.

Verification

Tested on WordPress 7.2 RC3 (SQLite) with Theme My Login 7.3.1:

Case 3.4.3 3.4.4
Reporter's .fancyboxforwp({type:'ajax', src}) form stripped log and pwd fields present, and login through the lightbox works
JS type:'html' string with a form stripped intact
Ajax src from the link href stripped still stripped
data-type / data-src on the link stripped still stripped
JS src plus a hostile data-caption content stripped content intact, caption still sanitized
  • CVE-2026-96571 e2e suite: 42 of 42 checks pass on both 3.4.3 and 3.4.4. It covers the PoC comment, contributor HTML, inline, template and javascript: payloads, caption injection, foreign-frame deep links, normal image, video and PDF opening, and the unfiltered_html gating. A new check confirms that a contributor's data-type="ajax" link to a form page stays sanitized.
  • Other checks: composer lint and composer phpcs pass, and npm run package builds a clean 3.4.4 zip.

🤖 Generated with Claude Code

puikinsh and others added 3 commits December 1, 2026 14:10
3.4.3 marked every element-opened slide untrusted, including one whose
src was passed to .fancyboxforwp({ src: ... }) by the site's own script,
so HTML, Ajax and inline content was run through the strict element
rules and a login form opened that way lost its fields (#116).

Slides now carry a separate untrustedContent flag, set only when src
came from data-src or href. Captions, thumbs and the download link still
follow untrusted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@puikinsh
puikinsh merged commit bd93159 into master Dec 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression - form in fancybox

1 participant