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:42:46 -1000 |
| commit | 00e0d5e51515a10a9b69e75cd4ec3453341ec6bb (patch) | |
| tree | f86452d35c605a4a3db9a07c65c3a047f68ea0a2 | |
| parent | 62727653aa480c23abc289ee7821508df5944d78 (diff) | |
| download | poky-00e0d5e51515a10a9b69e75cd4ec3453341ec6bb.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: 91243ad474be00e55aa99355edef44f2fe2311f1)
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") |
