Skip to content

Commit 02b6914

Browse files
authored
chore(amazon): update EOL (#3876)
1 parent 79096e1 commit 02b6914

File tree

3 files changed

+14
-37
lines changed

3 files changed

+14
-37
lines changed

docs/docs/vulnerability/detection/os.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The unfixed/unfixable vulnerabilities mean that the patch has not yet been provi
1313
| Rocky Linux | 8, 9 | Installed by yum/rpm | NO |
1414
| Oracle Linux | 5, 6, 7, 8 | Installed by yum/rpm | NO |
1515
| CBL-Mariner | 1.0, 2.0 | Installed by yum/rpm | YES |
16-
| Amazon Linux | 1, 2, 2022, 2023 | Installed by yum/rpm | NO |
16+
| Amazon Linux | 1, 2, 2023 | Installed by yum/rpm | NO |
1717
| openSUSE Leap | 42, 15 | Installed by zypper/rpm | NO |
1818
| SUSE Enterprise Linux | 11, 12, 15 | Installed by zypper/rpm | NO |
1919
| Photon OS | 1.0, 2.0, 3.0, 4.0 | Installed by tdnf/yum/rpm | NO |

pkg/detector/ospkg/amazon/amazon.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020
var (
2121
eolDates = map[string]time.Time{
2222
"1": time.Date(2023, 6, 30, 23, 59, 59, 0, time.UTC),
23-
"2": time.Date(2024, 6, 30, 23, 59, 59, 0, time.UTC),
24-
// N/A
25-
"2022": time.Date(3000, 1, 1, 23, 59, 59, 0, time.UTC),
23+
// https://aws.amazon.com/amazon-linux-2/faqs/?nc1=h_ls
24+
"2": time.Date(2025, 6, 30, 23, 59, 59, 0, time.UTC),
25+
// Amazon Linux 2022 was renamed to 2023. AL2022 is not currently supported.
2626
"2023": time.Date(2028, 3, 15, 23, 59, 59, 0, time.UTC),
2727
}
2828
)
@@ -120,7 +120,7 @@ func (s *Scanner) Detect(osVer string, _ *ftypes.Repository, pkgs []ftypes.Packa
120120
// IsSupportedVersion checks if os can be scanned using amazon scanner
121121
func (s *Scanner) IsSupportedVersion(osFamily, osVer string) bool {
122122
osVer = strings.Fields(osVer)[0]
123-
if osVer != "2" {
123+
if osVer != "2" && osVer != "2022" && osVer != "2023" {
124124
osVer = "1"
125125
}
126126
eol, ok := eolDates[osVer]

pkg/detector/ospkg/amazon/amazon_test.go

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -95,38 +95,6 @@ func TestScanner_Detect(t *testing.T) {
9595
},
9696
},
9797
},
98-
{
99-
name: "amazon linux 2022",
100-
fixtures: []string{"testdata/fixtures/amazon.yaml", "testdata/fixtures/data-source.yaml"},
101-
args: args{
102-
osVer: "2022",
103-
pkgs: []ftypes.Package{
104-
{
105-
Name: "log4j",
106-
Version: "2.14.0",
107-
Layer: ftypes.Layer{
108-
DiffID: "sha256:932da51564135c98a49a34a193d6cd363d8fa4184d957fde16c9d8527b3f3b02",
109-
},
110-
},
111-
},
112-
},
113-
want: []types.DetectedVulnerability{
114-
{
115-
PkgName: "log4j",
116-
VulnerabilityID: "CVE-2021-44228",
117-
InstalledVersion: "2.14.0",
118-
FixedVersion: "2.15.0-1.amzn2022.0.1",
119-
Layer: ftypes.Layer{
120-
DiffID: "sha256:932da51564135c98a49a34a193d6cd363d8fa4184d957fde16c9d8527b3f3b02",
121-
},
122-
DataSource: &dbTypes.DataSource{
123-
ID: vulnerability.Amazon,
124-
Name: "Amazon Linux Security Center",
125-
URL: "https://alas.aws.amazon.com/",
126-
},
127-
},
128-
},
129-
},
13098
{
13199
name: "amazon linux 2023",
132100
fixtures: []string{"testdata/fixtures/amazon.yaml", "testdata/fixtures/data-source.yaml"},
@@ -251,6 +219,15 @@ func TestScanner_IsSupportedVersion(t *testing.T) {
251219
osFamily: "amazon",
252220
osVer: "2022",
253221
},
222+
want: false,
223+
},
224+
{
225+
name: "amazon linux 2023",
226+
now: time.Date(2020, 12, 1, 0, 0, 0, 0, time.UTC),
227+
args: args{
228+
osFamily: "amazon",
229+
osVer: "2023",
230+
},
254231
want: true,
255232
},
256233
}

0 commit comments

Comments
 (0)