Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(util/gutil): code scanning alert no. 17: Potentially unsafe quoting #3993

Merged
merged 1 commit into from
Dec 1, 2024

Conversation

houseme
Copy link
Member

@houseme houseme commented Dec 1, 2024

Fixes https://github.com/gogf/gf/security/code-scanning/17

To fix the problem, we need to ensure that single quotes are also escaped in the addSlashesForString function. This will prevent any potential injection vulnerabilities when the resulting string is embedded in a context that uses single quotes for quoting.

  • Modify the addSlashesForString function to escape single quotes.
  • Ensure that the escaping mechanism is consistent with the context in which the string will be used.

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>
@houseme houseme marked this pull request as ready for review December 1, 2024 09:51
@houseme houseme requested review from gqcn and hailaz December 1, 2024 09:52
@gqcn gqcn changed the title Fix code scanning alert no. 17: Potentially unsafe quoting fix(util/gutil): code scanning alert no. 17: Potentially unsafe quoting Dec 1, 2024
@gqcn gqcn merged commit 42eae41 into master Dec 1, 2024
20 checks passed
@gqcn gqcn deleted the alert-autofix-17 branch December 1, 2024 15:44
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants