fix(eol): end-of-life findings are high, soon is medium, and non-LTS Yocto releases warn two months ahead
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 11m1s
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 11m1s
- Every end-of-life rule reports high: dotnet-framework-end-of-support, android-sdk-, swift-version-, ios-deployment-target-, android-min-sdk- and unity-editor-end-of-support (were medium or low), like yocto-release-eol. yocto-release-eol-soon stays medium. legacy-build-system-no-sbom is not an end-of-life rule and stays medium. - The Yocto "soon" window is six months for an LTS release and two for any other (soon_window): a non-LTS release is supported for about seven months. - Tests pin the severities and both windows; docs updated. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
1 parent
db515486a4
commit
5ca4eb4462
6 files changed
+71
-28
No files matched your search
@@ -189,7 +189,7 @@ fn check_adt_project(root: &Path, dir: &Path) -> Vec<Hit> {
|
||||
),
|
||||
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::Medium,
|
||||
severity: Severity::High,
|
||||
cwe: "CWE-1104",
|
||||
path,
|
||||
line: Some(line),
|
||||
@@ -270,7 +270,7 @@ fn check_xcode_project(root: &Path, file: &Path) -> Vec<Hit> {
|
||||
remediation: "Migrate the code to Swift 5 or later (Xcode migrates Swift 4 \
|
||||
code; older code through an Xcode release that still reads it) \
|
||||
and set SWIFT_VERSION accordingly.",
|
||||
severity: Severity::Medium,
|
||||
severity: Severity::High,
|
||||
cwe: "CWE-1104",
|
||||
path,
|
||||
line: Some(line),
|
||||
@@ -304,7 +304,7 @@ fn ios_deployment_target(
|
||||
also runs on current iOS releases."
|
||||
),
|
||||
remediation,
|
||||
severity: Severity::Low,
|
||||
severity: Severity::High,
|
||||
cwe: "CWE-1104",
|
||||
path,
|
||||
line: Some(line),
|
||||
@@ -355,7 +355,7 @@ fn unity_platform_hits(root: &Path, project: &Path) -> Vec<Hit> {
|
||||
),
|
||||
remediation: "Raise the Minimum API Level in the Player Settings (Android) to a \
|
||||
supported Android release, and test on it.",
|
||||
severity: Severity::Low,
|
||||
severity: Severity::High,
|
||||
cwe: "CWE-1104",
|
||||
path,
|
||||
line: Some(setting.line),
|
||||
@@ -415,7 +415,7 @@ fn check_unity_project(root: &Path, project: &Path) -> Vec<Hit> {
|
||||
relative(root, project)
|
||||
),
|
||||
remediation: "Upgrade the project to a supported Unity LTS release.",
|
||||
severity: Severity::Medium,
|
||||
severity: Severity::High,
|
||||
cwe: "CWE-1104",
|
||||
path,
|
||||
line: Some(1),
|
||||
@@ -466,8 +466,17 @@ mod tests {
|
||||
Tree(dir)
|
||||
}
|
||||
|
||||
/// The hits as `rule path:line`; every end-of-support hit is high, like
|
||||
/// every other end-of-life finding.
|
||||
fn hits(t: &Tree) -> Vec<String> {
|
||||
check_tree(&t.0)
|
||||
let found = check_tree(&t.0);
|
||||
for hit in found
|
||||
.iter()
|
||||
.filter(|h| h.rule_id.ends_with("-end-of-support"))
|
||||
{
|
||||
assert_eq!(hit.severity, Severity::High, "{}", hit.rule_id);
|
||||
}
|
||||
found
|
||||
.into_iter()
|
||||
.map(|h| format!("{} {}:{}", h.rule_id, h.path, h.line.unwrap_or(0)))
|
||||
.collect()
|
||||
|
||||
@@ -494,7 +494,7 @@ fn check_frameworks(root: &Path, today: chrono::NaiveDate) -> Vec<Hit> {
|
||||
),
|
||||
remediation: "Retarget the project to a supported version (.NET Framework \
|
||||
4.8/4.8.1, or a supported .NET release) and test it there.",
|
||||
severity: Severity::Medium,
|
||||
severity: Severity::High,
|
||||
cwe: "CWE-1104",
|
||||
path: project.path.clone(),
|
||||
line: Some(tf.line),
|
||||
@@ -677,6 +677,8 @@ mod tests {
|
||||
["dotnet-framework-end-of-support Legacy/Legacy.csproj:3"]
|
||||
);
|
||||
assert_eq!(hits[0].cwe, "CWE-1104");
|
||||
// End of life is high, like every other end-of-life finding.
|
||||
assert_eq!(hits[0].severity, Severity::High);
|
||||
assert!(
|
||||
hits[0].title.contains(".NET Framework 4.5"),
|
||||
"{}",
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
//! The Yocto release a layer tree builds, its support period, and a finding
|
||||
//! when that period is over or ends soon.
|
||||
|
||||
use chrono::{Months, NaiveDate};
|
||||
use chrono::NaiveDate;
|
||||
use compliance_core::models::{
|
||||
display_codename, Finding, LayerPin, ReleaseBasis, ScanType, Severity, Support, YoctoRelease,
|
||||
display_codename, soon_window, Finding, LayerPin, ReleaseBasis, ScanType, Severity, Support,
|
||||
YoctoRelease,
|
||||
};
|
||||
|
||||
use crate::pipeline::dedup;
|
||||
@@ -13,17 +14,14 @@ use crate::pipeline::recipe_lint::Layer;
|
||||
pub const SCANNER: &str = "yocto-release";
|
||||
/// The rule of a release past its end of life.
|
||||
pub const RULE_EOL: &str = "yocto-release-eol";
|
||||
/// The rule of a release whose end of life is within six months.
|
||||
/// 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";
|
||||
|
||||
/// How far ahead an end of life counts as soon (as [`YoctoRelease::support`]
|
||||
/// counts it): the current LTS is one supported for longer.
|
||||
const SOON: Months = Months::new(6);
|
||||
|
||||
/// One Yocto Project release.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct ReleaseInfo {
|
||||
@@ -235,9 +233,9 @@ pub(crate) fn derive(pins: &[LayerPin], layers: &[Layer]) -> Option<YoctoRelease
|
||||
newest(common).map(|info| make(info, ReleaseBasis::LayerCompat, conf_of(first)))
|
||||
}
|
||||
|
||||
/// The newest LTS release supported for more than [`SOON`] on `today`.
|
||||
/// 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)?;
|
||||
let horizon = today.checked_add_months(soon_window(true))?;
|
||||
RELEASES
|
||||
.iter()
|
||||
.filter(|r| r.lts && r.released <= today && r.end_of_life > horizon)
|
||||
@@ -260,7 +258,7 @@ fn basis_text(basis: &ReleaseBasis, file: &str) -> String {
|
||||
}
|
||||
|
||||
/// The support-status finding of `repo_id` for `release` on `today`;
|
||||
/// `None` while it is supported for more than six months.
|
||||
/// `None` while its end of life is not yet soon ([`soon_window`]).
|
||||
pub(crate) fn finding(repo_id: &str, release: &YoctoRelease, today: NaiveDate) -> Option<Finding> {
|
||||
let (rule, severity, title, status) = match release.support(today) {
|
||||
Support::Supported => return None,
|
||||
@@ -521,6 +519,19 @@ mod tests {
|
||||
assert_ne!(other.fingerprint, f.fingerprint);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_release_without_lts_warns_two_months_ahead() {
|
||||
// Whinlatter (5.3) ends on 2026-06-15.
|
||||
let whinlatter = release_of("whinlatter");
|
||||
assert!(finding("t1", &whinlatter, date(2026, 4, 14)).is_none());
|
||||
let soon = finding("t1", &whinlatter, date(2026, 4, 15)).expect("finding");
|
||||
assert_eq!(soon.rule_id.as_deref(), Some(RULE_EOL_SOON));
|
||||
assert_eq!(soon.severity, Severity::Medium);
|
||||
let ended = finding("t1", &whinlatter, date(2026, 6, 16)).expect("finding");
|
||||
assert_eq!(ended.rule_id.as_deref(), Some(RULE_EOL));
|
||||
assert_eq!(ended.severity, Severity::High);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_rules_are_bound_in_the_control_map() {
|
||||
let map = control_map::ControlMap::cra().expect("map");
|
||||
|
||||
@@ -80,5 +80,6 @@ pub use werkbank::{
|
||||
LeasedJob,
|
||||
};
|
||||
pub use yocto::{
|
||||
display_codename, LayerPin, LayerPins, PinSource, ReleaseBasis, Support, YoctoRelease,
|
||||
display_codename, soon_window, LayerPin, LayerPins, PinSource, ReleaseBasis, Support,
|
||||
YoctoRelease,
|
||||
};
|
||||
@@ -84,15 +84,24 @@ pub fn display_codename(codename: &str) -> String {
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
/// How far ahead an end of life counts as soon.
|
||||
const SOON: Months = Months::new(6);
|
||||
/// How far ahead the end of life of a release counts as soon: six months for
|
||||
/// a long term support release, two for any other. A non-LTS release is
|
||||
/// supported for about seven months, so a six-month window would warn from
|
||||
/// its first weeks.
|
||||
pub const fn soon_window(lts: bool) -> Months {
|
||||
if lts {
|
||||
Months::new(6)
|
||||
} else {
|
||||
Months::new(2)
|
||||
}
|
||||
}
|
||||
|
||||
/// Where a release's support stands on a day.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Support {
|
||||
/// Supported for more than six months.
|
||||
/// Supported for longer than its [`soon_window`].
|
||||
Supported,
|
||||
/// Its support ends within six months.
|
||||
/// Its support ends within its [`soon_window`].
|
||||
EndsSoon,
|
||||
/// Its support has ended (after its last day).
|
||||
Ended,
|
||||
@@ -104,7 +113,7 @@ impl YoctoRelease {
|
||||
if self.end_of_life < today {
|
||||
Support::Ended
|
||||
} else if today
|
||||
.checked_add_months(SOON)
|
||||
.checked_add_months(soon_window(self.lts))
|
||||
.is_none_or(|horizon| self.end_of_life <= horizon)
|
||||
{
|
||||
Support::EndsSoon
|
||||
@@ -135,11 +144,11 @@ pub struct LayerPins {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn release(end_of_life: NaiveDate) -> YoctoRelease {
|
||||
fn release(end_of_life: NaiveDate, lts: bool) -> YoctoRelease {
|
||||
YoctoRelease {
|
||||
codename: "scarthgap".into(),
|
||||
version: "5.0".into(),
|
||||
lts: true,
|
||||
lts,
|
||||
end_of_life,
|
||||
basis: ReleaseBasis::CoreLayer,
|
||||
file: "conf/layer.conf".into(),
|
||||
@@ -153,9 +162,9 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn support_ends_soon_within_six_months_and_ends_after_its_last_day() {
|
||||
fn lts_support_ends_soon_within_six_months_and_ends_after_its_last_day() {
|
||||
let date = |y, m, d| NaiveDate::from_ymd_opt(y, m, d).expect("date");
|
||||
let scarthgap = release(date(2028, 4, 30));
|
||||
let scarthgap = release(date(2028, 4, 30), true);
|
||||
assert_eq!(scarthgap.support(date(2026, 10, 9)), Support::Supported);
|
||||
assert_eq!(scarthgap.support(date(2027, 10, 29)), Support::Supported);
|
||||
assert_eq!(scarthgap.support(date(2027, 10, 30)), Support::EndsSoon);
|
||||
@@ -163,6 +172,17 @@ mod tests {
|
||||
assert_eq!(scarthgap.support(date(2028, 5, 1)), Support::Ended);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn other_releases_end_soon_within_two_months() {
|
||||
let date = |y, m, d| NaiveDate::from_ymd_opt(y, m, d).expect("date");
|
||||
// Whinlatter (5.3): released 2025-12-15, supported until 2026-06-15.
|
||||
let whinlatter = release(date(2026, 6, 15), false);
|
||||
assert_eq!(whinlatter.support(date(2025, 12, 20)), Support::Supported);
|
||||
assert_eq!(whinlatter.support(date(2026, 4, 14)), Support::Supported);
|
||||
assert_eq!(whinlatter.support(date(2026, 4, 15)), Support::EndsSoon);
|
||||
assert_eq!(whinlatter.support(date(2026, 6, 16)), Support::Ended);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn layer_pins_round_trip_through_bson() {
|
||||
let pins = LayerPins {
|
||||
|
||||
+1
-1
@@ -143,7 +143,7 @@ table below, there is no finding and the run lists **Yocto-Release
|
||||
| Rule (`yocto-release`) | When | Severity | CRA | Control |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `yocto-release-eol` | the release's end of life has passed | high | Annex I Part I (2)(c) security updates, Part II (2) remediation without delay | CRA-AI-22 |
|
||||
| `yocto-release-eol-soon` | its end of life is within six months | medium | the same | CRA-AI-22 |
|
||||
| `yocto-release-eol-soon` | its end of life is within six months (an LTS release) or two months (any other: a non-LTS release is supported for about seven months, so a longer window would warn from its first weeks) | medium | the same | CRA-AI-22 |
|
||||
|
||||
The finding names the release, its end of life, where it was read from (the
|
||||
kas file, manifest or `layer.conf`) and the source of the date, and recommends
|
||||
|
||||
Reference in new issue
Block a user