-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix: Unvalidated dynamic method call #888
Conversation
server-data/resources/[esx]/fivem-appearance/web/dist/assets/index.3e1fdbaf.js
Fixed
Show fixed
Hide fixed
server-data/resources/[esx]/fivem-appearance/web/dist/assets/index.3e1fdbaf.js
Fixed
Show fixed
Hide fixed
server-data/resources/[esx]/fivem-appearance/web/dist/assets/index.3e1fdbaf.js
Fixed
Show fixed
Hide fixed
server-data/resources/[esx]/fivem-appearance/web/dist/assets/index.3e1fdbaf.js
Fixed
Show fixed
Hide fixed
server-data/resources/[esx]/fivem-appearance/web/dist/assets/index.3e1fdbaf.js
Fixed
Show fixed
Hide fixed
server-data/resources/[esx]/fivem-appearance/web/dist/assets/index.3e1fdbaf.js
Fixed
Show fixed
Hide fixed
server-data/resources/[esx]/fivem-appearance/web/dist/assets/index.3e1fdbaf.js
Fixed
Show fixed
Hide fixed
|
||
const ye = { post: Qg, onEvent: qg, emitEvent: Yg }, | ||
Kg = () => (window.addEventListener('message', e => { | ||
!ta[e.data.type] || ta[e.data.type](e.data.payload); |
Check failure
Code scanning / CodeQL
Unvalidated dynamic method call High
user-controlled
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 2 months ago
To fix the problem, we need to ensure that the method name derived from user input (e.data.type
) is validated before it is used to access and invoke a method on the ta
object. Specifically, we should:
- Check if
e.data.type
is a valid key in theta
object usinghasOwnProperty
. - Verify that the value corresponding to
e.data.type
in theta
object is a function before invoking it.
This can be achieved by modifying the code on line 6110 to include these validation checks.
-
Copy modified lines R6110-R6112
@@ -6109,3 +6109,5 @@ | ||
Kg = () => (window.addEventListener('message', e => { | ||
!ta[e.data.type] || ta[e.data.type](e.data.payload); | ||
if (ta.hasOwnProperty(e.data.type) && typeof ta[e.data.type] === 'function') { | ||
ta[e.data.type](e.data.payload); | ||
} | ||
}), null), Ff = { |
Fixes #[issue_no]
All Submissions:
Please describe the changes this PR makes and why it should be merged:
Discord username (if different from GitHub):