Skip to content

Commit c9a0e52

Browse files
Merge pull request #107 from cristeacosmin/vuln-fix
Vulnerability fix for fancybox 3.5
2 parents 93c875b + 27793ba commit c9a0e52

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

assets/js/jquery.fancybox.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,7 +2126,7 @@
21262126
// If "filter" option is provided, then filter content
21272127
if (slide.opts.filter) {
21282128
content = $("<div>")
2129-
.html(content)
2129+
.html(DOMPurify.sanitize(content))
21302130
.find(slide.opts.filter);
21312131
}
21322132
}
@@ -2320,7 +2320,7 @@
23202320
.children()
23212321
.eq(0)
23222322
.empty()
2323-
.html(caption);
2323+
.html(DOMPurify.sanitize(caption));
23242324

23252325
captionH = $clone.outerHeight(true);
23262326

@@ -2968,7 +2968,7 @@
29682968
$caption
29692969
.children()
29702970
.eq(0)
2971-
.html(caption);
2971+
.html(DOMPurify.sanitize(caption));
29722972
} else {
29732973
self.$caption = null;
29742974
}
@@ -2978,8 +2978,8 @@
29782978
}
29792979

29802980
// Update info and navigation elements
2981-
$container.find("[data-fancybox-count]").html(self.group.length);
2982-
$container.find("[data-fancybox-index]").html(index + 1);
2981+
$container.find("[data-fancybox-count]").html(DOMPurify.sanitize(self.group.length));
2982+
$container.find("[data-fancybox-index]").html(DOMPurify.sanitize(index + 1));
29832983

29842984
$container.find("[data-fancybox-prev]").prop("disabled", !current.opts.loop && index <= 0);
29852985
$container.find("[data-fancybox-next]").prop("disabled", !current.opts.loop && index >= self.group.length - 1);

0 commit comments

Comments
 (0)