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. 11: Uncontrolled data used in path expression #40

Merged
merged 1 commit into from
Dec 28, 2024

Conversation

dadav
Copy link
Owner

@dadav dadav commented Dec 28, 2024

Fixes https://github.com/dadav/gorge/security/code-scanning/11

To fix the problem, we need to ensure that the user input used to construct file paths is properly validated and sanitized. Specifically, we should:

  1. Ensure that metadata.Name does not contain any path separators or parent directory references.
  2. Ensure that the constructed file path is within the intended directory.

We will add validation checks to ensure that metadata.Name is a valid single path component and does not contain any path traversal characters.

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

…sion

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@dadav dadav marked this pull request as ready for review December 28, 2024 20:19
@dadav dadav merged commit 1261f9b into main Dec 28, 2024
6 checks passed
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