Skip to content

Fix code scanning alert no. 106: Code injection#287

Merged
karastoyanov merged 6 commits into
developmentfrom
security/user-submit-quest-comment-code-injection
Oct 13, 2024
Merged

Fix code scanning alert no. 106: Code injection#287
karastoyanov merged 6 commits into
developmentfrom
security/user-submit-quest-comment-code-injection

Conversation

@karastoyanov
Copy link
Copy Markdown
Member

Fixes https://github.com/Skill-Forge-Project/skill_forge/security/code-scanning/106

To fix this issue, we should avoid using eval on user input. Instead, we can parse the input as JSON, which is a safer alternative. This will ensure that the input is treated as data rather than code, preventing code injection attacks.

  • Replace the eval function with json.loads to safely parse the user input as JSON.
  • Ensure that the input is a valid JSON string before attempting to parse it.

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

karastoyanov and others added 6 commits October 5, 2024 15:05
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@karastoyanov karastoyanov changed the base branch from main to development October 13, 2024 08:02
@karastoyanov karastoyanov self-assigned this Oct 13, 2024
@karastoyanov karastoyanov added security Secuirty Patch bug Something isn't working labels Oct 13, 2024
@karastoyanov karastoyanov marked this pull request as ready for review October 13, 2024 08:03
@karastoyanov karastoyanov merged commit a71e4ba into development Oct 13, 2024
@karastoyanov karastoyanov added pull-request Pull Request and removed bug Something isn't working labels Oct 13, 2024
@karastoyanov karastoyanov deleted the security/user-submit-quest-comment-code-injection branch October 13, 2024 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pull-request Pull Request security Secuirty Patch

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant