Repository navigation
Fix forms lost from content opened by the site's own JavaScript (3.4.4) - #117
Merged
Merged
Conversation
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>
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #116.
Problem
3.4.3 marks every slide opened from an element as
untrusted, including one whosesrcwas passed in the site's own JavaScript:Its Ajax, HTML and inline content then went through the strict
elementHtmlRulesallow-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 whensrccame fromdata-srcorhref. The URL-scheme check, the HTML and Ajax sanitizing and the inline-selector handling follow this flag.jquery.fancybox.min.jsis rebuilt, andverify:assetspasses.Verification
Tested on WordPress 7.2 RC3 (SQLite) with Theme My Login 7.3.1:
.fancyboxforwp({type:'ajax', src})logandpwdfields present, and login through the lightbox workstype:'html'string with a formsrcfrom the linkhrefdata-type/data-srcon the linksrcplus a hostiledata-captionjavascript:payloads, caption injection, foreign-frame deep links, normal image, video and PDF opening, and theunfiltered_htmlgating. A new check confirms that a contributor'sdata-type="ajax"link to a form page stays sanitized.composer lintandcomposer phpcspass, andnpm run packagebuilds a clean 3.4.4 zip.🤖 Generated with Claude Code