ci: a weekly check compares the bundled end-of-life tables with endoflife.date (#563)
This commit was merged in pull request #563.
This commit is contained in:
1 parent
43d8ff1589
commit
70125b4556
14 files changed
+945
-207
No files matched your search
@@ -0,0 +1,57 @@
|
||||
name: End-of-life tables
|
||||
|
||||
# Compares the bundled end-of-life tables (compliance-agent/data/eol/: Yocto
|
||||
# releases, .NET target frameworks, the oldest patched Android and iOS
|
||||
# releases) with endoflife.date once a week. A difference (a new release, a
|
||||
# changed end-of-life date) opens one issue, or updates the open one, labelled
|
||||
# "eol-tables"; the tables themselves are updated by hand after checking the
|
||||
# vendor's page. A separate workflow, so it never fails main CI.
|
||||
#
|
||||
# The issue is written with NIGHTLY_ALERT_TOKEN, the token the nightly
|
||||
# regression already uses for its alert issue (issue write on this repo).
|
||||
# Without it the differences are only printed in the log.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 5 * * 1' # Mondays, 5 AM UTC
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
dry_run:
|
||||
description: "Print the differences only, write no issue"
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
concurrency:
|
||||
group: eol-tables
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Compare with endoflife.date
|
||||
runs-on: docker
|
||||
container:
|
||||
image: python:3.12-alpine
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
apk add --no-cache git
|
||||
git init
|
||||
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
git fetch --depth=1 origin "${GITHUB_SHA}"
|
||||
git checkout FETCH_HEAD
|
||||
|
||||
- name: Test the check
|
||||
run: python3 -I -m unittest discover -s scripts -p "test_check_eol_tables.py"
|
||||
|
||||
- name: Compare and file the issue
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.NIGHTLY_ALERT_TOKEN }}
|
||||
GITEA_API: ${{ github.server_url }}/api/v1
|
||||
GITEA_REPO: ${{ github.repository }}
|
||||
DRY_RUN: ${{ inputs.dry_run }}
|
||||
run: |
|
||||
if [ "$DRY_RUN" = "true" ]; then
|
||||
python3 -I scripts/check-eol-tables.py --dry-run
|
||||
else
|
||||
python3 -I scripts/check-eol-tables.py
|
||||
fi
|
||||
@@ -0,0 +1,136 @@
|
||||
{
|
||||
"source": "https://learn.microsoft.com/lifecycle/products/microsoft-net-framework and https://dotnet.microsoft.com/platform/support/policy/dotnet-core",
|
||||
"endoflife_products": [
|
||||
"dotnet",
|
||||
"dotnetfx"
|
||||
],
|
||||
"checked_on": "2026-10-05",
|
||||
"notes": "Microsoft's end of support per target framework moniker. Monikers not listed are supported (.NET Framework 4.7 to 4.8.1 follow the Windows they ship with).",
|
||||
"frameworks": [
|
||||
{
|
||||
"moniker": "net11",
|
||||
"end_of_support": "2011-07-12",
|
||||
"product": ".NET Framework 1.1"
|
||||
},
|
||||
{
|
||||
"moniker": "net20",
|
||||
"end_of_support": "2011-07-12",
|
||||
"product": ".NET Framework 2.0"
|
||||
},
|
||||
{
|
||||
"moniker": "net30",
|
||||
"end_of_support": "2011-07-12",
|
||||
"product": ".NET Framework 3.0"
|
||||
},
|
||||
{
|
||||
"moniker": "net35",
|
||||
"end_of_support": "2029-01-09",
|
||||
"product": ".NET Framework 3.5 SP1"
|
||||
},
|
||||
{
|
||||
"moniker": "net40",
|
||||
"end_of_support": "2016-01-12",
|
||||
"product": ".NET Framework 4.0"
|
||||
},
|
||||
{
|
||||
"moniker": "net403",
|
||||
"end_of_support": "2016-01-12",
|
||||
"product": ".NET Framework 4.0.3"
|
||||
},
|
||||
{
|
||||
"moniker": "net45",
|
||||
"end_of_support": "2016-01-12",
|
||||
"product": ".NET Framework 4.5"
|
||||
},
|
||||
{
|
||||
"moniker": "net451",
|
||||
"end_of_support": "2016-01-12",
|
||||
"product": ".NET Framework 4.5.1"
|
||||
},
|
||||
{
|
||||
"moniker": "net452",
|
||||
"end_of_support": "2022-04-26",
|
||||
"product": ".NET Framework 4.5.2"
|
||||
},
|
||||
{
|
||||
"moniker": "net46",
|
||||
"end_of_support": "2022-04-26",
|
||||
"product": ".NET Framework 4.6"
|
||||
},
|
||||
{
|
||||
"moniker": "net461",
|
||||
"end_of_support": "2022-04-26",
|
||||
"product": ".NET Framework 4.6.1"
|
||||
},
|
||||
{
|
||||
"moniker": "net462",
|
||||
"end_of_support": "2027-01-12",
|
||||
"product": ".NET Framework 4.6.2"
|
||||
},
|
||||
{
|
||||
"moniker": "netcoreapp1.0",
|
||||
"end_of_support": "2019-06-27",
|
||||
"product": ".NET Core 1.0"
|
||||
},
|
||||
{
|
||||
"moniker": "netcoreapp1.1",
|
||||
"end_of_support": "2019-06-27",
|
||||
"product": ".NET Core 1.1"
|
||||
},
|
||||
{
|
||||
"moniker": "netcoreapp2.0",
|
||||
"end_of_support": "2018-10-01",
|
||||
"product": ".NET Core 2.0"
|
||||
},
|
||||
{
|
||||
"moniker": "netcoreapp2.1",
|
||||
"end_of_support": "2021-08-21",
|
||||
"product": ".NET Core 2.1"
|
||||
},
|
||||
{
|
||||
"moniker": "netcoreapp2.2",
|
||||
"end_of_support": "2019-12-23",
|
||||
"product": ".NET Core 2.2"
|
||||
},
|
||||
{
|
||||
"moniker": "netcoreapp3.0",
|
||||
"end_of_support": "2020-03-03",
|
||||
"product": ".NET Core 3.0"
|
||||
},
|
||||
{
|
||||
"moniker": "netcoreapp3.1",
|
||||
"end_of_support": "2022-12-13",
|
||||
"product": ".NET Core 3.1"
|
||||
},
|
||||
{
|
||||
"moniker": "net5.0",
|
||||
"end_of_support": "2022-05-10",
|
||||
"product": ".NET 5"
|
||||
},
|
||||
{
|
||||
"moniker": "net6.0",
|
||||
"end_of_support": "2024-11-12",
|
||||
"product": ".NET 6"
|
||||
},
|
||||
{
|
||||
"moniker": "net7.0",
|
||||
"end_of_support": "2024-05-14",
|
||||
"product": ".NET 7"
|
||||
},
|
||||
{
|
||||
"moniker": "net8.0",
|
||||
"end_of_support": "2026-11-10",
|
||||
"product": ".NET 8"
|
||||
},
|
||||
{
|
||||
"moniker": "net9.0",
|
||||
"end_of_support": "2026-11-10",
|
||||
"product": ".NET 9"
|
||||
},
|
||||
{
|
||||
"moniker": "net10.0",
|
||||
"end_of_support": "2028-11-14",
|
||||
"product": ".NET 10"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"android": {
|
||||
"oldest_patched_api": 29,
|
||||
"oldest_patched_release": "Android 10",
|
||||
"endoflife_product": "android",
|
||||
"notes": "Below this API level no Android release receives security updates."
|
||||
},
|
||||
"ios": {
|
||||
"oldest_patched": "15.0",
|
||||
"endoflife_product": "ios",
|
||||
"notes": "The oldest iOS release that still receives security updates: iOS 15 got 15.8.8 in May 2026, while iOS 14 was last updated in October 2021 and the older iOS 12 line in January 2026, both now end of life (endoflife.date). Judged conservatively: below it is certainly unpatched."
|
||||
},
|
||||
"checked_on": "2026-10-05"
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
{
|
||||
"source": "https://wiki.yoctoproject.org/wiki/Releases",
|
||||
"dates_source": "https://endoflife.date/yocto",
|
||||
"endoflife_product": "yocto",
|
||||
"checked_on": "2026-10-09",
|
||||
"notes": "Codename, version, LTS and support status from the Yocto Project releases wiki (page last updated 2026-09-10). The wiki gives months only; the exact release and end-of-life days are endoflife.date's, which agree with the wiki's months except Walnascar (wiki: EOL since November 2025, endoflife.date: 2025-12-07). For Thud and older, which endoflife.date does not list, the end of life is the last day of the month of the release's last point release (wiki), and the release day the first of its month. Releases are added once they are released. Oldest first.",
|
||||
"releases": [
|
||||
{
|
||||
"codename": "jethro",
|
||||
"version": "2.0",
|
||||
"lts": false,
|
||||
"released": "2015-11-01",
|
||||
"end_of_life": "2017-01-31"
|
||||
},
|
||||
{
|
||||
"codename": "krogoth",
|
||||
"version": "2.1",
|
||||
"lts": false,
|
||||
"released": "2016-04-01",
|
||||
"end_of_life": "2017-07-31"
|
||||
},
|
||||
{
|
||||
"codename": "morty",
|
||||
"version": "2.2",
|
||||
"lts": false,
|
||||
"released": "2016-11-01",
|
||||
"end_of_life": "2018-07-31"
|
||||
},
|
||||
{
|
||||
"codename": "pyro",
|
||||
"version": "2.3",
|
||||
"lts": false,
|
||||
"released": "2017-05-01",
|
||||
"end_of_life": "2018-07-31"
|
||||
},
|
||||
{
|
||||
"codename": "rocko",
|
||||
"version": "2.4",
|
||||
"lts": false,
|
||||
"released": "2017-10-01",
|
||||
"end_of_life": "2018-11-30"
|
||||
},
|
||||
{
|
||||
"codename": "sumo",
|
||||
"version": "2.5",
|
||||
"lts": false,
|
||||
"released": "2018-04-01",
|
||||
"end_of_life": "2019-04-30"
|
||||
},
|
||||
{
|
||||
"codename": "thud",
|
||||
"version": "2.6",
|
||||
"lts": false,
|
||||
"released": "2018-11-01",
|
||||
"end_of_life": "2019-10-31"
|
||||
},
|
||||
{
|
||||
"codename": "warrior",
|
||||
"version": "2.7",
|
||||
"lts": false,
|
||||
"released": "2019-05-01",
|
||||
"end_of_life": "2020-06-01"
|
||||
},
|
||||
{
|
||||
"codename": "zeus",
|
||||
"version": "3.0",
|
||||
"lts": false,
|
||||
"released": "2019-10-22",
|
||||
"end_of_life": "2020-08-01"
|
||||
},
|
||||
{
|
||||
"codename": "dunfell",
|
||||
"version": "3.1",
|
||||
"lts": true,
|
||||
"released": "2020-04-21",
|
||||
"end_of_life": "2024-04-30"
|
||||
},
|
||||
{
|
||||
"codename": "gatesgarth",
|
||||
"version": "3.2",
|
||||
"lts": false,
|
||||
"released": "2020-11-03",
|
||||
"end_of_life": "2021-05-01"
|
||||
},
|
||||
{
|
||||
"codename": "hardknott",
|
||||
"version": "3.3",
|
||||
"lts": false,
|
||||
"released": "2021-04-19",
|
||||
"end_of_life": "2022-04-20"
|
||||
},
|
||||
{
|
||||
"codename": "honister",
|
||||
"version": "3.4",
|
||||
"lts": false,
|
||||
"released": "2021-10-25",
|
||||
"end_of_life": "2022-05-01"
|
||||
},
|
||||
{
|
||||
"codename": "kirkstone",
|
||||
"version": "4.0",
|
||||
"lts": true,
|
||||
"released": "2022-04-25",
|
||||
"end_of_life": "2026-04-27"
|
||||
},
|
||||
{
|
||||
"codename": "langdale",
|
||||
"version": "4.1",
|
||||
"lts": false,
|
||||
"released": "2022-10-23",
|
||||
"end_of_life": "2023-05-27"
|
||||
},
|
||||
{
|
||||
"codename": "mickledore",
|
||||
"version": "4.2",
|
||||
"lts": false,
|
||||
"released": "2023-05-03",
|
||||
"end_of_life": "2023-11-05"
|
||||
},
|
||||
{
|
||||
"codename": "nanbield",
|
||||
"version": "4.3",
|
||||
"lts": false,
|
||||
"released": "2023-11-09",
|
||||
"end_of_life": "2024-06-09"
|
||||
},
|
||||
{
|
||||
"codename": "scarthgap",
|
||||
"version": "5.0",
|
||||
"lts": true,
|
||||
"released": "2024-04-29",
|
||||
"end_of_life": "2028-04-30"
|
||||
},
|
||||
{
|
||||
"codename": "styhead",
|
||||
"version": "5.1",
|
||||
"lts": false,
|
||||
"released": "2024-10-16",
|
||||
"end_of_life": "2025-05-16"
|
||||
},
|
||||
{
|
||||
"codename": "walnascar",
|
||||
"version": "5.2",
|
||||
"lts": false,
|
||||
"released": "2025-05-07",
|
||||
"end_of_life": "2025-12-07"
|
||||
},
|
||||
{
|
||||
"codename": "whinlatter",
|
||||
"version": "5.3",
|
||||
"lts": false,
|
||||
"released": "2025-12-15",
|
||||
"end_of_life": "2026-06-15"
|
||||
},
|
||||
{
|
||||
"codename": "wrynose",
|
||||
"version": "6.0",
|
||||
"lts": true,
|
||||
"released": "2026-05-13",
|
||||
"end_of_life": "2030-04-30"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -22,15 +22,24 @@ use crate::pipeline::dotnet::config::{into_finding, Hit};
|
||||
/// The scanner name of these findings.
|
||||
pub const SCANNER: &str = "build-lifecycle";
|
||||
|
||||
/// Below this Android API level (Android 10) no Android release receives
|
||||
/// security updates any more.
|
||||
const OLDEST_PATCHED_ANDROID_API: u32 = 29;
|
||||
/// The oldest Android release that still receives security updates, from
|
||||
/// the bundled table (`data/eol/platforms.json`): its API level, below which
|
||||
/// no release is patched, and its name.
|
||||
fn android_floor() -> Option<(u32, &'static str)> {
|
||||
crate::pipeline::eol_tables::platforms().map(|p| {
|
||||
(
|
||||
p.android.oldest_patched_api,
|
||||
p.android.oldest_patched_release.as_str(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// The oldest iOS release that still receives security updates: iOS 15 got
|
||||
/// 15.8.8 in May 2026, while iOS 14 was last updated in October 2021 and the
|
||||
/// older iOS 12 line in January 2026, both now end of life (endoflife.date).
|
||||
/// Judged conservatively like Unity: below it is certainly unpatched.
|
||||
const OLDEST_PATCHED_IOS: (u32, u32) = (15, 0);
|
||||
/// The oldest iOS release that still receives security updates, from the
|
||||
/// bundled table (`data/eol/platforms.json`); judged conservatively: below
|
||||
/// it is certainly unpatched.
|
||||
fn ios_floor() -> Option<(u32, u32)> {
|
||||
crate::pipeline::eol_tables::platforms().and_then(|p| version_pair(&p.ios.oldest_patched))
|
||||
}
|
||||
|
||||
/// The oldest Swift language version a supported Xcode builds: Xcode 10.2
|
||||
/// dropped Swift 3 mode, and current Swift compilers accept 4, 4.2, 5 and 6.
|
||||
@@ -174,27 +183,29 @@ fn check_adt_project(root: &Path, dir: &Path) -> Vec<Hit> {
|
||||
path: path.clone(),
|
||||
line: Some(line),
|
||||
}];
|
||||
if let Some(api) = target.and_then(|(_, l)| android_api(l)) {
|
||||
if api < OLDEST_PATCHED_ANDROID_API {
|
||||
hits.push(Hit {
|
||||
scanner: SCANNER,
|
||||
scan_type: ScanType::Sbom,
|
||||
rule_id: "android-sdk-end-of-support",
|
||||
title: format!("Android API {api} receives no security updates"),
|
||||
description: format!(
|
||||
"{} builds against Android API {api}. Android releases below API \
|
||||
{OLDEST_PATCHED_ANDROID_API} (Android 10) receive no security updates, \
|
||||
so the platform the app is built for stays vulnerable.",
|
||||
relative(root, dir)
|
||||
),
|
||||
remediation: "Raise the target and minimum API level to a supported Android \
|
||||
release (after migrating the build to Gradle) and test on it.",
|
||||
severity: Severity::High,
|
||||
cwe: "CWE-1104",
|
||||
path,
|
||||
line: Some(line),
|
||||
});
|
||||
}
|
||||
let below_floor = target
|
||||
.and_then(|(_, l)| android_api(l))
|
||||
.zip(android_floor())
|
||||
.filter(|(api, (floor, _))| api < floor);
|
||||
if let Some((api, (floor, floor_name))) = below_floor {
|
||||
hits.push(Hit {
|
||||
scanner: SCANNER,
|
||||
scan_type: ScanType::Sbom,
|
||||
rule_id: "android-sdk-end-of-support",
|
||||
title: format!("Android API {api} receives no security updates"),
|
||||
description: format!(
|
||||
"{} builds against Android API {api}. Android releases below API \
|
||||
{floor} ({floor_name}) receive no security updates, so the platform the \
|
||||
app is built for stays vulnerable.",
|
||||
relative(root, dir)
|
||||
),
|
||||
remediation: "Raise the target and minimum API level to a supported Android \
|
||||
release (after migrating the build to Gradle) and test on it.",
|
||||
severity: Severity::High,
|
||||
cwe: "CWE-1104",
|
||||
path,
|
||||
line: Some(line),
|
||||
});
|
||||
}
|
||||
hits
|
||||
}
|
||||
@@ -289,8 +300,9 @@ fn ios_deployment_target(
|
||||
path: String,
|
||||
line: u32,
|
||||
) -> Option<Hit> {
|
||||
let (oldest, _) = OLDEST_PATCHED_IOS;
|
||||
((major, minor) < OLDEST_PATCHED_IOS).then(|| Hit {
|
||||
let floor = ios_floor()?;
|
||||
let (oldest, _) = floor;
|
||||
((major, minor) < floor).then(|| Hit {
|
||||
scanner: SCANNER,
|
||||
scan_type: ScanType::Sbom,
|
||||
rule_id: "ios-deployment-target-end-of-support",
|
||||
@@ -337,8 +349,13 @@ fn unity_platform_hits(root: &Path, project: &Path) -> Vec<Hit> {
|
||||
}
|
||||
let android_min = platforms.android.and_then(|p| p.min_os);
|
||||
if let Some(setting) = android_min {
|
||||
let api = setting.value.parse::<u32>().ok();
|
||||
if let Some(api) = api.filter(|api| *api < OLDEST_PATCHED_ANDROID_API) {
|
||||
let below_floor = setting
|
||||
.value
|
||||
.parse::<u32>()
|
||||
.ok()
|
||||
.zip(android_floor())
|
||||
.filter(|(api, (floor, _))| api < floor);
|
||||
if let Some((api, (floor, floor_name))) = below_floor {
|
||||
hits.push(Hit {
|
||||
scanner: SCANNER,
|
||||
scan_type: ScanType::Sbom,
|
||||
@@ -349,7 +366,7 @@ fn unity_platform_hits(root: &Path, project: &Path) -> Vec<Hit> {
|
||||
description: format!(
|
||||
"{label} sets its minimum Android API level to {api}: the app installs and \
|
||||
runs on devices still on that release. Android releases below API \
|
||||
{OLDEST_PATCHED_ANDROID_API} (Android 10) receive no security updates, so \
|
||||
{floor} ({floor_name}) receive no security updates, so \
|
||||
those devices stay vulnerable whatever the app does. The app also runs on \
|
||||
current Android releases."
|
||||
),
|
||||
|
||||
@@ -295,52 +295,15 @@ pub fn runtime_of(moniker: &str) -> Option<Runtime> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Microsoft's end of support for each target framework that has one, as an
|
||||
/// ISO date and the name customers know it by. Versions not listed are
|
||||
/// supported (.NET Framework 4.8 and 4.8.1 follow the Windows they ship with).
|
||||
///
|
||||
/// Sources: the .NET Framework and .NET lifecycle pages on
|
||||
/// learn.microsoft.com (.NET Framework 4.5.2, 4.6 and 4.6.1 ended
|
||||
/// 2022-04-26, 4.6.2 ends 2027-01-12; .NET 8 and .NET 9 end 2026-11-10).
|
||||
const END_OF_SUPPORT: &[(&str, &str, &str)] = &[
|
||||
("net11", "2011-07-12", ".NET Framework 1.1"),
|
||||
("net20", "2011-07-12", ".NET Framework 2.0"),
|
||||
("net30", "2011-07-12", ".NET Framework 3.0"),
|
||||
("net35", "2029-01-09", ".NET Framework 3.5 SP1"),
|
||||
("net40", "2016-01-12", ".NET Framework 4.0"),
|
||||
("net403", "2016-01-12", ".NET Framework 4.0.3"),
|
||||
("net45", "2016-01-12", ".NET Framework 4.5"),
|
||||
("net451", "2016-01-12", ".NET Framework 4.5.1"),
|
||||
("net452", "2022-04-26", ".NET Framework 4.5.2"),
|
||||
("net46", "2022-04-26", ".NET Framework 4.6"),
|
||||
("net461", "2022-04-26", ".NET Framework 4.6.1"),
|
||||
("net462", "2027-01-12", ".NET Framework 4.6.2"),
|
||||
("netcoreapp1.0", "2019-06-27", ".NET Core 1.0"),
|
||||
("netcoreapp1.1", "2019-06-27", ".NET Core 1.1"),
|
||||
("netcoreapp2.0", "2018-10-01", ".NET Core 2.0"),
|
||||
("netcoreapp2.1", "2021-08-21", ".NET Core 2.1"),
|
||||
("netcoreapp2.2", "2019-12-23", ".NET Core 2.2"),
|
||||
("netcoreapp3.0", "2020-03-03", ".NET Core 3.0"),
|
||||
("netcoreapp3.1", "2022-12-13", ".NET Core 3.1"),
|
||||
("net5.0", "2022-05-10", ".NET 5"),
|
||||
("net6.0", "2024-11-12", ".NET 6"),
|
||||
("net7.0", "2024-05-14", ".NET 7"),
|
||||
("net8.0", "2026-11-10", ".NET 8"),
|
||||
("net9.0", "2026-11-10", ".NET 9"),
|
||||
("net10.0", "2028-11-14", ".NET 10"),
|
||||
];
|
||||
|
||||
/// When `moniker` lost (or loses) Microsoft's support, and its product name.
|
||||
/// `None` for a version without an announced end, or one not known here.
|
||||
/// When `moniker` lost (or loses) Microsoft's support, and its product name,
|
||||
/// from the bundled table (`data/eol/dotnet.json`). `None` for a version
|
||||
/// without an announced end (.NET Framework 4.7 to 4.8.1 follow the Windows
|
||||
/// they ship with), or one not known here.
|
||||
pub fn end_of_support(moniker: &str) -> Option<(chrono::NaiveDate, &'static str)> {
|
||||
END_OF_SUPPORT
|
||||
crate::pipeline::eol_tables::dotnet_frameworks()
|
||||
.iter()
|
||||
.find(|(m, _, _)| *m == moniker)
|
||||
.and_then(|(_, date, name)| {
|
||||
chrono::NaiveDate::parse_from_str(date, "%Y-%m-%d")
|
||||
.ok()
|
||||
.map(|d| (d, *name))
|
||||
})
|
||||
.find(|f| f.moniker == moniker)
|
||||
.map(|f| (f.end_of_support, f.product.as_str()))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
//! The end-of-life tables the lifecycle checks judge by, bundled from
|
||||
//! `compliance-agent/data/eol/*.json`.
|
||||
//!
|
||||
//! The JSON files are the one place the tables live: the agent compiles them
|
||||
//! in here, and the weekly CI check (`scripts/check-eol-tables.py`) compares
|
||||
//! them with endoflife.date and files an issue when they drift.
|
||||
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use serde::Deserialize;
|
||||
|
||||
/// One Yocto Project release.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
|
||||
pub struct YoctoReleaseInfo {
|
||||
/// The codename, lower case.
|
||||
pub codename: String,
|
||||
/// The Yocto Project version.
|
||||
pub version: String,
|
||||
/// A long term support release.
|
||||
pub lts: bool,
|
||||
/// Its release day.
|
||||
pub released: NaiveDate,
|
||||
/// The day its support ends (or ended).
|
||||
pub end_of_life: NaiveDate,
|
||||
}
|
||||
|
||||
/// The Yocto release table and where it comes from.
|
||||
#[derive(Debug, Clone, Default, Deserialize)]
|
||||
pub struct YoctoTable {
|
||||
/// The primary source (the Yocto Project releases wiki).
|
||||
pub source: String,
|
||||
/// When the table was last checked against its sources (`YYYY-MM-DD`).
|
||||
pub checked_on: String,
|
||||
/// The releases, oldest first.
|
||||
pub releases: Vec<YoctoReleaseInfo>,
|
||||
}
|
||||
|
||||
/// Microsoft's end of support for one target framework moniker.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
|
||||
pub struct DotnetFramework {
|
||||
/// The moniker (`net452`, `netcoreapp3.1`, `net8.0`).
|
||||
pub moniker: String,
|
||||
/// The day support ends (or ended).
|
||||
pub end_of_support: NaiveDate,
|
||||
/// The name customers know it by.
|
||||
pub product: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize)]
|
||||
struct DotnetTable {
|
||||
frameworks: Vec<DotnetFramework>,
|
||||
}
|
||||
|
||||
/// The oldest Android release that still gets security updates.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct AndroidFloor {
|
||||
/// Its API level: below it no release is patched.
|
||||
pub oldest_patched_api: u32,
|
||||
/// Its name (`Android 10`).
|
||||
pub oldest_patched_release: String,
|
||||
}
|
||||
|
||||
/// The oldest iOS release that still gets security updates.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct IosFloor {
|
||||
/// `major.minor`.
|
||||
pub oldest_patched: String,
|
||||
}
|
||||
|
||||
/// The platform floors.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct Platforms {
|
||||
/// Android.
|
||||
pub android: AndroidFloor,
|
||||
/// iOS.
|
||||
pub ios: IosFloor,
|
||||
}
|
||||
|
||||
const YOCTO_JSON: &str = include_str!("../../data/eol/yocto.json");
|
||||
const DOTNET_JSON: &str = include_str!("../../data/eol/dotnet.json");
|
||||
const PLATFORMS_JSON: &str = include_str!("../../data/eol/platforms.json");
|
||||
|
||||
/// `text` (the bundled file `name`) parsed; logged and `None` when it does
|
||||
/// not parse, which the tests below rule out for the files shipped.
|
||||
fn parse<T: for<'de> Deserialize<'de>>(name: &str, text: &str) -> Option<T> {
|
||||
serde_json::from_str(text)
|
||||
.map_err(|e| tracing::error!(file = name, "bundled end-of-life table does not parse: {e}"))
|
||||
.ok()
|
||||
}
|
||||
|
||||
static YOCTO: LazyLock<YoctoTable> =
|
||||
LazyLock::new(|| parse("yocto.json", YOCTO_JSON).unwrap_or_default());
|
||||
static DOTNET: LazyLock<DotnetTable> =
|
||||
LazyLock::new(|| parse("dotnet.json", DOTNET_JSON).unwrap_or_default());
|
||||
static PLATFORMS: LazyLock<Option<Platforms>> =
|
||||
LazyLock::new(|| parse("platforms.json", PLATFORMS_JSON));
|
||||
|
||||
/// The Yocto release table.
|
||||
pub fn yocto() -> &'static YoctoTable {
|
||||
&YOCTO
|
||||
}
|
||||
|
||||
/// The .NET target frameworks with an end of support.
|
||||
pub fn dotnet_frameworks() -> &'static [DotnetFramework] {
|
||||
&DOTNET.frameworks
|
||||
}
|
||||
|
||||
/// The Android and iOS floors; `None` only if the bundled file does not
|
||||
/// parse, and then no platform is judged.
|
||||
pub fn platforms() -> Option<&'static Platforms> {
|
||||
PLATFORMS.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::expect_used, clippy::unwrap_used)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn every_bundled_table_parses() {
|
||||
let yocto: YoctoTable = serde_json::from_str(YOCTO_JSON).expect("yocto.json");
|
||||
assert!(!yocto.releases.is_empty());
|
||||
assert!(NaiveDate::parse_from_str(&yocto.checked_on, "%Y-%m-%d").is_ok());
|
||||
let dotnet: DotnetTable = serde_json::from_str(DOTNET_JSON).expect("dotnet.json");
|
||||
assert!(!dotnet.frameworks.is_empty());
|
||||
let platforms: Platforms = serde_json::from_str(PLATFORMS_JSON).expect("platforms.json");
|
||||
assert!(platforms.android.oldest_patched_api > 0);
|
||||
assert!(platforms.ios.oldest_patched.contains('.'));
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ pub mod dedup;
|
||||
pub mod devskim;
|
||||
pub mod dotnet;
|
||||
pub mod embedded_versions;
|
||||
pub mod eol_tables;
|
||||
pub mod finding_store;
|
||||
pub mod firmware_sbom;
|
||||
pub mod git;
|
||||
|
||||
@@ -17,123 +17,20 @@ pub const RULE_EOL: &str = "yocto-release-eol";
|
||||
/// The rule of a release whose end of life is near: within six months for an
|
||||
/// LTS release, two for any other ([`soon_window`]).
|
||||
pub const RULE_EOL_SOON: &str = "yocto-release-eol-soon";
|
||||
/// Where the support periods come from.
|
||||
pub const SOURCE_URL: &str = "https://wiki.yoctoproject.org/wiki/Releases";
|
||||
/// When [`RELEASES`] was checked against its sources.
|
||||
pub const CHECKED_ON: &str = "2026-10-09";
|
||||
|
||||
/// One Yocto Project release.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct ReleaseInfo {
|
||||
/// The codename, lower case.
|
||||
pub codename: &'static str,
|
||||
/// The Yocto Project version.
|
||||
pub version: &'static str,
|
||||
/// A long term support release.
|
||||
pub lts: bool,
|
||||
/// Its release day.
|
||||
pub released: NaiveDate,
|
||||
/// The day its support ends (or ended).
|
||||
pub end_of_life: NaiveDate,
|
||||
}
|
||||
|
||||
/// A day of the table; every date in it is valid, a test checks them.
|
||||
const fn day(y: i32, m: u32, d: u32) -> NaiveDate {
|
||||
match NaiveDate::from_ymd_opt(y, m, d) {
|
||||
Some(date) => date,
|
||||
None => NaiveDate::MIN,
|
||||
}
|
||||
}
|
||||
|
||||
const fn release(
|
||||
codename: &'static str,
|
||||
version: &'static str,
|
||||
lts: bool,
|
||||
released: NaiveDate,
|
||||
end_of_life: NaiveDate,
|
||||
) -> ReleaseInfo {
|
||||
ReleaseInfo {
|
||||
codename,
|
||||
version,
|
||||
lts,
|
||||
released,
|
||||
end_of_life,
|
||||
}
|
||||
}
|
||||
/// The bundled release table (`data/eol/yocto.json`): sources and check date
|
||||
/// in the file, which the weekly CI check compares with endoflife.date.
|
||||
pub use crate::pipeline::eol_tables::YoctoReleaseInfo as ReleaseInfo;
|
||||
|
||||
/// The Yocto Project releases, oldest first.
|
||||
///
|
||||
/// Source: the Yocto Project releases wiki, <https://wiki.yoctoproject.org/wiki/Releases>
|
||||
/// (page last updated 2026-09-10), checked on 2026-10-09: codename, version,
|
||||
/// LTS and support status. The wiki gives months only; the exact release and
|
||||
/// end-of-life days are endoflife.date's (<https://endoflife.date/yocto>,
|
||||
/// checked the same day), which agree with the wiki's months except
|
||||
/// Walnascar (wiki: "EOL since November 2025", endoflife.date: 2025-12-07).
|
||||
/// For Thud and older, which endoflife.date does not list, the end of life
|
||||
/// is the last day of the month of the release's last point release (wiki),
|
||||
/// and the release day the first of its month. Blacksail (6.1, due October
|
||||
/// 2026) is not released yet and not listed: a newer branch reads as an
|
||||
/// unknown release.
|
||||
pub const RELEASES: &[ReleaseInfo] = &[
|
||||
release("jethro", "2.0", false, day(2015, 11, 1), day(2017, 1, 31)),
|
||||
release("krogoth", "2.1", false, day(2016, 4, 1), day(2017, 7, 31)),
|
||||
release("morty", "2.2", false, day(2016, 11, 1), day(2018, 7, 31)),
|
||||
release("pyro", "2.3", false, day(2017, 5, 1), day(2018, 7, 31)),
|
||||
release("rocko", "2.4", false, day(2017, 10, 1), day(2018, 11, 30)),
|
||||
release("sumo", "2.5", false, day(2018, 4, 1), day(2019, 4, 30)),
|
||||
release("thud", "2.6", false, day(2018, 11, 1), day(2019, 10, 31)),
|
||||
release("warrior", "2.7", false, day(2019, 5, 1), day(2020, 6, 1)),
|
||||
release("zeus", "3.0", false, day(2019, 10, 22), day(2020, 8, 1)),
|
||||
release("dunfell", "3.1", true, day(2020, 4, 21), day(2024, 4, 30)),
|
||||
release(
|
||||
"gatesgarth",
|
||||
"3.2",
|
||||
false,
|
||||
day(2020, 11, 3),
|
||||
day(2021, 5, 1),
|
||||
),
|
||||
release(
|
||||
"hardknott",
|
||||
"3.3",
|
||||
false,
|
||||
day(2021, 4, 19),
|
||||
day(2022, 4, 20),
|
||||
),
|
||||
release("honister", "3.4", false, day(2021, 10, 25), day(2022, 5, 1)),
|
||||
release("kirkstone", "4.0", true, day(2022, 4, 25), day(2026, 4, 27)),
|
||||
release(
|
||||
"langdale",
|
||||
"4.1",
|
||||
false,
|
||||
day(2022, 10, 23),
|
||||
day(2023, 5, 27),
|
||||
),
|
||||
release(
|
||||
"mickledore",
|
||||
"4.2",
|
||||
false,
|
||||
day(2023, 5, 3),
|
||||
day(2023, 11, 5),
|
||||
),
|
||||
release("nanbield", "4.3", false, day(2023, 11, 9), day(2024, 6, 9)),
|
||||
release("scarthgap", "5.0", true, day(2024, 4, 29), day(2028, 4, 30)),
|
||||
release("styhead", "5.1", false, day(2024, 10, 16), day(2025, 5, 16)),
|
||||
release("walnascar", "5.2", false, day(2025, 5, 7), day(2025, 12, 7)),
|
||||
release(
|
||||
"whinlatter",
|
||||
"5.3",
|
||||
false,
|
||||
day(2025, 12, 15),
|
||||
day(2026, 6, 15),
|
||||
),
|
||||
release("wrynose", "6.0", true, day(2026, 5, 13), day(2030, 4, 30)),
|
||||
];
|
||||
fn releases() -> &'static [ReleaseInfo] {
|
||||
&crate::pipeline::eol_tables::yocto().releases
|
||||
}
|
||||
|
||||
/// The repositories whose branch names the release, most telling first.
|
||||
const RELEASE_REPOS: &[&str] = &["poky", "openembedded-core", "meta-openembedded"];
|
||||
|
||||
fn by_codename(codename: &str) -> Option<&'static ReleaseInfo> {
|
||||
RELEASES.iter().find(|r| r.codename == codename)
|
||||
releases().iter().find(|r| r.codename == codename)
|
||||
}
|
||||
|
||||
/// The release a branch or tag names: a codename as one of its words
|
||||
@@ -150,7 +47,7 @@ pub(crate) fn from_reference(reference: &str) -> Option<&'static ReleaseInfo> {
|
||||
let version = lower.rsplit('/').next()?.strip_prefix("yocto-")?;
|
||||
let mut parts = version.split('.');
|
||||
let major_minor = format!("{}.{}", parts.next()?, parts.next()?);
|
||||
RELEASES.iter().find(|r| r.version == major_minor)
|
||||
releases().iter().find(|r| r.version == major_minor)
|
||||
}
|
||||
|
||||
/// The newest of `codenames` the table knows.
|
||||
@@ -195,8 +92,8 @@ fn conf_of(layer: &Layer) -> String {
|
||||
/// `None` when none of them names a release the table knows.
|
||||
pub(crate) fn derive(pins: &[LayerPin], layers: &[Layer]) -> Option<YoctoRelease> {
|
||||
let make = |info: &ReleaseInfo, basis: ReleaseBasis, file: String| YoctoRelease {
|
||||
codename: info.codename.to_string(),
|
||||
version: info.version.to_string(),
|
||||
codename: info.codename.clone(),
|
||||
version: info.version.clone(),
|
||||
lts: info.lts,
|
||||
end_of_life: info.end_of_life,
|
||||
basis,
|
||||
@@ -236,7 +133,7 @@ pub(crate) fn derive(pins: &[LayerPin], layers: &[Layer]) -> Option<YoctoRelease
|
||||
/// The newest LTS release on `today` whose end of life is not yet soon.
|
||||
fn current_lts(today: NaiveDate) -> Option<&'static ReleaseInfo> {
|
||||
let horizon = today.checked_add_months(soon_window(true))?;
|
||||
RELEASES
|
||||
releases()
|
||||
.iter()
|
||||
.filter(|r| r.lts && r.released <= today && r.end_of_life > horizon)
|
||||
.max_by_key(|r| r.released)
|
||||
@@ -280,7 +177,7 @@ pub(crate) fn finding(repo_id: &str, release: &YoctoRelease, today: NaiveDate) -
|
||||
let eol = release.end_of_life;
|
||||
let description = format!(
|
||||
"The layers build Yocto {name} ({version}{lts}), read from {basis}. The Yocto Project \
|
||||
{status} {eol} (source: {SOURCE_URL}, checked {CHECKED_ON}). After that, no security \
|
||||
{status} {eol} (source: {source}, checked {checked}). After that, no security \
|
||||
fixes are published for its recipes, so vulnerabilities in the image's components \
|
||||
stay open unless every fix is backported by hand.\n\nCRA Annex I Part I (2)(c): \
|
||||
vulnerabilities can be addressed through security updates; Annex I Part II (2): \
|
||||
@@ -288,6 +185,8 @@ pub(crate) fn finding(repo_id: &str, release: &YoctoRelease, today: NaiveDate) -
|
||||
the product's support period.",
|
||||
version = release.version,
|
||||
basis = basis_text(&release.basis, &release.file),
|
||||
source = crate::pipeline::eol_tables::yocto().source,
|
||||
checked = crate::pipeline::eol_tables::yocto().checked_on,
|
||||
);
|
||||
let remediation = match current_lts(today) {
|
||||
Some(lts) if lts.codename != release.codename => format!(
|
||||
@@ -296,7 +195,7 @@ pub(crate) fn finding(repo_id: &str, release: &YoctoRelease, today: NaiveDate) -
|
||||
layers to its branch, and LAYERSERIES_COMPAT of your layers. Until then, \
|
||||
backport the security fixes the product needs and record them (CVE_STATUS, \
|
||||
patches).",
|
||||
display_codename(lts.codename),
|
||||
display_codename(<s.codename),
|
||||
lts.version,
|
||||
lts.end_of_life
|
||||
),
|
||||
@@ -356,10 +255,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn the_table_is_ordered_and_names_the_required_releases() {
|
||||
assert!(RELEASES.iter().all(|r| r.released != NaiveDate::MIN
|
||||
&& r.end_of_life != NaiveDate::MIN
|
||||
&& r.released < r.end_of_life));
|
||||
assert!(RELEASES.windows(2).all(|w| w[0].released < w[1].released));
|
||||
assert!(releases().iter().all(|r| r.released < r.end_of_life));
|
||||
assert!(releases().windows(2).all(|w| w[0].released < w[1].released));
|
||||
for codename in [
|
||||
"dunfell",
|
||||
"kirkstone",
|
||||
@@ -373,12 +270,11 @@ mod tests {
|
||||
] {
|
||||
assert!(by_codename(codename).is_some(), "{codename}");
|
||||
}
|
||||
assert_eq!(date(2026, 10, 9).to_string(), CHECKED_ON);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn branches_and_tags_name_their_release() {
|
||||
let codename = |r: &str| from_reference(r).map(|i| i.codename);
|
||||
let codename = |r: &str| from_reference(r).map(|i| i.codename.as_str());
|
||||
assert_eq!(codename("scarthgap"), Some("scarthgap"));
|
||||
assert_eq!(codename("scarthgap-5.0.3"), Some("scarthgap"));
|
||||
assert_eq!(codename("yocto-5.0.3"), Some("scarthgap"));
|
||||
@@ -457,7 +353,7 @@ mod tests {
|
||||
let info = by_codename(codename).expect("known");
|
||||
YoctoRelease {
|
||||
codename: codename.into(),
|
||||
version: info.version.into(),
|
||||
version: info.version.clone(),
|
||||
lts: info.lts,
|
||||
end_of_life: info.end_of_life,
|
||||
basis: ReleaseBasis::Pin {
|
||||
@@ -484,7 +380,9 @@ mod tests {
|
||||
assert!(f
|
||||
.description
|
||||
.contains("\"dunfell\" that kas.yml pins poky to"));
|
||||
assert!(f.description.contains(SOURCE_URL));
|
||||
assert!(f
|
||||
.description
|
||||
.contains("https://wiki.yoctoproject.org/wiki/Releases"));
|
||||
assert!(f.description.contains("Annex I Part I (2)(c)"));
|
||||
assert!(f.description.contains("Part II"));
|
||||
assert_eq!(f.file_path.as_deref(), Some("kas.yml"));
|
||||
|
||||
@@ -93,7 +93,9 @@ Then restore once (`dotnet restore`, or in Visual Studio) and commit the
|
||||
Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1; .NET Core 3.1; .NET 5, 6, 7) is
|
||||
a finding (CWE-1104, CRA requirement dependency monitoring `cra-ai-22`). .NET
|
||||
Framework 4.6.2 ends on 2027-01-12, .NET 8 and 9 on 2026-11-10; the scan
|
||||
reports them from then on.
|
||||
reports them from then on. The dates are bundled
|
||||
(`compliance-agent/data/eol/dotnet.json`); a weekly check compares them with
|
||||
endoflife.date and opens an issue when they differ.
|
||||
|
||||
**C# code (our own Semgrep rules):** SQL built by concatenation, interpolation
|
||||
or `String.Format` (CWE-89), `Process.Start` with a composed command line
|
||||
|
||||
@@ -97,7 +97,9 @@ ohne Sicherheitsupdates von Microsoft anspricht (z. B. .NET Framework 4.0,
|
||||
4.5, 4.5.1, 4.5.2, 4.6, 4.6.1; .NET Core 3.1; .NET 5, 6, 7), ist ein Befund
|
||||
(CWE-1104, CRA-Anforderung Dependency-Monitoring `cra-ai-22`). .NET Framework
|
||||
4.6.2 endet am 12.01.2027, .NET 8 und 9 am 10.11.2026; danach meldet die
|
||||
Prüfung auch sie.
|
||||
Prüfung auch sie. Die Daten liegen Prüfwerk bei
|
||||
(`compliance-agent/data/eol/dotnet.json`); eine wöchentliche Prüfung gleicht
|
||||
sie mit endoflife.date ab und legt bei Abweichungen ein Issue an.
|
||||
|
||||
**C#-Code (eigene Semgrep-Regeln).**
|
||||
|
||||
|
||||
+4
-3
@@ -151,7 +151,7 @@ the current long term support release (the newest LTS supported for more than
|
||||
six months on the scan's date). It is CWE-1104 (unmaintained third-party
|
||||
components).
|
||||
|
||||
**The release table** (in `compliance-agent/src/pipeline/yocto_pins/release.rs`)
|
||||
**The release table** (`compliance-agent/data/eol/yocto.json`)
|
||||
is taken from the [Yocto Project releases wiki](https://wiki.yoctoproject.org/wiki/Releases)
|
||||
(page last updated 2026-09-10), checked on **2026-10-09**. The wiki gives
|
||||
months; the exact days are [endoflife.date's](https://endoflife.date/yocto),
|
||||
@@ -178,8 +178,9 @@ Thud and older the end of life is the month of the last point release.
|
||||
| Wrynose | 6.0 | yes | 2026-05-13 | 2030-04-30 |
|
||||
|
||||
Blacksail (6.1, due October 2026) is not in the table until it is released; a
|
||||
layer on it reads as an unknown release. The table is updated by hand with
|
||||
each Yocto release.
|
||||
layer on it reads as an unknown release. The table is updated by hand; a
|
||||
weekly check compares it with endoflife.date and opens an issue labelled
|
||||
`eol-tables` when a release is added or a date changes.
|
||||
|
||||
## Recipe inventory
|
||||
|
||||
|
||||
@@ -0,0 +1,283 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare the bundled end-of-life tables with endoflife.date.
|
||||
|
||||
The tables in compliance-agent/data/eol/ are what the lifecycle findings
|
||||
judge by (Yocto releases, .NET target frameworks, the oldest patched Android
|
||||
and iOS releases). This script fetches the matching endoflife.date products
|
||||
and lists every difference: a release endoflife.date has and the table does
|
||||
not, a changed release or end-of-life date, a changed LTS flag, a moved
|
||||
platform floor.
|
||||
|
||||
With differences it opens one Gitea issue, or updates the open one (found by
|
||||
its title), labelled "eol-tables". It never edits the tables: someone checks
|
||||
the difference against the vendor's own page and updates the JSON.
|
||||
|
||||
Usage:
|
||||
check-eol-tables.py [--data-dir DIR] [--dry-run]
|
||||
|
||||
Environment (not needed with --dry-run):
|
||||
GITEA_TOKEN a token with issue write access on the repository
|
||||
GITEA_API the API base, e.g. https://git.breakpilot.com/api/v1
|
||||
GITEA_REPO owner/name, e.g. platform/pruefwerk
|
||||
|
||||
Exit status: 0 when the check ran (with or without differences), 1 when a
|
||||
source could not be read or the issue could not be written.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import datetime as dt
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
ENDOFLIFE_API = "https://endoflife.date/api/{product}.json"
|
||||
ISSUE_TITLE = "[eol-tables] Bundled end-of-life tables differ from endoflife.date"
|
||||
LABEL = "eol-tables"
|
||||
LABEL_COLOR = "fbca04"
|
||||
TIMEOUT = 30
|
||||
|
||||
Cycle = dict[str, Any]
|
||||
|
||||
|
||||
def fetch_json(url: str, token: str | None = None, method: str = "GET",
|
||||
body: Any = None) -> Any:
|
||||
"""GET (or send) JSON; raises on an HTTP or network error."""
|
||||
data = None if body is None else json.dumps(body).encode()
|
||||
request = urllib.request.Request(url, data=data, method=method)
|
||||
request.add_header("Accept", "application/json")
|
||||
request.add_header("User-Agent", "pruefwerk-eol-check")
|
||||
if data is not None:
|
||||
request.add_header("Content-Type", "application/json")
|
||||
if token:
|
||||
request.add_header("Authorization", f"token {token}")
|
||||
with urllib.request.urlopen(request, timeout=TIMEOUT) as response:
|
||||
text = response.read().decode()
|
||||
return json.loads(text) if text.strip() else None
|
||||
|
||||
|
||||
def cycles(product: str) -> list[Cycle]:
|
||||
"""The release cycles endoflife.date lists for `product`."""
|
||||
found: list[Cycle] = fetch_json(ENDOFLIFE_API.format(product=product))
|
||||
return found
|
||||
|
||||
|
||||
def eol_date(cycle: Cycle) -> str | None:
|
||||
"""The cycle's end of life as YYYY-MM-DD, None when it has no date."""
|
||||
eol = cycle.get("eol")
|
||||
return eol if isinstance(eol, str) else None
|
||||
|
||||
|
||||
def is_supported(cycle: Cycle, today: dt.date) -> bool:
|
||||
"""Whether the cycle still gets security updates on `today`."""
|
||||
eol = cycle.get("eol")
|
||||
if isinstance(eol, bool):
|
||||
return not eol
|
||||
return isinstance(eol, str) and dt.date.fromisoformat(eol) >= today
|
||||
|
||||
|
||||
def compare_yocto(table: dict[str, Any], upstream: list[Cycle]) -> list[str]:
|
||||
"""Differences between the bundled Yocto releases and endoflife.date."""
|
||||
bundled = {r["codename"]: r for r in table["releases"]}
|
||||
out: list[str] = []
|
||||
for cycle in upstream:
|
||||
codename = str(cycle.get("codename", "")).lower()
|
||||
mine = bundled.get(codename)
|
||||
name = f"Yocto {cycle.get('codename')} ({cycle['cycle']})"
|
||||
if mine is None:
|
||||
out.append(f"{name}: on endoflife.date (released {cycle.get('releaseDate')}, "
|
||||
f"end of life {cycle.get('eol')}), not in the table")
|
||||
continue
|
||||
checks = [
|
||||
("version", mine["version"], cycle["cycle"]),
|
||||
("LTS", mine["lts"], bool(cycle.get("lts"))),
|
||||
("release date", mine["released"], cycle.get("releaseDate")),
|
||||
("end of life", mine["end_of_life"], eol_date(cycle)),
|
||||
]
|
||||
out.extend(f"{name}: {what} is {theirs} on endoflife.date, {ours} in the table"
|
||||
for what, ours, theirs in checks if ours != theirs)
|
||||
return out
|
||||
|
||||
|
||||
def dotnet_cycle(moniker: str) -> tuple[str, str] | None:
|
||||
"""The endoflife.date product and cycle of a target framework moniker."""
|
||||
if moniker.startswith("netcoreapp"):
|
||||
return "dotnet", moniker.removeprefix("netcoreapp")
|
||||
rest = moniker.removeprefix("net")
|
||||
if "." in rest:
|
||||
return "dotnet", rest.split(".")[0]
|
||||
if rest == "35":
|
||||
return "dotnetfx", "3.5-sp1"
|
||||
if rest in ("11", "20", "30"):
|
||||
# .NET Framework 1.1 to 3.0 are not on endoflife.date.
|
||||
return None
|
||||
return "dotnetfx", ".".join(rest)
|
||||
|
||||
|
||||
def compare_dotnet(table: dict[str, Any], upstream: dict[str, list[Cycle]]) -> list[str]:
|
||||
"""Differences between the bundled .NET table and endoflife.date."""
|
||||
out: list[str] = []
|
||||
bundled: dict[tuple[str, str], dict[str, Any]] = {}
|
||||
for framework in table["frameworks"]:
|
||||
key = dotnet_cycle(framework["moniker"])
|
||||
if key is not None:
|
||||
bundled.setdefault(key, framework)
|
||||
for product, product_cycles in upstream.items():
|
||||
for cycle in product_cycles:
|
||||
mine = bundled.get((product, cycle["cycle"]))
|
||||
theirs = eol_date(cycle)
|
||||
label = f"{product} {cycle['cycle']}"
|
||||
if mine is None:
|
||||
if theirs is not None:
|
||||
out.append(f"{label}: end of support {theirs} on endoflife.date, "
|
||||
"not in the table")
|
||||
elif mine["end_of_support"] != theirs:
|
||||
out.append(f"{label} ({mine['moniker']}): end of support is {theirs} on "
|
||||
f"endoflife.date, {mine['end_of_support']} in the table")
|
||||
return out
|
||||
|
||||
|
||||
def oldest_supported(product_cycles: list[Cycle], today: dt.date, key: str) -> int | None:
|
||||
"""The smallest `key` (as a whole number) of the cycles still supported."""
|
||||
values = [int(float(c[key])) for c in product_cycles
|
||||
if c.get(key) is not None and is_supported(c, today)]
|
||||
return min(values) if values else None
|
||||
|
||||
|
||||
def compare_platforms(table: dict[str, Any], android: list[Cycle], ios: list[Cycle],
|
||||
today: dt.date) -> list[str]:
|
||||
"""Differences between the bundled platform floors and endoflife.date."""
|
||||
out: list[str] = []
|
||||
api = oldest_supported(android, today, "apiVersion")
|
||||
ours = table["android"]["oldest_patched_api"]
|
||||
if api is not None and api != ours:
|
||||
out.append(f"Android: the oldest release with security updates is API {api} on "
|
||||
f"endoflife.date, API {ours} in the table")
|
||||
major = oldest_supported(ios, today, "cycle")
|
||||
ours_ios = int(table["ios"]["oldest_patched"].split(".")[0])
|
||||
if major is not None and major != ours_ios:
|
||||
out.append(f"iOS: the oldest release with security updates is iOS {major} on "
|
||||
f"endoflife.date, iOS {ours_ios} in the table")
|
||||
return out
|
||||
|
||||
|
||||
def load(data_dir: Path, name: str) -> dict[str, Any]:
|
||||
"""A bundled table."""
|
||||
table: dict[str, Any] = json.loads((data_dir / name).read_text())
|
||||
return table
|
||||
|
||||
|
||||
def differences(data_dir: Path, today: dt.date) -> dict[str, list[str]]:
|
||||
"""Every difference, by table file."""
|
||||
dotnet = load(data_dir, "dotnet.json")
|
||||
platforms = load(data_dir, "platforms.json")
|
||||
return {
|
||||
"yocto.json": compare_yocto(load(data_dir, "yocto.json"), cycles("yocto")),
|
||||
"dotnet.json": compare_dotnet(
|
||||
dotnet, {p: cycles(p) for p in dotnet["endoflife_products"]}),
|
||||
"platforms.json": compare_platforms(
|
||||
platforms, cycles(platforms["android"]["endoflife_product"]),
|
||||
cycles(platforms["ios"]["endoflife_product"]), today),
|
||||
}
|
||||
|
||||
|
||||
def issue_body(diff: dict[str, list[str]], today: dt.date) -> str:
|
||||
"""The issue text for `diff`."""
|
||||
lines = [
|
||||
"The weekly check (`scripts/check-eol-tables.py`) found the bundled end-of-life "
|
||||
"tables in `compliance-agent/data/eol/` differ from endoflife.date. Check each "
|
||||
"against the vendor's own page, update the JSON (and its `checked_on`), and "
|
||||
"close this issue with that PR.",
|
||||
"",
|
||||
]
|
||||
for file, found in diff.items():
|
||||
if found:
|
||||
lines.append(f"### `{file}`")
|
||||
lines.extend(f"- {line}" for line in found)
|
||||
lines.append("")
|
||||
lines.append(f"Last checked: {today.isoformat()}")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def without_check_date(body: str) -> str:
|
||||
"""`body` without its "Last checked" line, to see whether the diff changed."""
|
||||
return "\n".join(
|
||||
line for line in body.splitlines() if not line.startswith("Last checked:"))
|
||||
|
||||
|
||||
def label_id(api: str, token: str) -> int | None:
|
||||
"""The id of the issue label, created if missing; None if that fails."""
|
||||
try:
|
||||
labels = fetch_json(f"{api}/labels?limit=100", token)
|
||||
found = next((label["id"] for label in labels if label["name"] == LABEL), None)
|
||||
if found is not None:
|
||||
return int(found)
|
||||
created = fetch_json(f"{api}/labels", token, "POST",
|
||||
{"name": LABEL, "color": f"#{LABEL_COLOR}",
|
||||
"description": "Bundled end-of-life tables need an update"})
|
||||
return int(created["id"])
|
||||
except urllib.error.URLError as error:
|
||||
print(f"::warning::label {LABEL} not available ({error}); the issue is unlabelled")
|
||||
return None
|
||||
|
||||
|
||||
def file_issue(body: str, token: str, api_base: str, repo: str) -> None:
|
||||
"""Open the issue, or update the open one when the differences changed."""
|
||||
api = f"{api_base.rstrip('/')}/repos/{repo}"
|
||||
query = urllib.parse.quote(ISSUE_TITLE)
|
||||
open_issues = fetch_json(f"{api}/issues?state=open&type=issues&q={query}", token)
|
||||
existing = next((i for i in open_issues if i["title"] == ISSUE_TITLE), None)
|
||||
if existing is None:
|
||||
label = label_id(api, token)
|
||||
payload = {"title": ISSUE_TITLE, "body": body,
|
||||
"labels": [label] if label is not None else []}
|
||||
created = fetch_json(f"{api}/issues", token, "POST", payload)
|
||||
print(f"opened issue #{created['number']}")
|
||||
elif without_check_date(existing.get("body") or "") != without_check_date(body):
|
||||
fetch_json(f"{api}/issues/{existing['number']}", token, "PATCH", {"body": body})
|
||||
print(f"updated issue #{existing['number']}")
|
||||
else:
|
||||
print(f"issue #{existing['number']} already lists these differences")
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
parser.add_argument("--data-dir", type=Path,
|
||||
default=Path(__file__).resolve().parent.parent
|
||||
/ "compliance-agent/data/eol")
|
||||
parser.add_argument("--dry-run", action="store_true",
|
||||
help="print the differences, write no issue")
|
||||
args = parser.parse_args()
|
||||
today = dt.date.today()
|
||||
try:
|
||||
diff = differences(args.data_dir, today)
|
||||
except (urllib.error.URLError, OSError, ValueError, KeyError) as error:
|
||||
print(f"::error::could not compare the tables: {error}")
|
||||
return 1
|
||||
if not any(diff.values()):
|
||||
print("the bundled end-of-life tables match endoflife.date")
|
||||
return 0
|
||||
body = issue_body(diff, today)
|
||||
print(body)
|
||||
if args.dry_run:
|
||||
return 0
|
||||
token = os.environ.get("GITEA_TOKEN", "")
|
||||
if not token:
|
||||
print("::warning::GITEA_TOKEN is not set; not writing the issue")
|
||||
return 0
|
||||
try:
|
||||
file_issue(body, token, os.environ["GITEA_API"], os.environ["GITEA_REPO"])
|
||||
except (urllib.error.URLError, KeyError) as error:
|
||||
print(f"::error::could not write the issue: {error}")
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,70 @@
|
||||
"""Offline tests of check-eol-tables.py: python3 -m unittest discover -s scripts."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime as dt
|
||||
import importlib.util
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
SPEC = importlib.util.spec_from_file_location(
|
||||
"check_eol_tables", Path(__file__).with_name("check-eol-tables.py"))
|
||||
assert SPEC is not None and SPEC.loader is not None
|
||||
check = importlib.util.module_from_spec(SPEC)
|
||||
SPEC.loader.exec_module(check)
|
||||
|
||||
TODAY = dt.date(2026, 10, 9)
|
||||
|
||||
|
||||
class CompareTests(unittest.TestCase):
|
||||
def test_yocto_new_release_and_changed_dates_are_listed(self) -> None:
|
||||
table = {"releases": [{"codename": "wrynose", "version": "6.0", "lts": True,
|
||||
"released": "2026-05-13", "end_of_life": "2030-04-30"}]}
|
||||
upstream: list[dict[str, object]] = [
|
||||
{"cycle": "6.1", "codename": "Blacksail", "releaseDate": "2026-10-20",
|
||||
"eol": "2027-04-30"},
|
||||
{"cycle": "6.0", "codename": "Wrynose", "lts": True,
|
||||
"releaseDate": "2026-05-13", "eol": "2030-05-31"},
|
||||
]
|
||||
found = check.compare_yocto(table, upstream)
|
||||
self.assertEqual(len(found), 2)
|
||||
self.assertIn("Blacksail (6.1): on endoflife.date", found[0])
|
||||
self.assertIn("end of life is 2030-05-31 on endoflife.date, 2030-04-30", found[1])
|
||||
same = [{**upstream[1], "eol": "2030-04-30"}]
|
||||
self.assertEqual(check.compare_yocto(table, same), [])
|
||||
|
||||
def test_dotnet_monikers_map_to_endoflife_cycles(self) -> None:
|
||||
self.assertEqual(check.dotnet_cycle("net8.0"), ("dotnet", "8"))
|
||||
self.assertEqual(check.dotnet_cycle("netcoreapp3.1"), ("dotnet", "3.1"))
|
||||
self.assertEqual(check.dotnet_cycle("net462"), ("dotnetfx", "4.6.2"))
|
||||
self.assertEqual(check.dotnet_cycle("net35"), ("dotnetfx", "3.5-sp1"))
|
||||
self.assertIsNone(check.dotnet_cycle("net20"))
|
||||
table = {"frameworks": [{"moniker": "net8.0", "end_of_support": "2026-11-10",
|
||||
"product": ".NET 8"}]}
|
||||
upstream = {"dotnet": [{"cycle": "8", "eol": "2026-11-10"},
|
||||
{"cycle": "11", "eol": "2029-11-13"},
|
||||
{"cycle": "12", "eol": False}]}
|
||||
self.assertEqual(check.compare_dotnet(table, upstream),
|
||||
["dotnet 11: end of support 2029-11-13 on endoflife.date, "
|
||||
"not in the table"])
|
||||
|
||||
def test_platform_floors_are_the_oldest_supported_release(self) -> None:
|
||||
table = {"android": {"oldest_patched_api": 29}, "ios": {"oldest_patched": "15.0"}}
|
||||
android = [{"cycle": "14", "apiVersion": "34", "eol": False},
|
||||
{"cycle": "13", "apiVersion": "33", "eol": "2026-03-02"}]
|
||||
ios = [{"cycle": "16", "eol": False}, {"cycle": "15", "eol": False},
|
||||
{"cycle": "14", "eol": "2021-10-26"}]
|
||||
found = check.compare_platforms(table, android, ios, TODAY)
|
||||
self.assertEqual(found, ["Android: the oldest release with security updates is "
|
||||
"API 34 on endoflife.date, API 29 in the table"])
|
||||
|
||||
def test_the_issue_is_updated_only_when_the_differences_change(self) -> None:
|
||||
body = check.issue_body({"yocto.json": ["a"], "dotnet.json": []}, TODAY)
|
||||
self.assertIn("### `yocto.json`", body)
|
||||
self.assertNotIn("dotnet.json", body)
|
||||
later = check.issue_body({"yocto.json": ["a"]}, dt.date(2026, 10, 16))
|
||||
self.assertEqual(check.without_check_date(body), check.without_check_date(later))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user