feat: RHEL EUS detection (#4023)

* feat: rhel eus detection

Signed-off-by: Keith Zantow <kzantow@gmail.com>

* chore: update tests

Signed-off-by: Keith Zantow <kzantow@gmail.com>

* chore: update more tests

Signed-off-by: Keith Zantow <kzantow@gmail.com>

* rename feature detection functions

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Keith Zantow
2025-07-07 14:11:20 +00:00
committed by GitHub
co-authored by Alex Goodman
parent 9cbd52bdd7
commit 02703d5c80
26 changed files with 3435 additions and 7 deletions
@@ -480,6 +480,10 @@ func Test_toOsComponent(t *testing.T) {
Version: "myVersion",
},
Properties: &[]cyclonedx.Property{
{
Name: "syft:distro:extendedSupport",
Value: "false",
},
{
Name: "syft:distro:id",
Value: "myLinux",
@@ -102,6 +102,10 @@
"version": "1.2.3"
},
"properties": [
{
"name": "syft:distro:extendedSupport",
"value": "false"
},
{
"name": "syft:distro:id",
"value": "debian"
@@ -111,6 +111,10 @@
"version": "1.2.3"
},
"properties": [
{
"name": "syft:distro:extendedSupport",
"value": "false"
},
{
"name": "syft:distro:id",
"value": "debian"
@@ -53,6 +53,7 @@
<description>debian</description>
<swid tagId="debian" name="debian" version="1.2.3"></swid>
<properties>
<property name="syft:distro:extendedSupport">false</property>
<property name="syft:distro:id">debian</property>
<property name="syft:distro:idLike:0">like!</property>
<property name="syft:distro:prettyName">debian</property>
@@ -11,7 +11,7 @@
</component>
</components>
</tools>
<component bom-ref="f28a4ba3ddfdddad" type="container">
<component bom-ref="redacted" type="container">
<name>user-image-input</name>
<version>sha256:redacted</version>
</component>
@@ -56,6 +56,7 @@
<description>debian</description>
<swid tagId="debian" name="debian" version="1.2.3"></swid>
<properties>
<property name="syft:distro:extendedSupport">false</property>
<property name="syft:distro:id">debian</property>
<property name="syft:distro:idLike:0">like!</property>
<property name="syft:distro:prettyName">debian</property>
@@ -25,6 +25,7 @@ type LinuxRelease struct {
PrivacyPolicyURL string `json:"privacyPolicyURL,omitempty"`
CPEName string `json:"cpeName,omitempty"`
SupportEnd string `json:"supportEnd,omitempty"`
ExtendedSupport bool `json:"extendedSupport,omitempty"`
}
func (s *IDLikes) UnmarshalJSON(data []byte) error {
+3 -2
View File
@@ -41,7 +41,7 @@ func ToFormatModel(s sbom.SBOM, cfg EncoderConfig) model.Document {
ArtifactRelationships: toRelationshipModel(s.Relationships),
Files: toFile(s, coordinateSorter),
Source: toSourceModel(s.Source),
Distro: toLinuxReleaser(s.Artifacts.LinuxDistribution),
Distro: toLinuxRelease(s.Artifacts.LinuxDistribution),
Descriptor: toDescriptor(s.Descriptor),
Schema: model.Schema{
Version: internal.JSONSchemaVersion,
@@ -50,7 +50,7 @@ func ToFormatModel(s sbom.SBOM, cfg EncoderConfig) model.Document {
}
}
func toLinuxReleaser(d *linux.Release) model.LinuxRelease {
func toLinuxRelease(d *linux.Release) model.LinuxRelease {
if d == nil {
return model.LinuxRelease{}
}
@@ -73,6 +73,7 @@ func toLinuxReleaser(d *linux.Release) model.LinuxRelease {
PrivacyPolicyURL: d.PrivacyPolicyURL,
CPEName: d.CPEName,
SupportEnd: d.SupportEnd,
ExtendedSupport: d.ExtendedSupport,
}
}
+3 -2
View File
@@ -40,7 +40,7 @@ func toSyftModel(doc model.Document) *sbom.SBOM {
FileLicenses: fileArtifacts.FileLicenses,
Executables: fileArtifacts.Executables,
Unknowns: fileArtifacts.Unknowns,
LinuxDistribution: toSyftLinuxRelease(doc.Distro),
LinuxDistribution: toInternalLinuxRelease(doc.Distro),
},
Source: *toSyftSourceData(doc.Source),
Descriptor: toSyftDescriptor(doc.Descriptor),
@@ -195,7 +195,7 @@ func toSyftFileType(ty string) stereoscopeFile.Type {
}
}
func toSyftLinuxRelease(d model.LinuxRelease) *linux.Release {
func toInternalLinuxRelease(d model.LinuxRelease) *linux.Release {
if cmp.Equal(d, model.LinuxRelease{}) {
return nil
}
@@ -218,6 +218,7 @@ func toSyftLinuxRelease(d model.LinuxRelease) *linux.Release {
PrivacyPolicyURL: d.PrivacyPolicyURL,
CPEName: d.CPEName,
SupportEnd: d.SupportEnd,
ExtendedSupport: d.ExtendedSupport,
}
}