Skip to content

Commit

Permalink
Add colon to valid symbols
Browse files Browse the repository at this point in the history
Signed-off-by: Miaha <[email protected]>
  • Loading branch information
Miaha Cybersec committed May 21, 2024
1 parent 6cf581e commit c9b0c2c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/pkgmgr/rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func isValidPackage(ver string) error {
return errors.New("upstream_version must start with digit")
}

allowedSymbols := ".-+~_"
allowedSymbols := ".-+~:_"
for _, s := range ver {
if !unicode.IsDigit(s) && !unicode.IsLetter(s) && !strings.ContainsRune(allowedSymbols, s) {
return errors.New("upstream_version includes invalid character")
Expand Down
1 change: 1 addition & 0 deletions pkg/pkgmgr/rpm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ func TestIsValidPackage(t *testing.T) {
{name: "Valid version - with hyphen", ver: "1.2.3-beta", errMsg: ""},
{name: "Valid version - with underscore", ver: "2_0_0", errMsg: ""},
{name: "Valid version - with tilde", ver: "3.0.1~rc1", errMsg: ""},
{name: "Valid version - with colon", ver: "2:9.0.1314-1.amzn2.0.1", errMsg: ""},
{name: "Invalid version - starts with letter", ver: "a1.2.3", errMsg: "upstream_version must start with digit"},
{name: "Invalid version - with space", ver: "1.2.3 with fix", errMsg: "upstream_version includes invalid character"},
{name: "Invalid version - with special character", ver: "1.2.3@", errMsg: "upstream_version includes invalid character"},
Expand Down

0 comments on commit c9b0c2c

Please sign in to comment.