From 66c7a7349f6c995efe064b9119c2852f3bb60033 Mon Sep 17 00:00:00 2001 From: knqyf263 Date: Thu, 16 Nov 2023 13:04:57 +0900 Subject: [PATCH] fix: use time.Time for CreatedAt Signed-off-by: knqyf263 --- integration/testdata/almalinux-8.json.golden | 2 +- integration/testdata/alpine-310.json.golden | 2 +- integration/testdata/alpine-39-high-critical.json.golden | 2 +- integration/testdata/alpine-39-ignore-cveids.json.golden | 2 +- integration/testdata/alpine-39-skip.json.golden | 2 +- integration/testdata/alpine-39.json.golden | 2 +- integration/testdata/alpine-distroless.json.golden | 2 +- integration/testdata/amazon-1.json.golden | 2 +- integration/testdata/amazon-2.json.golden | 2 +- integration/testdata/amazonlinux2-gp2-x86-vm.json.golden | 2 +- integration/testdata/busybox-with-lockfile.json.golden | 2 +- integration/testdata/centos-6.json.golden | 2 +- integration/testdata/centos-7-ignore-unfixed.json.golden | 2 +- integration/testdata/centos-7-medium.json.golden | 2 +- integration/testdata/centos-7.json.golden | 2 +- integration/testdata/cocoapods.json.golden | 2 +- integration/testdata/composer.lock.json.golden | 2 +- integration/testdata/conan.json.golden | 2 +- .../testdata/debian-buster-ignore-unfixed.json.golden | 2 +- integration/testdata/debian-buster.json.golden | 2 +- integration/testdata/debian-stretch.json.golden | 2 +- integration/testdata/distroless-base.json.golden | 2 +- integration/testdata/distroless-python27.json.golden | 2 +- integration/testdata/dockerfile-custom-policies.json.golden | 2 +- .../testdata/dockerfile-namespace-exception.json.golden | 2 +- integration/testdata/dockerfile-rule-exception.json.golden | 2 +- integration/testdata/dockerfile.json.golden | 2 +- integration/testdata/dockerfile_file_pattern.json.golden | 2 +- integration/testdata/dotnet.json.golden | 2 +- integration/testdata/fluentd-gems.json.golden | 2 +- integration/testdata/fluentd-multiple-lockfiles.json.golden | 2 +- integration/testdata/gomod-skip.json.golden | 2 +- integration/testdata/gomod.json.golden | 2 +- integration/testdata/gradle.json.golden | 2 +- integration/testdata/helm.json.golden | 2 +- integration/testdata/helm_badname.json.golden | 2 +- integration/testdata/helm_testchart.json.golden | 2 +- integration/testdata/helm_testchart.overridden.json.golden | 2 +- integration/testdata/mariner-1.0.json.golden | 2 +- integration/testdata/minikube-kbom.json.golden | 2 +- integration/testdata/mix.lock.json.golden | 2 +- integration/testdata/npm-with-dev.json.golden | 2 +- integration/testdata/npm.json.golden | 2 +- integration/testdata/nuget.json.golden | 2 +- integration/testdata/opensuse-leap-151.json.golden | 2 +- integration/testdata/oraclelinux-8.json.golden | 2 +- integration/testdata/photon-30.json.golden | 2 +- integration/testdata/pip.json.golden | 2 +- integration/testdata/pipenv.json.golden | 2 +- integration/testdata/pnpm.json.golden | 2 +- integration/testdata/poetry.json.golden | 2 +- integration/testdata/pom.json.golden | 2 +- integration/testdata/pubspec.lock.json.golden | 2 +- integration/testdata/rockylinux-8.json.golden | 2 +- integration/testdata/secrets.json.golden | 2 +- integration/testdata/spring4shell-jre11.json.golden | 2 +- integration/testdata/spring4shell-jre8.json.golden | 2 +- integration/testdata/swift.json.golden | 2 +- integration/testdata/test-repo.json.golden | 2 +- integration/testdata/ubi-7.json.golden | 2 +- integration/testdata/ubuntu-1804-ignore-unfixed.json.golden | 2 +- integration/testdata/ubuntu-1804.json.golden | 2 +- integration/testdata/ubuntu-gp2-x86-vm.json.golden | 2 +- integration/testdata/yarn.json.golden | 2 +- pkg/cloud/aws/commands/run_test.go | 6 ++++++ pkg/cloud/report/report.go | 2 ++ pkg/cloud/report/service_test.go | 4 ++++ pkg/scanner/scan.go | 2 +- pkg/scanner/scan_test.go | 2 +- pkg/types/report.go | 3 ++- 70 files changed, 80 insertions(+), 67 deletions(-) diff --git a/integration/testdata/almalinux-8.json.golden b/integration/testdata/almalinux-8.json.golden index b0c63578f3c4..824279932ef2 100644 --- a/integration/testdata/almalinux-8.json.golden +++ b/integration/testdata/almalinux-8.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/almalinux-8.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/alpine-310.json.golden b/integration/testdata/alpine-310.json.golden index b0d8dcfbf992..6b0f8fb57389 100644 --- a/integration/testdata/alpine-310.json.golden +++ b/integration/testdata/alpine-310.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/alpine-310.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/alpine-39-high-critical.json.golden b/integration/testdata/alpine-39-high-critical.json.golden index 5fa44cf795a2..3d9a5acc2c12 100644 --- a/integration/testdata/alpine-39-high-critical.json.golden +++ b/integration/testdata/alpine-39-high-critical.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/alpine-39.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/alpine-39-ignore-cveids.json.golden b/integration/testdata/alpine-39-ignore-cveids.json.golden index 8402925ba637..1d187b9ed057 100644 --- a/integration/testdata/alpine-39-ignore-cveids.json.golden +++ b/integration/testdata/alpine-39-ignore-cveids.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/alpine-39.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/alpine-39-skip.json.golden b/integration/testdata/alpine-39-skip.json.golden index 6fedc78a89cf..2584d251c0b7 100644 --- a/integration/testdata/alpine-39-skip.json.golden +++ b/integration/testdata/alpine-39-skip.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/alpine-39.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/alpine-39.json.golden b/integration/testdata/alpine-39.json.golden index 38f23f8a7a96..f5dc05335673 100644 --- a/integration/testdata/alpine-39.json.golden +++ b/integration/testdata/alpine-39.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/alpine-39.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/alpine-distroless.json.golden b/integration/testdata/alpine-distroless.json.golden index 2ca81fd332ce..5dc55d99806b 100644 --- a/integration/testdata/alpine-distroless.json.golden +++ b/integration/testdata/alpine-distroless.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/alpine-distroless.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/amazon-1.json.golden b/integration/testdata/amazon-1.json.golden index 6377d1fc0531..9324ad548ed2 100644 --- a/integration/testdata/amazon-1.json.golden +++ b/integration/testdata/amazon-1.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/amazon-1.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/amazon-2.json.golden b/integration/testdata/amazon-2.json.golden index bcf5d075f1ea..5b19f2d5e006 100644 --- a/integration/testdata/amazon-2.json.golden +++ b/integration/testdata/amazon-2.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/amazon-2.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/amazonlinux2-gp2-x86-vm.json.golden b/integration/testdata/amazonlinux2-gp2-x86-vm.json.golden index 9571ef66604a..aa3b62adbcb8 100644 --- a/integration/testdata/amazonlinux2-gp2-x86-vm.json.golden +++ b/integration/testdata/amazonlinux2-gp2-x86-vm.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "disk.img", "ArtifactType": "vm", "Metadata": { diff --git a/integration/testdata/busybox-with-lockfile.json.golden b/integration/testdata/busybox-with-lockfile.json.golden index af904c31f36b..f17f8796aa8b 100644 --- a/integration/testdata/busybox-with-lockfile.json.golden +++ b/integration/testdata/busybox-with-lockfile.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/busybox-with-lockfile.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/centos-6.json.golden b/integration/testdata/centos-6.json.golden index 741e300d03ef..3fbca6d85ad6 100644 --- a/integration/testdata/centos-6.json.golden +++ b/integration/testdata/centos-6.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/centos-6.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/centos-7-ignore-unfixed.json.golden b/integration/testdata/centos-7-ignore-unfixed.json.golden index 3c32c19fc701..f27d99919849 100644 --- a/integration/testdata/centos-7-ignore-unfixed.json.golden +++ b/integration/testdata/centos-7-ignore-unfixed.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/centos-7.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/centos-7-medium.json.golden b/integration/testdata/centos-7-medium.json.golden index 4fc41b8a0167..955c833a34c1 100644 --- a/integration/testdata/centos-7-medium.json.golden +++ b/integration/testdata/centos-7-medium.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/centos-7.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/centos-7.json.golden b/integration/testdata/centos-7.json.golden index 26138b9a32ee..e549fdac14db 100644 --- a/integration/testdata/centos-7.json.golden +++ b/integration/testdata/centos-7.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/centos-7.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/cocoapods.json.golden b/integration/testdata/cocoapods.json.golden index a9a126997012..35ea7c41a051 100644 --- a/integration/testdata/cocoapods.json.golden +++ b/integration/testdata/cocoapods.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/cocoapods", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/composer.lock.json.golden b/integration/testdata/composer.lock.json.golden index d175123d144f..6b8dbc6cf6bc 100644 --- a/integration/testdata/composer.lock.json.golden +++ b/integration/testdata/composer.lock.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/composer", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/conan.json.golden b/integration/testdata/conan.json.golden index ec7298b12054..3b0d8d4f4e0d 100644 --- a/integration/testdata/conan.json.golden +++ b/integration/testdata/conan.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/conan", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/debian-buster-ignore-unfixed.json.golden b/integration/testdata/debian-buster-ignore-unfixed.json.golden index 7d8e8418dc50..57c94d41b662 100644 --- a/integration/testdata/debian-buster-ignore-unfixed.json.golden +++ b/integration/testdata/debian-buster-ignore-unfixed.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/debian-buster.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/debian-buster.json.golden b/integration/testdata/debian-buster.json.golden index ef99f7455995..6124ab93de1b 100644 --- a/integration/testdata/debian-buster.json.golden +++ b/integration/testdata/debian-buster.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/debian-buster.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/debian-stretch.json.golden b/integration/testdata/debian-stretch.json.golden index 2cec165ac3cb..0b31b5eedaa5 100644 --- a/integration/testdata/debian-stretch.json.golden +++ b/integration/testdata/debian-stretch.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/debian-stretch.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/distroless-base.json.golden b/integration/testdata/distroless-base.json.golden index 39aba72910ac..ff3156dacfd6 100644 --- a/integration/testdata/distroless-base.json.golden +++ b/integration/testdata/distroless-base.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/distroless-base.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/distroless-python27.json.golden b/integration/testdata/distroless-python27.json.golden index c5f72aa791d8..4e6a2464b941 100644 --- a/integration/testdata/distroless-python27.json.golden +++ b/integration/testdata/distroless-python27.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/distroless-python27.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/dockerfile-custom-policies.json.golden b/integration/testdata/dockerfile-custom-policies.json.golden index aea2e3a5b235..c9ec6cd7d5b4 100644 --- a/integration/testdata/dockerfile-custom-policies.json.golden +++ b/integration/testdata/dockerfile-custom-policies.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/custom-policy", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/dockerfile-namespace-exception.json.golden b/integration/testdata/dockerfile-namespace-exception.json.golden index 53e6f93a6db3..d3a974f52410 100644 --- a/integration/testdata/dockerfile-namespace-exception.json.golden +++ b/integration/testdata/dockerfile-namespace-exception.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/namespace-exception", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/dockerfile-rule-exception.json.golden b/integration/testdata/dockerfile-rule-exception.json.golden index 6d447d980536..f37cb5fc1c15 100644 --- a/integration/testdata/dockerfile-rule-exception.json.golden +++ b/integration/testdata/dockerfile-rule-exception.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/rule-exception", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/dockerfile.json.golden b/integration/testdata/dockerfile.json.golden index 72ebc7d00a9b..67fb571b18ee 100644 --- a/integration/testdata/dockerfile.json.golden +++ b/integration/testdata/dockerfile.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/dockerfile", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/dockerfile_file_pattern.json.golden b/integration/testdata/dockerfile_file_pattern.json.golden index fae1f25b28c3..810c6ed1e425 100644 --- a/integration/testdata/dockerfile_file_pattern.json.golden +++ b/integration/testdata/dockerfile_file_pattern.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/dockerfile_file_pattern", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/dotnet.json.golden b/integration/testdata/dotnet.json.golden index 6409886f684b..d04624965482 100644 --- a/integration/testdata/dotnet.json.golden +++ b/integration/testdata/dotnet.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/dotnet", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/fluentd-gems.json.golden b/integration/testdata/fluentd-gems.json.golden index 2a6f60da3886..f75e6ac6fb2a 100644 --- a/integration/testdata/fluentd-gems.json.golden +++ b/integration/testdata/fluentd-gems.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/fluentd-multiple-lockfiles.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/fluentd-multiple-lockfiles.json.golden b/integration/testdata/fluentd-multiple-lockfiles.json.golden index 46cb86eda6ef..a3917f31d7b6 100644 --- a/integration/testdata/fluentd-multiple-lockfiles.json.golden +++ b/integration/testdata/fluentd-multiple-lockfiles.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/sbom/fluentd-multiple-lockfiles-cyclonedx.json", "ArtifactType": "cyclonedx", "Metadata": { diff --git a/integration/testdata/gomod-skip.json.golden b/integration/testdata/gomod-skip.json.golden index b58c9abed51e..a0ad5e7182cc 100644 --- a/integration/testdata/gomod-skip.json.golden +++ b/integration/testdata/gomod-skip.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/gomod", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/gomod.json.golden b/integration/testdata/gomod.json.golden index 397cfac89244..fb495a8e07ed 100644 --- a/integration/testdata/gomod.json.golden +++ b/integration/testdata/gomod.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/gomod", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/gradle.json.golden b/integration/testdata/gradle.json.golden index eac7bab6093a..48c2580b8cba 100644 --- a/integration/testdata/gradle.json.golden +++ b/integration/testdata/gradle.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/gradle", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/helm.json.golden b/integration/testdata/helm.json.golden index 08b89c8cbe89..037d02a8c26a 100644 --- a/integration/testdata/helm.json.golden +++ b/integration/testdata/helm.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/helm", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/helm_badname.json.golden b/integration/testdata/helm_badname.json.golden index 8b935eb05bb2..081df6943447 100644 --- a/integration/testdata/helm_badname.json.golden +++ b/integration/testdata/helm_badname.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/helm_badname", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/helm_testchart.json.golden b/integration/testdata/helm_testchart.json.golden index 00d8c862528f..58bce82835f9 100644 --- a/integration/testdata/helm_testchart.json.golden +++ b/integration/testdata/helm_testchart.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/helm_testchart", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/helm_testchart.overridden.json.golden b/integration/testdata/helm_testchart.overridden.json.golden index 6adb11041096..62d914c2b024 100644 --- a/integration/testdata/helm_testchart.overridden.json.golden +++ b/integration/testdata/helm_testchart.overridden.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/helm_testchart", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/mariner-1.0.json.golden b/integration/testdata/mariner-1.0.json.golden index 7c93c46e7f44..3c9ccbcd50e3 100644 --- a/integration/testdata/mariner-1.0.json.golden +++ b/integration/testdata/mariner-1.0.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/mariner-1.0.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/minikube-kbom.json.golden b/integration/testdata/minikube-kbom.json.golden index 4d4b277c7e3b..92215cf7b6e3 100644 --- a/integration/testdata/minikube-kbom.json.golden +++ b/integration/testdata/minikube-kbom.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/sbom/minikube-kbom.json", "ArtifactType": "cyclonedx", "Metadata": { diff --git a/integration/testdata/mix.lock.json.golden b/integration/testdata/mix.lock.json.golden index 8af6ae404292..b7180404bc3c 100644 --- a/integration/testdata/mix.lock.json.golden +++ b/integration/testdata/mix.lock.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/mixlock", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/npm-with-dev.json.golden b/integration/testdata/npm-with-dev.json.golden index a77dcd400ca4..9ace83bf5b27 100644 --- a/integration/testdata/npm-with-dev.json.golden +++ b/integration/testdata/npm-with-dev.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/npm", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/npm.json.golden b/integration/testdata/npm.json.golden index 0fbf98b5eec2..94dd11ae41db 100644 --- a/integration/testdata/npm.json.golden +++ b/integration/testdata/npm.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/npm", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/nuget.json.golden b/integration/testdata/nuget.json.golden index 7f5eb95503dd..c0285aea9555 100644 --- a/integration/testdata/nuget.json.golden +++ b/integration/testdata/nuget.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/nuget", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/opensuse-leap-151.json.golden b/integration/testdata/opensuse-leap-151.json.golden index 70e4c9f700c7..5b66db1b580f 100644 --- a/integration/testdata/opensuse-leap-151.json.golden +++ b/integration/testdata/opensuse-leap-151.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/opensuse-leap-151.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/oraclelinux-8.json.golden b/integration/testdata/oraclelinux-8.json.golden index f280f58ec20f..d44fb10ec399 100644 --- a/integration/testdata/oraclelinux-8.json.golden +++ b/integration/testdata/oraclelinux-8.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/oraclelinux-8.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/photon-30.json.golden b/integration/testdata/photon-30.json.golden index e3919d189a52..f27af155f454 100644 --- a/integration/testdata/photon-30.json.golden +++ b/integration/testdata/photon-30.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/photon-30.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/pip.json.golden b/integration/testdata/pip.json.golden index 0c69d66da2a4..ef4af98f6293 100644 --- a/integration/testdata/pip.json.golden +++ b/integration/testdata/pip.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/pip", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/pipenv.json.golden b/integration/testdata/pipenv.json.golden index be56a0c3ea2f..507ecfe6a45e 100644 --- a/integration/testdata/pipenv.json.golden +++ b/integration/testdata/pipenv.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/pipenv", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/pnpm.json.golden b/integration/testdata/pnpm.json.golden index 9a14d801262f..d5001c1758cb 100644 --- a/integration/testdata/pnpm.json.golden +++ b/integration/testdata/pnpm.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/pnpm", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/poetry.json.golden b/integration/testdata/poetry.json.golden index 0e9389d65eea..ac174525bcc4 100644 --- a/integration/testdata/poetry.json.golden +++ b/integration/testdata/poetry.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/poetry", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/pom.json.golden b/integration/testdata/pom.json.golden index b15579088f5d..249f3c24505b 100644 --- a/integration/testdata/pom.json.golden +++ b/integration/testdata/pom.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/pom", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/pubspec.lock.json.golden b/integration/testdata/pubspec.lock.json.golden index b67718d741a4..bceade5a9b6a 100644 --- a/integration/testdata/pubspec.lock.json.golden +++ b/integration/testdata/pubspec.lock.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/pubspec", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/rockylinux-8.json.golden b/integration/testdata/rockylinux-8.json.golden index 5fc4816d0387..67ecc66b246d 100644 --- a/integration/testdata/rockylinux-8.json.golden +++ b/integration/testdata/rockylinux-8.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/rockylinux-8.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/secrets.json.golden b/integration/testdata/secrets.json.golden index 4da66ddf2f13..15ab882e150c 100644 --- a/integration/testdata/secrets.json.golden +++ b/integration/testdata/secrets.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/secrets", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/spring4shell-jre11.json.golden b/integration/testdata/spring4shell-jre11.json.golden index 794725cf657e..1b9d2db6885c 100644 --- a/integration/testdata/spring4shell-jre11.json.golden +++ b/integration/testdata/spring4shell-jre11.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/spring4shell-jre11.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/spring4shell-jre8.json.golden b/integration/testdata/spring4shell-jre8.json.golden index 90927327dc99..13fbc3943355 100644 --- a/integration/testdata/spring4shell-jre8.json.golden +++ b/integration/testdata/spring4shell-jre8.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/spring4shell-jre8.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/swift.json.golden b/integration/testdata/swift.json.golden index ab0b4ab44a7b..10b004671c89 100644 --- a/integration/testdata/swift.json.golden +++ b/integration/testdata/swift.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/swift", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/test-repo.json.golden b/integration/testdata/test-repo.json.golden index 4fb33be4a35e..4235056228c0 100644 --- a/integration/testdata/test-repo.json.golden +++ b/integration/testdata/test-repo.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "https://github.com/knqyf263/trivy-ci-test", "ArtifactType": "repository", "Metadata": { diff --git a/integration/testdata/ubi-7.json.golden b/integration/testdata/ubi-7.json.golden index bfad8f153e59..c2939762b954 100644 --- a/integration/testdata/ubi-7.json.golden +++ b/integration/testdata/ubi-7.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/ubi-7.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/ubuntu-1804-ignore-unfixed.json.golden b/integration/testdata/ubuntu-1804-ignore-unfixed.json.golden index 1674c96f7d5b..a35729b41d71 100644 --- a/integration/testdata/ubuntu-1804-ignore-unfixed.json.golden +++ b/integration/testdata/ubuntu-1804-ignore-unfixed.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/ubuntu-1804.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/ubuntu-1804.json.golden b/integration/testdata/ubuntu-1804.json.golden index 312a3e19cb62..8c8d174674b2 100644 --- a/integration/testdata/ubuntu-1804.json.golden +++ b/integration/testdata/ubuntu-1804.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/images/ubuntu-1804.tar.gz", "ArtifactType": "container_image", "Metadata": { diff --git a/integration/testdata/ubuntu-gp2-x86-vm.json.golden b/integration/testdata/ubuntu-gp2-x86-vm.json.golden index e027cdd00bc9..1ec3c1c86015 100644 --- a/integration/testdata/ubuntu-gp2-x86-vm.json.golden +++ b/integration/testdata/ubuntu-gp2-x86-vm.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "disk.img", "ArtifactType": "vm", "Metadata": { diff --git a/integration/testdata/yarn.json.golden b/integration/testdata/yarn.json.golden index 816c3221c1bb..1e9054339883 100644 --- a/integration/testdata/yarn.json.golden +++ b/integration/testdata/yarn.json.golden @@ -1,6 +1,6 @@ { "SchemaVersion": 2, - "CreatedAt": 1629894030, + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "testdata/fixtures/repo/yarn", "ArtifactType": "repository", "Metadata": { diff --git a/pkg/cloud/aws/commands/run_test.go b/pkg/cloud/aws/commands/run_test.go index a7ac58886f8b..3c7a188f2d33 100644 --- a/pkg/cloud/aws/commands/run_test.go +++ b/pkg/cloud/aws/commands/run_test.go @@ -3,6 +3,7 @@ package commands import ( "bytes" "context" + "github.com/aquasecurity/trivy/pkg/clock" "os" "path/filepath" "testing" @@ -18,6 +19,7 @@ import ( ) const expectedS3ScanResult = `{ + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "12345678", "ArtifactType": "aws_account", "Metadata": { @@ -265,6 +267,7 @@ const expectedS3ScanResult = `{ ` const expectedCustomScanResult = `{ + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "12345678", "ArtifactType": "aws_account", "Metadata": { @@ -545,6 +548,7 @@ const expectedCustomScanResult = `{ ` const expectedS3AndCloudTrailResult = `{ + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactName": "123456789", "ArtifactType": "aws_account", "Metadata": { @@ -1124,6 +1128,8 @@ Summary Report for compliance: my-custom-spec expectErr: true, }, } + + clock.SetFakeTime(t, time.Date(2021, 8, 25, 12, 20, 30, 5, time.UTC)) for _, test := range tests { t.Run(test.name, func(t *testing.T) { if test.allServices != nil { diff --git a/pkg/cloud/report/report.go b/pkg/cloud/report/report.go index 6742db9d043a..6c7b1ac6d874 100644 --- a/pkg/cloud/report/report.go +++ b/pkg/cloud/report/report.go @@ -11,6 +11,7 @@ import ( "github.com/aquasecurity/defsec/pkg/scan" "github.com/aquasecurity/tml" + "github.com/aquasecurity/trivy/pkg/clock" cr "github.com/aquasecurity/trivy/pkg/compliance/report" ftypes "github.com/aquasecurity/trivy/pkg/fanal/types" "github.com/aquasecurity/trivy/pkg/flag" @@ -94,6 +95,7 @@ func Write(rep *Report, opt flag.Options, fromCache bool) error { }) base := types.Report{ + CreatedAt: clock.Now(), ArtifactName: rep.AccountID, ArtifactType: ftypes.ArtifactAWSAccount, Results: filtered, diff --git a/pkg/cloud/report/service_test.go b/pkg/cloud/report/service_test.go index d520285cabf1..b60e6f37c7ce 100644 --- a/pkg/cloud/report/service_test.go +++ b/pkg/cloud/report/service_test.go @@ -2,7 +2,9 @@ package report import ( "bytes" + "github.com/aquasecurity/trivy/pkg/clock" "testing" + "time" "github.com/aws/aws-sdk-go-v2/aws/arn" "github.com/stretchr/testify/assert" @@ -146,6 +148,7 @@ Scan Overview for AWS Account }, fromCache: false, expected: `{ + "CreatedAt": "2021-08-25T12:20:30.000000005Z", "ArtifactType": "aws_account", "Metadata": { "ImageConfig": { @@ -306,6 +309,7 @@ Scan Overview for AWS Account }`, }, } + clock.SetFakeTime(t, time.Date(2021, 8, 25, 12, 20, 30, 5, time.UTC)) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { report := New( diff --git a/pkg/scanner/scan.go b/pkg/scanner/scan.go index 1981f4828e64..cc1950b31fc9 100644 --- a/pkg/scanner/scan.go +++ b/pkg/scanner/scan.go @@ -173,7 +173,7 @@ func (s Scanner) ScanArtifact(ctx context.Context, options types.ScanOptions) (t return types.Report{ SchemaVersion: report.SchemaVersion, - CreatedAt: clock.Now().Unix(), + CreatedAt: clock.Now(), ArtifactName: artifactInfo.Name, ArtifactType: artifactInfo.Type, Metadata: types.Metadata{ diff --git a/pkg/scanner/scan_test.go b/pkg/scanner/scan_test.go index 808596f745ba..ba78193e7962 100644 --- a/pkg/scanner/scan_test.go +++ b/pkg/scanner/scan_test.go @@ -99,7 +99,7 @@ func TestScanner_ScanArtifact(t *testing.T) { }, want: types.Report{ SchemaVersion: 2, - CreatedAt: 1629894030, + CreatedAt: time.Date(2021, 8, 25, 12, 20, 30, 5, time.UTC), ArtifactName: "alpine:3.11", ArtifactType: ftypes.ArtifactContainerImage, Metadata: types.Metadata{ diff --git a/pkg/types/report.go b/pkg/types/report.go index edead1568ca1..c923097ee4a0 100644 --- a/pkg/types/report.go +++ b/pkg/types/report.go @@ -2,6 +2,7 @@ package types import ( "encoding/json" + "time" v1 "github.com/google/go-containerregistry/pkg/v1" // nolint: goimports @@ -11,7 +12,7 @@ import ( // Report represents a scan result type Report struct { SchemaVersion int `json:",omitempty"` - CreatedAt int64 `json:",omitempty"` + CreatedAt time.Time `json:",omitempty"` ArtifactName string `json:",omitempty"` ArtifactType ftypes.ArtifactType `json:",omitempty"` Metadata Metadata `json:",omitempty"`