Skip to content

Commit a20a6ee

Browse files
Potential fix for code scanning alert no. 142: Missing origin verification in postMessage handler
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 7950b60 commit a20a6ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/assets/js/asciinema-player.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@
146146
} else {
147147
var h = [], g = String(Math.random());
148148
window.addEventListener("message", function (e) {
149-
if (e.data === g) {
149+
var trustedOrigins = ['https://www.example.com']; // Add your trusted origins here
150+
if (trustedOrigins.includes(e.origin) && e.data === g) {
150151
var t = h;
151152
h = [], t.forEach(function (e) {
152153
e()

0 commit comments

Comments
 (0)