diff --git a/docs/docs/supply-chain/attestation/vuln.md b/docs/docs/supply-chain/attestation/vuln.md index e0f78a541a..c17164f0f3 100644 --- a/docs/docs/supply-chain/attestation/vuln.md +++ b/docs/docs/supply-chain/attestation/vuln.md @@ -30,6 +30,7 @@ $ trivy image --format cosign-vuln --output vuln.json alpine:3.10 }, "result": { "SchemaVersion": 2, + "CreatedAt": 1629894030, "ArtifactName": "alpine:3.10", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/client_server_test.go b/integration/client_server_test.go index eadd893cc8..6a85ca0b50 100644 --- a/integration/client_server_test.go +++ b/integration/client_server_test.go @@ -354,7 +354,7 @@ func TestClientServerWithFormat(t *testing.T) { }, } - fakeTime := time.Date(2020, 8, 10, 7, 28, 17, 958601, time.UTC) + fakeTime := time.Date(2021, 8, 25, 12, 20, 30, 5, time.UTC) clock.SetFakeTime(t, fakeTime) report.CustomTemplateFuncMap = map[string]interface{}{ @@ -419,7 +419,7 @@ func TestClientServerWithCycloneDX(t *testing.T) { addr, cacheDir := setup(t, setupOptions{}) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - clock.SetFakeTime(t, time.Date(2020, 9, 10, 14, 20, 30, 5, time.UTC)) + clock.SetFakeTime(t, time.Date(2021, 8, 25, 12, 20, 30, 5, time.UTC)) uuid.SetFakeUUID(t, "3ff14136-e09f-4df9-80ea-%012d") osArgs, outputFile := setupClient(t, tt.args, addr, cacheDir, tt.golden) diff --git a/integration/integration_test.go b/integration/integration_test.go index 8f4ca3bc3d..67dc9aeb49 100644 --- a/integration/integration_test.go +++ b/integration/integration_test.go @@ -27,6 +27,7 @@ import ( "github.com/aquasecurity/trivy-db/pkg/db" "github.com/aquasecurity/trivy-db/pkg/metadata" + "github.com/aquasecurity/trivy/pkg/clock" "github.com/aquasecurity/trivy/pkg/commands" "github.com/aquasecurity/trivy/pkg/dbtest" "github.com/aquasecurity/trivy/pkg/types" @@ -43,6 +44,8 @@ func initDB(t *testing.T) string { entries, err := os.ReadDir(fixtureDir) require.NoError(t, err) + clock.SetFakeTime(t, time.Date(2021, 8, 25, 12, 20, 30, 5, time.UTC)) + var fixtures []string for _, entry := range entries { if entry.IsDir() { diff --git a/integration/repo_test.go b/integration/repo_test.go index 03dac4293c..e917288a03 100644 --- a/integration/repo_test.go +++ b/integration/repo_test.go @@ -480,7 +480,7 @@ func TestRepository(t *testing.T) { osArgs = append(osArgs, "--output", outputFile) osArgs = append(osArgs, tt.args.input) - clock.SetFakeTime(t, time.Date(2020, 9, 10, 14, 20, 30, 5, time.UTC)) + clock.SetFakeTime(t, time.Date(2021, 8, 25, 12, 20, 30, 5, time.UTC)) uuid.SetFakeUUID(t, "3ff14136-e09f-4df9-80ea-%012d") // Run "trivy repo" diff --git a/integration/testdata/almalinux-8.json.golden b/integration/testdata/almalinux-8.json.golden index 960de90952..b0c63578f3 100644 --- a/integration/testdata/almalinux-8.json.golden +++ b/integration/testdata/almalinux-8.json.golden @@ -1,5 +1,6 @@ { "SchemaVersion": 2, + "CreatedAt": 1629894030, "ArtifactName": "testdata/fixtures/images/almalinux-8.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/alpine-310-registry.json.golden b/integration/testdata/alpine-310-registry.json.golden index eb9c6fbfd7..7ceeca40e6 100644 --- a/integration/testdata/alpine-310-registry.json.golden +++ b/integration/testdata/alpine-310-registry.json.golden @@ -1,6 +1,7 @@ { "SchemaVersion": 2, - "ArtifactName": "localhost:55844/alpine:3.10", + "CreatedAt": 1629894030, + "ArtifactName": "localhost:53869/alpine:3.10", "ArtifactType": "container_image", "Metadata": { "OS": { @@ -13,10 +14,10 @@ "sha256:03901b4a2ea88eeaad62dbe59b072b28b6efa00491962b8741081c5df50c65e0" ], "RepoTags": [ - "localhost:55844/alpine:3.10" + "localhost:53869/alpine:3.10" ], "RepoDigests": [ - "localhost:55844/alpine@sha256:b1c5a500182b21d0bfa5a584a8526b56d8be316f89e87d951be04abed2446e60" + "localhost:53869/alpine@sha256:b1c5a500182b21d0bfa5a584a8526b56d8be316f89e87d951be04abed2446e60" ], "ImageConfig": { "architecture": "amd64", @@ -55,7 +56,7 @@ }, "Results": [ { - "Target": "localhost:55844/alpine:3.10 (alpine 3.10.2)", + "Target": "localhost:53869/alpine:3.10 (alpine 3.10.2)", "Class": "os-pkgs", "Type": "alpine", "Vulnerabilities": [ diff --git a/integration/testdata/alpine-310.asff.golden b/integration/testdata/alpine-310.asff.golden index 2f8e1a7489..6164ba5f11 100644 --- a/integration/testdata/alpine-310.asff.golden +++ b/integration/testdata/alpine-310.asff.golden @@ -7,8 +7,8 @@ "GeneratorId": "Trivy/CVE-2019-1549", "AwsAccountId": "123456789012", "Types": [ "Software and Configuration Checks/Vulnerabilities/CVE" ], - "CreatedAt": "2020-08-10T07:28:17.000958601Z", - "UpdatedAt": "2020-08-10T07:28:17.000958601Z", + "CreatedAt": "2021-08-25T12:20:30.000000005Z", + "UpdatedAt": "2021-08-25T12:20:30.000000005Z", "Severity": { "Label": "MEDIUM" }, @@ -52,8 +52,8 @@ "GeneratorId": "Trivy/CVE-2019-1551", "AwsAccountId": "123456789012", "Types": [ "Software and Configuration Checks/Vulnerabilities/CVE" ], - "CreatedAt": "2020-08-10T07:28:17.000958601Z", - "UpdatedAt": "2020-08-10T07:28:17.000958601Z", + "CreatedAt": "2021-08-25T12:20:30.000000005Z", + "UpdatedAt": "2021-08-25T12:20:30.000000005Z", "Severity": { "Label": "MEDIUM" }, @@ -97,8 +97,8 @@ "GeneratorId": "Trivy/CVE-2019-1549", "AwsAccountId": "123456789012", "Types": [ "Software and Configuration Checks/Vulnerabilities/CVE" ], - "CreatedAt": "2020-08-10T07:28:17.000958601Z", - "UpdatedAt": "2020-08-10T07:28:17.000958601Z", + "CreatedAt": "2021-08-25T12:20:30.000000005Z", + "UpdatedAt": "2021-08-25T12:20:30.000000005Z", "Severity": { "Label": "MEDIUM" }, @@ -142,8 +142,8 @@ "GeneratorId": "Trivy/CVE-2019-1551", "AwsAccountId": "123456789012", "Types": [ "Software and Configuration Checks/Vulnerabilities/CVE" ], - "CreatedAt": "2020-08-10T07:28:17.000958601Z", - "UpdatedAt": "2020-08-10T07:28:17.000958601Z", + "CreatedAt": "2021-08-25T12:20:30.000000005Z", + "UpdatedAt": "2021-08-25T12:20:30.000000005Z", "Severity": { "Label": "MEDIUM" }, diff --git a/integration/testdata/alpine-310.gsbom.golden b/integration/testdata/alpine-310.gsbom.golden index d4808b108a..006efffebf 100644 --- a/integration/testdata/alpine-310.gsbom.golden +++ b/integration/testdata/alpine-310.gsbom.golden @@ -11,7 +11,7 @@ "correlator": "workflow-name_integration", "id": "1910764383" }, - "scanned": "2020-08-10T07:28:17Z", + "scanned": "2021-08-25T12:20:30Z", "manifests": { "testdata/fixtures/images/alpine-310.tar.gz (alpine 3.10.2)": { "name": "alpine", diff --git a/integration/testdata/alpine-310.html.golden b/integration/testdata/alpine-310.html.golden index 0b369b3d94..83840bd015 100644 --- a/integration/testdata/alpine-310.html.golden +++ b/integration/testdata/alpine-310.html.golden @@ -51,7 +51,7 @@ } a.toggle-more-links { cursor: pointer; } -
| alpine | |||||
|---|---|---|---|---|---|