Add input validation for color format and other parameters #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Enhancement: Missing Input Validation
Issue Description
Several functions in the milestone and label modules lack proper input validation, which could lead to runtime errors or API failures.
Missing Validations
1. Color Format Validation (Label Module)
Location:
CreateLabelFnandEditLabelFnIssue: No validation for hex color format
Current: Accepts any string as color
Expected: Should validate hex color format (e.g., "ff0000", "00ff00")
2. Date Format Validation (Milestone Module)
Location:
CreateMilestoneFn,EditMilestoneFn,EditMilestoneByNameFnIssue: No validation before parsing RFC3339 dates
Current: Relies on Go's time.Parse to catch invalid formats
Expected: Pre-validate date format to provide better error messages
3. Array Size Validation (Label Module)
Location:
AddIssueLabelsFn,RemoveIssueLabelsFn,ReplaceIssueLabelsFnIssue: No validation for maximum array sizes
Current: Could accept extremely large arrays
Expected: Should limit array size to prevent API abuse
4. Negative Number Validation
Location: Multiple functions with ID parameters
Issue: No validation for negative IDs
Current: Accepts negative numbers that will cause API errors
Expected: Should validate positive integers for ID parameters
Suggested Implementation
Priority
Medium - Improves user experience and prevents runtime errors
Affected Files
/operation/label/label.go/operation/milestone/milestone.go