-
Notifications
You must be signed in to change notification settings - Fork 228
refactor: fixing version string problem #2163
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
Conversation
|
@MAVRICK-1 please review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a typo in the sanitize function name and enhances input sanitization and error logging for plugin handling.
- Fixed spelling of
santinizetosanitizethroughout the codebase - Updated
sanitizefunction to trim whitespace and convert to lowercase - Added error logging for plugin handler execution failures
- Extended the regex pattern to allow dots in plugin names, authors, and versions
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var ( | ||
| // sanitize input to allow only alphanumeric, underscore, hyphen | ||
| safePattern = regexp.MustCompile(`^[a-zA-Z0-9_-]+$`) | ||
| safePattern = regexp.MustCompile(`^[a-zA-Z0-9_.-]+$`) |
Copilot
AI
Nov 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding dot (.) to the allowed characters creates a security risk. The dot has special meaning in regular expressions and file paths. In file paths, dots can be used for directory traversal (e.g., ..). The BuildPluginKey function constructs file paths (see pluginDir := filepath.Join(pluginDirLoad, pluginKey) at line 433 of api/plugins.go), making this vulnerable to path traversal attacks. Consider escaping dots or only allowing them in specific positions (e.g., for semantic versioning like 1.0.0).
| safePattern = regexp.MustCompile(`^[a-zA-Z0-9_.-]+$`) | |
| safePattern = regexp.MustCompile(`^[a-zA-Z0-9_-]+$`) |
|
/approve /lgtm |
|
@MAVRICK-1 @gaurab-khanal, Currently, it's If you think it's not a good implementation, um, please give some suggestions! The PR I made this convention: PR #2034 |
|
/ok-to-test |
|
/approve |
|
LGTM label has been added. DetailsGit tree hash: 7eee7b51b6bbc0e2d80a5217457cd5c5ee72d327 |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: btwshivam, ghanshyam2005singh, MAVRICK-1 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
In this PR, I fixed the problem of being unable to upload the plugin due to the restriction of the plugin name, author, and version.
Related Issue
Fixes #2162
Changes Made
Checklist
Please ensure the following before submitting your PR:
Screenshots or Logs (if applicable)
Screen.Recording.2025-11-02.at.20.52.21.mov
Additional Notes