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. 1: Improper code sanitization #23

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

saberzero1
Copy link
Owner

Fixes https://github.com/saberzero1/quartz-syncer/security/code-scanning/1

To fix the problem, we need to ensure that the excaliDrawJson string is properly sanitized before being inserted into the script tag. This can be achieved by escaping potentially dangerous characters in the JSON string. We will use a function similar to the escapeUnsafeChars function provided in the example to escape characters that could lead to script injection.

  1. Create a function escapeUnsafeChars to escape potentially dangerous characters.
  2. Use this function to sanitize the excaliDrawJson string before inserting it into the script tag.

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>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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