diff --git a/CLAUDE.md b/CLAUDE.md
index e0c7965..7e8fe13 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -104,7 +104,7 @@ Scalar options are `wp_json_encode()`d rather than interpolated by hand; functio
**Upgrading the library means re-applying that rename and the security patches below**, then regenerating `jquery.fancybox.min.js`.
-The file also carries security changes that upstream does not have (CVE-2026-96571, 3.4.3). Anything read from a link is untrusted, because comment authors control `href` and post authors control `data-*`. `pickElementOptions()` allow-lists per-link options, `isSafeUrl()` refuses unsafe schemes, `sanitizeHtml()` applies the `elementHtmlRules` allow-list to captions and HTML or Ajax slides, `getInlineContent()` never parses HTML, `isForeignFrame()` stops a URL hash auto-opening another site's page, video template values are escaped, and thumbnails are built through the DOM. Do not add a template, `parentEl` or `media`-style option to `elementOptionTypes`.
+The file also carries security changes that upstream does not have (CVE-2026-96571, 3.4.3). Anything read from a link is untrusted, because comment authors control `href` and post authors control `data-*`. Options passed in JavaScript are the site's own and stay trusted: since 3.4.4 an element-opened slide carries two flags, `untrusted` for everything read from the element (captions, thumbs, download link) and `untrustedContent`, set only when its `src` came from `data-src` or `href`. HTML, Ajax and inline content follow `untrustedContent`, so `.fancyboxforwp({ src: ... })` on a site's own element can open a form again (issue #116). `pickElementOptions()` allow-lists per-link options, `isSafeUrl()` refuses unsafe schemes, `sanitizeHtml()` applies the `elementHtmlRules` allow-list to captions and HTML or Ajax slides, `getInlineContent()` never parses HTML, `isForeignFrame()` stops a URL hash auto-opening another site's page, video template values are escaped, and thumbnails are built through the DOM. Do not add a template, `parentEl` or `media`-style option to `elementOptionTypes`.
### Assets
diff --git a/assets/js/jquery.fancybox.js b/assets/js/jquery.fancybox.js
index e6de2f7..5e5ed73 100644
--- a/assets/js/jquery.fancybox.js
+++ b/assets/js/jquery.fancybox.js
@@ -37,7 +37,9 @@
// Links can be written by people who are not trusted to run scripts: comment
// authors control `href`, and post authors also control `data-*` attributes.
// Anything read from an element is treated as untrusted. Options passed to the
- // JavaScript API come from the site's own code and are left alone.
+ // JavaScript API come from the site's own code and are left alone - including a
+ // `src` given to `.fancyboxforwp({ src: ... })` on an element, whose HTML, Ajax
+ // or inline content is then as trusted as `$.fancyboxforwp.open({ src: ... })`.
// The only options an element may set, and the value types each one accepts.
// Everything else is dropped, notably templates (`baseTpl`, `errorTpl`, `btnTpl`,
@@ -783,12 +785,18 @@
obj.untrusted = true;
obj.src = self.opts.src || opts.src || $item.attr("href");
+ // Captions and every other value read from the element stay untrusted, but
+ // the content is only as untrusted as its source: a `src` from the options
+ // passed in JavaScript is the site's own, one from `data-src` or `href` is
+ // not. Without this, a site's own login form opened this way lost its fields.
+ obj.untrustedContent = !self.opts.src;
+
// Assume that simple syntax is used, for example:
// `$.fancyboxforwp.open( $("#test"), {} );`
if (!obj.type && !obj.src) {
obj.type = "inline";
obj.src = item;
- } else if ($.type(obj.src) === "string" && opts.type !== "html" && opts.type !== "inline" && obj.src.charAt(0) !== "#" && !isSafeUrl(obj.src)) {
+ } else if (obj.untrustedContent && $.type(obj.src) === "string" && opts.type !== "html" && opts.type !== "inline" && obj.src.charAt(0) !== "#" && !isSafeUrl(obj.src)) {
// `javascript:` and friends. An unknown type renders the error slide.
obj.type = "blocked";
obj.src = "";
@@ -1820,7 +1828,7 @@
break;
case "html":
- self.setContent(slide, slide.untrusted ? sanitizeHtml(slide.src) : slide.src || slide.content);
+ self.setContent(slide, slide.untrustedContent ? sanitizeHtml(slide.src) : slide.src || slide.content);
break;
@@ -1859,14 +1867,14 @@
self.showLoading(slide);
ajaxLoad = $.ajax(
- $.extend({}, slide.opts.ajax.settings, slide.untrusted ? {
+ $.extend({}, slide.opts.ajax.settings, slide.untrustedContent ? {
// Otherwise jQuery runs the response if it is served as JavaScript
dataType: "html"
} : {}, {
url: slide.src,
success: function (data, textStatus) {
if (textStatus === "success") {
- self.setContent(slide, slide.untrusted ? sanitizeHtml(data) : data);
+ self.setContent(slide, slide.untrustedContent ? sanitizeHtml(data) : data);
}
},
error: function (jqXHR, textStatus) {
@@ -1896,7 +1904,7 @@
// markup it is handed, so a target taken from an element may only be a selector.
getInlineContent: function (slide) {
- if (!slide.untrusted || $.type(slide.src) !== "string") {
+ if (!slide.untrustedContent || $.type(slide.src) !== "string") {
return $(slide.src);
}
diff --git a/assets/js/jquery.fancybox.min.js b/assets/js/jquery.fancybox.min.js
index aea8a91..0213d5c 100644
--- a/assets/js/jquery.fancybox.min.js
+++ b/assets/js/jquery.fancybox.min.js
@@ -1,4 +1,4 @@
// fancyBox v3.5.7
// Licensed GPLv3 for open source use
// or fancyBox Commercial License for commercial use
-!function(t,e,n,o){"use strict";if(t.console=t.console||{info:function(t){}},n)if(n.fn.fancyboxforwp)console.info("fancyBox already initialized");else{var a,i,s,r,c={type:"string",src:"string",caption:"string number",thumb:"string",srcset:"string",sizes:"string",videoFormat:"string",width:"string number",height:"string number",arrows:"boolean",autoFocus:"boolean",backFocus:"boolean",fullScreen:"boolean",hash:"boolean",infobar:"boolean",keyboard:"boolean",loop:"boolean",modal:"boolean",preventCaptionOverlap:"boolean",protect:"boolean",slideShow:"boolean",smallBtn:"boolean",thumbs:"boolean",toolbar:"boolean",touch:"boolean",trapFocus:"boolean",wheel:"boolean"},l=/\.(pdf)((\?|#).*)?$/i,d={ALLOWED_TAGS:["a","abbr","b","blockquote","br","caption","cite","code","col","colgroup","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","mark","ol","p","pre","q","s","samp","section","small","span","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","time","tr","u","ul","var"],ALLOWED_ATTR:["alt","cite","class","colspan","datetime","dir","height","href","lang","loading","rel","rowspan","sizes","src","srcset","title","width"],ALLOW_DATA_ATTR:!1},u={closeExisting:!1,loop:!1,gutter:50,keyboard:!0,preventCaptionOverlap:!0,arrows:!0,infobar:!0,smallBtn:"auto",toolbar:"auto",buttons:["zoom","slideShow","thumbs","close"],idleTime:3,protect:!1,modal:!1,image:{preload:!1},ajax:{settings:{data:{fancybox:!0}}},iframe:{tpl:'',preload:!0,css:{},attr:{scrolling:"auto"}},video:{tpl:'',format:"",autoStart:!0},defaultType:"image",animationEffect:"zoom",animationDuration:366,zoomOpacity:"auto",transitionEffect:"fade",transitionDuration:366,slideClass:"",baseClass:"",baseTpl:'
'}}),e(t).on("click","[data-fancybox-share]",function(){var t,n,o,a,i=e.fancyboxforwp.getInstance(),s=i.current||null;s&&("function"===e.type(s.opts.share.url)&&(t=s.opts.share.url.apply(s,[i,s])),n=s.opts.share.tpl.replace(/\{\{media\}\}/g,"image"===s.type?encodeURIComponent(s.src):"").replace(/\{\{url\}\}/g,encodeURIComponent(t)).replace(/\{\{url_raw\}\}/g,(o=t,a={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},String(o).replace(/[&<>"'`=\/]/g,function(t){return a[t]}))).replace(/\{\{descr\}\}/g,i.$caption?encodeURIComponent(i.$caption.text()):""),e.fancyboxforwp.open({src:i.translate(i,n),type:"html",opts:{touch:!1,animationEffect:!1,afterLoad:function(t,e){i.$refs.container.one("beforeClose.fb",function(){t.close(null,0)}),e.$content.find(".fancybox-share__button").click(function(){return window.open(this.href,"Share","width=550, height=450"),!1})},mobile:{autoFocus:!1}}}))})}(document,jQuery),function(t,e,n){"use strict";function o(){var e=t.location.hash.substr(1),n=e.split("-"),o=n.length>1&&/^\+?\d+$/.test(n[n.length-1])&&parseInt(n.pop(-1),10)||1;return{hash:e,index:o<1?1:o,gallery:n.join("-")}}function a(t){if(""!==t.gallery){var e=n("[data-fancybox='"+n.escapeSelector(t.gallery)+"']").eq(t.index-1);if(e.length&&n.fancyboxforwp.isForeignFrame(e))return;e.focus().trigger("click.fb-start")}}function i(t){var e,n;return!!t&&(""!==(n=(e=t.current?t.current.opts:t.opts).hash||(e.$orig?e.$orig.data("fancybox")||e.$orig.data("fancybox-trigger"):""))&&n)}n.escapeSelector||(n.escapeSelector=function(t){return(t+"").replace(/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t})}),n(function(){!1!==n.fancyboxforwp.defaults.hash&&(n(e).on({"onInit.fb":function(t,e){var n,a;!1!==e.group[e.currIndex].opts.hash&&(n=o(),(a=i(e))&&n.gallery&&a==n.gallery&&(e.currIndex=n.index-1))},"beforeShow.fb":function(n,o,a,s){var r;a&&!1!==a.opts.hash&&(r=i(o))&&(o.currentHash=r+(o.group.length>1?"-"+(a.index+1):""),t.location.hash!=="#"+o.currentHash&&(s&&!o.origHash&&(o.origHash=t.location.hash),o.hashTimer&&clearTimeout(o.hashTimer),o.hashTimer=setTimeout(function(){"replaceState"in t.history?(t.history[s?"pushState":"replaceState"]({},e.title,t.location.pathname+t.location.search+"#"+o.currentHash),s&&(o.hasCreatedHistory=!0)):t.location.hash=o.currentHash,o.hashTimer=null},300)))},"beforeClose.fb":function(n,o,a){a&&!1!==a.opts.hash&&(clearTimeout(o.hashTimer),o.currentHash&&o.hasCreatedHistory?t.history.back():o.currentHash&&("replaceState"in t.history?t.history.replaceState({},e.title,t.location.pathname+t.location.search+(o.origHash||"")):t.location.hash=o.origHash),o.currentHash=null)}}),n(t).on("hashchange.fb",function(){var t=o(),e=null;n.each(n(".fancybox-container").get().reverse(),function(t,o){var a=n(o).data("FancyBox");if(a&&a.currentHash)return e=a,!1}),e?e.currentHash===t.gallery+"-"+t.index||1===t.index&&e.currentHash==t.gallery||(e.currentHash=null,e.close()):""!==t.gallery&&a(t)}),setTimeout(function(){n.fancyboxforwp.getInstance()||a(o())},50))})}(window,document,jQuery),function(t,e){"use strict";var n=(new Date).getTime();e(t).on({"onInit.fb":function(t,e,o){e.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll",function(t){var o=e.current,a=(new Date).getTime();e.group.length<2||!1===o.opts.wheel||"auto"===o.opts.wheel&&"image"!==o.type||(t.preventDefault(),t.stopPropagation(),o.$slide.hasClass("fancybox-animated")||(t=t.originalEvent||t,a-n<250||(n=a,e[(-t.deltaY||-t.deltaX||t.wheelDelta||-t.detail)<0?"next":"previous"]())))})}})}(document,jQuery);
\ No newline at end of file
diff --git a/fancybox.php b/fancybox.php
index 0ffef57..059dc7a 100644
--- a/fancybox.php
+++ b/fancybox.php
@@ -3,7 +3,7 @@
* Plugin Name: FancyBox for WordPress
* Plugin URI: https://wordpress.org/plugins/fancybox-for-wordpress/
* Description: Integrates FancyBox 3 into WordPress.
-* Version: 3.4.3
+* Version: 3.4.4
* Author: Colorlib
* Author URI: https://colorlib.com/wp/
* Requires at least: 5.6
@@ -36,7 +36,7 @@
* Plugin Init
*/
// Constants
-define( 'FBFW_VERSION', '3.4.3' );
+define( 'FBFW_VERSION', '3.4.4' );
define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
diff --git a/package-lock.json b/package-lock.json
index 9b9821a..36587a2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "fancybox-for-wordpress",
- "version": "3.4.1",
+ "version": "3.4.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "fancybox-for-wordpress",
- "version": "3.4.1",
+ "version": "3.4.4",
"license": "GPL-3.0-or-later",
"devDependencies": {
"clean-css-cli": "^5.6.3",
diff --git a/package.json b/package.json
index 394fd41..ffc6bff 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "fancybox-for-wordpress",
- "version": "3.4.3",
+ "version": "3.4.4",
"description": "Integrates FancyBox 3 into WordPress.",
"homepage": "https://wordpress.org/plugins/fancybox-for-wordpress/",
"author": "Colorlib",
diff --git a/readme.txt b/readme.txt
index 7d6f685..0ab057a 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Tags: fancybox, lightbox, images, photos, pictures
Requires at least: 5.6
Tested up to: 7.2
Requires PHP: 7.4
-Stable tag: 3.4.3
+Stable tag: 3.4.4
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -54,6 +54,8 @@ This plugin is developed and maintained by [Colorlib](https://colorlib.com/), wh
If it is useful to you, a [review](https://wordpress.org/support/plugin/fancybox-for-wordpress/reviews/?filter=5) genuinely helps.
== Changelog ==
+= 3.4.4 =
+Fixed: Content your own site opens in the lightbox from JavaScript, such as a login form loaded with `.fancyboxforwp({ type: 'ajax', src: ... })`, kept only its text since 3.4.3: form fields and styles were removed. The 3.4.3 security rules now apply where they were meant to, to what a link supplies itself through its `href` or `data-` attributes, and captions on links are still filtered. Thanks to David Anderson for the report.
= 3.4.3 =
Security: Fixed a stored cross-site scripting issue (CVE-2026-96571) where a crafted link in a comment could run script when opened in the lightbox. Video source, format and poster values are now escaped. Thanks to Yuto Hyakumoto and Wordfence for the responsible report.
Security: Fixed a crafted link that could freeze the browser of everyone who loaded the page.
@@ -381,6 +383,9 @@ Fixed errors causes by WordPress SVN.
== Upgrade Notice ==
+= 3.4.4 =
+Fixes forms and styles disappearing from content your own site opens in the lightbox from JavaScript, a regression in 3.4.3. The 3.4.3 security protections for links are unchanged.
+
= 3.4.3 =
Security release. Fixes a stored cross-site scripting issue and a page-freezing bug that could both be triggered through a link in a comment. Update as soon as possible.