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

feat: db version range support set format #270

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cmd/detail/cmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,17 @@ func (v *Version) Ok() bool {
// inRangeInterval 判断一个版本是否在一个版本区间内
func inRangeInterval(ver *Version, interval string) bool {
// 当前版本
if len(interval) < 2 {
return false
}
// 集合形式
if interval[0] == '{' && interval[len(interval)-1] == '}' {
for _, v := range strings.Split(strings.Trim(interval, "{}"), ",") {
if newVersion(v).Equal(ver) {
return true
}
}
}
// 遍历所有区间
for _, interval := range strings.Split(interval, "||") {
if len(interval) < 2 {
Expand Down
10 changes: 10 additions & 0 deletions db-demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,15 @@
"release_date": "2021-12-28",
"security_level_id": 3,
"exploit_level_id": 0
},
{
"product": "tensrflwo",
"version": "{2.5.1,2.7,2.7.1,2.8,2.9}",
"language": "python",
"id": "XMIRROR-MAL45-777DD586",
"name": "tensorflwo 供应链投毒",
"description": "恶意Python组件包投毒,仿冒tensorflow。",
"suggestion": "使用官方tensorflow组件",
"release_date": "2024-01-15"
}
]