Skip to content

postMEssage第二个参数存在中危漏洞 #674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ZhangXiang521 opened this issue Apr 7, 2025 · 2 comments
Open

postMEssage第二个参数存在中危漏洞 #674

ZhangXiang521 opened this issue Apr 7, 2025 · 2 comments

Comments

@ZhangXiang521
Copy link

postMessage: function(type, data) {
if (global.parent !== global) {
global.parent.postMessage(JSON3.stringify({ global.parent.postMessage(JSON3.stringify({
global.parent.postMessage(JSON.stringify({ global.parent.postMessage(JSON.stringify({
windowId: module.exports.currentWindowId
, type: type
, data: data || ''
}), '');
typeof global.postMessage === 'object') && (!browser.isKonqueror()); } else {
debug('Cannot postMessage, no parent window.', type, data);
}
}
使用代码安全卫士扫描出
postMessage第二个参数
存在中危漏洞,如何整改,我可以传window.location.origin么,会不会影响源代码的正常功能

@auvipy
Copy link
Member

auvipy commented Apr 8, 2025

can you please elaborate more on english? thanks

@ZhangXiang521
Copy link
Author

postMessage: function(type, data) {
if (global.parent !== global) {
global.parent.postMessage(JSON3.stringify({ global.parent.postMessage(JSON3.stringify({
global.parent.postMessage(JSON.stringify({ global.parent.postMessage(JSON.stringify({
windowId: module.exports.currentWindowId
, type: type
, data: data || ''
}), '');
typeof global.postMessage === 'object') && (!browser.isKonqueror()); } else {
debug('Cannot postMessage, no parent window.', type, data);
}
Scan with Code Security Guard
There is a medium risk vulnerability in the second parameter of postMessage. How can I fix it? Can I pass window.local.origin? Will it affect the normal function of the source code

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

No branches or pull requests

2 participants