diff options
| author | Ross Burton <ross.burton@arm.com> | 2023-06-23 13:32:50 +0100 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2023-07-13 06:37:15 -1000 |
| commit | 0eee59b3dbaa3b1879ac7fdf79c94a8bf942bfe0 (patch) | |
| tree | 381ba5310cc93cd07fd4696383166a7870cd2bc2 | |
| parent | 41280e390ab6f29fb8596bd520c0a2f228bb2625 (diff) | |
| download | poky-0eee59b3dbaa3b1879ac7fdf79c94a8bf942bfe0.tar.gz | |
cve-update-nvd2-native: use exact times, don't truncate
When requesting updates in a specific range, use the actual current time
and database mtime instead of truncating to midnight, and explicitly set
the timezone to UTC so that NIST don't treat the timestamps as _their_ local
time when they're _our_ local time.
(From OE-Core rev: aa03556732b295fcf4bc2de11e3bc2e2b364580e)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 9aa0ec37f5f74252588d2494a71c71a7d8e68df9)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-core/meta/cve-update-nvd2-native.bb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/recipes-core/meta/cve-update-nvd2-native.bb b/meta/recipes-core/meta/cve-update-nvd2-native.bb index 0c627ef262..61f4d47f96 100644 --- a/meta/recipes-core/meta/cve-update-nvd2-native.bb +++ b/meta/recipes-core/meta/cve-update-nvd2-native.bb | |||
| @@ -172,8 +172,8 @@ def update_db_file(db_tmp_file, d, database_time): | |||
| 172 | # The maximum range for time is 120 days | 172 | # The maximum range for time is 120 days |
| 173 | # Force a complete update if our range is longer | 173 | # Force a complete update if our range is longer |
| 174 | if (database_time != 0): | 174 | if (database_time != 0): |
| 175 | database_date = datetime.datetime.combine(datetime.date.fromtimestamp(database_time), datetime.time()) | 175 | database_date = datetime.datetime.fromtimestamp(database_time, tz=datetime.timezone.utc) |
| 176 | today_date = datetime.datetime.combine(datetime.date.today(), datetime.time()) | 176 | today_date = datetime.datetime.now(tz=datetime.timezone.utc) |
| 177 | delta = today_date - database_date | 177 | delta = today_date - database_date |
| 178 | if delta.days < 120: | 178 | if delta.days < 120: |
| 179 | bb.debug(2, "CVE database: performing partial update") | 179 | bb.debug(2, "CVE database: performing partial update") |
