Skip to content
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 code scanning alert no. 20: Client-side cross-site scripting #34

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

cooljeanius
Copy link
Owner

Fixes https://github.com/cooljeanius/ghidra/security/code-scanning/20

To fix the cross-site scripting vulnerability, we need to sanitize the user-provided input before assigning it to this.notes and subsequently setting it as innerHTML. The DOMPurify library, which is already included in the script, can be used for this purpose. This ensures that any potentially harmful scripts are removed from the input.

  • General Fix: Sanitize the user input using DOMPurify before assigning it to this.notes and setting it as innerHTML.
  • Detailed Fix: Modify the code on line 222 to use DOMPurify.sanitize(argv[1]) instead of directly assigning argv[1] to this.notes.
  • Specific Changes: Update the relevant line in the Dz.onmessage function to include the sanitization step.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@cooljeanius cooljeanius marked this pull request as ready for review September 25, 2024 01:23
Copy link
Owner Author

@cooljeanius cooljeanius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@cooljeanius cooljeanius merged commit 6f2b4ee into master Sep 25, 2024
9 checks passed
@cooljeanius cooljeanius deleted the autofix/alert-20-6882f0fadd branch September 25, 2024 01:23
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

Successfully merging this pull request may close these issues.

1 participant