Restructure solution layout by module
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<article>
|
||||
<h1>ICSA-25-123-01: Example ICS Advisory</h1>
|
||||
<p>The Cybersecurity and Infrastructure Security Agency (CISA) is aware of vulnerabilities affecting ControlSuite 4.2.</p>
|
||||
<p><strong>Vendor:</strong> Example Corp</p>
|
||||
<p><strong>Products:</strong> ControlSuite 4.2</p>
|
||||
<p><a href="https://files.cisa.gov/docs/icsa-25-123-01.pdf">Download PDF advisory</a></p>
|
||||
<p>For additional information see the <a href="https://example.com/security/icsa-25-123-01">vendor bulletin</a>.</p>
|
||||
<h2>Mitigations</h2>
|
||||
<ul>
|
||||
<li>Apply ControlSuite firmware version 4.2.1 or later.</li>
|
||||
<li>Restrict network access to the engineering workstation and monitor remote connections.</li>
|
||||
</ul>
|
||||
</article>
|
||||
@@ -0,0 +1,9 @@
|
||||
<article>
|
||||
<h1>ICSMA-25-045-01: Example Medical Advisory</h1>
|
||||
<p>HealthTech InfusionManager 2.1 devices contain multiple vulnerabilities.</p>
|
||||
<p><strong>Vendor:</strong> HealthTech</p>
|
||||
<p><strong>Products:</strong> InfusionManager 2.1</p>
|
||||
<p><a href="https://www.cisa.gov/sites/default/files/2025-10/ICSMA-25-045-01_Supplement.pdf">Supplemental guidance</a></p>
|
||||
<h2>Mitigations</h2>
|
||||
<p>Contact HealthTech support to obtain firmware 2.1.5 and enable multi-factor authentication for remote sessions.</p>
|
||||
</article>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>CISA ICS Advisories</title>
|
||||
<item>
|
||||
<title>ICSA-25-123-01: Example ICS Advisory</title>
|
||||
<link>https://www.cisa.gov/news-events/ics-advisories/icsa-25-123-01</link>
|
||||
<pubDate>Mon, 13 Oct 2025 12:00:00 GMT</pubDate>
|
||||
<description><![CDATA[
|
||||
<p><strong>Vendor:</strong> Example Corp</p>
|
||||
<p><strong>Products:</strong> ControlSuite 4.2</p>
|
||||
<p><a href="https://example.com/security/icsa-25-123-01.pdf">Download vendor PDF</a></p>
|
||||
<p>CVE-2024-12345 allows remote code execution.</p>
|
||||
]]></description>
|
||||
</item>
|
||||
<item>
|
||||
<title>ICSMA-25-045-01: Example Medical Advisory</title>
|
||||
<link>https://www.cisa.gov/news-events/ics-medical-advisories/icsma-25-045-01</link>
|
||||
<pubDate>Tue, 14 Oct 2025 09:30:00 GMT</pubDate>
|
||||
<description><![CDATA[
|
||||
<p><strong>Vendor:</strong> HealthTech</p>
|
||||
<p><strong>Products:</strong> InfusionManager 2.1</p>
|
||||
<p>Multiple vulnerabilities including CVE-2025-11111 and CVE-2025-22222.</p>
|
||||
]]></description>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
@@ -0,0 +1,101 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using StellaOps.Concelier.Models;
|
||||
using StellaOps.Concelier.Connector.Ics.Cisa;
|
||||
using StellaOps.Concelier.Connector.Ics.Cisa.Internal;
|
||||
using Xunit;
|
||||
|
||||
namespace StellaOps.Concelier.Connector.Ics.Cisa.Tests.IcsCisa;
|
||||
|
||||
public class IcsCisaConnectorMappingTests
|
||||
{
|
||||
private static readonly DateTimeOffset RecordedAt = new(2025, 10, 14, 12, 0, 0, TimeSpan.Zero);
|
||||
|
||||
[Fact]
|
||||
public void BuildReferences_MergesFeedAndDetailAttachments()
|
||||
{
|
||||
var dto = new IcsCisaAdvisoryDto
|
||||
{
|
||||
AdvisoryId = "ICSA-25-123-01",
|
||||
Title = "Sample Advisory",
|
||||
Link = "https://www.cisa.gov/news-events/ics-advisories/icsa-25-123-01",
|
||||
Summary = "Summary",
|
||||
DescriptionHtml = "<p>Summary</p>",
|
||||
Published = RecordedAt,
|
||||
Updated = RecordedAt,
|
||||
IsMedical = false,
|
||||
References = new[]
|
||||
{
|
||||
"https://example.org/advisory",
|
||||
"https://www.cisa.gov/news-events/ics-advisories/icsa-25-123-01"
|
||||
},
|
||||
Attachments = new List<IcsCisaAttachmentDto>
|
||||
{
|
||||
new() { Title = "PDF Attachment", Url = "https://files.cisa.gov/docs/icsa-25-123-01.pdf" },
|
||||
}
|
||||
};
|
||||
|
||||
var references = IcsCisaConnector.BuildReferences(dto, RecordedAt);
|
||||
|
||||
Assert.Equal(3, references.Count);
|
||||
Assert.Contains(references, reference => reference.Kind == "attachment" && reference.Url == "https://files.cisa.gov/docs/icsa-25-123-01.pdf");
|
||||
Assert.Contains(references, reference => reference.Url == "https://example.org/advisory");
|
||||
Assert.Contains(references, reference => reference.Url == "https://www.cisa.gov/news-events/ics-advisories/icsa-25-123-01");
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void BuildMitigationReferences_ProducesReferences()
|
||||
{
|
||||
var dto = new IcsCisaAdvisoryDto
|
||||
{
|
||||
AdvisoryId = "ICSA-25-999-01",
|
||||
Title = "Mitigation Test",
|
||||
Link = "https://www.cisa.gov/news-events/ics-advisories/icsa-25-999-01",
|
||||
Mitigations = new[] { "Apply firmware 9.9.1", "Limit network access" },
|
||||
Published = RecordedAt,
|
||||
Updated = RecordedAt,
|
||||
IsMedical = false,
|
||||
};
|
||||
|
||||
var references = IcsCisaConnector.BuildMitigationReferences(dto, RecordedAt);
|
||||
|
||||
Assert.Equal(2, references.Count);
|
||||
var first = references.First();
|
||||
Assert.Equal("mitigation", first.Kind);
|
||||
Assert.Equal("icscisa-mitigation", first.SourceTag);
|
||||
Assert.EndsWith("#mitigation-1", first.Url, StringComparison.Ordinal);
|
||||
Assert.Contains("Apply firmware", first.Summary);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildAffectedPackages_EmitsProductRangesWithSemVer()
|
||||
{
|
||||
var dto = new IcsCisaAdvisoryDto
|
||||
{
|
||||
AdvisoryId = "ICSA-25-456-02",
|
||||
Title = "Vendor Advisory",
|
||||
Link = "https://www.cisa.gov/news-events/ics-advisories/icsa-25-456-02",
|
||||
DescriptionHtml = "",
|
||||
Summary = null,
|
||||
Published = RecordedAt,
|
||||
Vendors = new[] { "Example Corp" },
|
||||
Products = new[] { "ControlSuite 4.2" }
|
||||
};
|
||||
|
||||
var packages = IcsCisaConnector.BuildAffectedPackages(dto, RecordedAt);
|
||||
|
||||
var productPackage = Assert.Single(packages);
|
||||
Assert.Equal(AffectedPackageTypes.IcsVendor, productPackage.Type);
|
||||
Assert.Equal("ControlSuite", productPackage.Identifier);
|
||||
var range = Assert.Single(productPackage.VersionRanges);
|
||||
Assert.Equal("product", range.RangeKind);
|
||||
Assert.Equal("4.2", range.RangeExpression);
|
||||
Assert.NotNull(range.Primitives);
|
||||
Assert.Equal("Example Corp", range.Primitives!.VendorExtensions!["ics.vendors"]);
|
||||
Assert.Equal("ControlSuite", range.Primitives.VendorExtensions!["ics.product"]);
|
||||
Assert.NotNull(range.Primitives.SemVer);
|
||||
Assert.Equal("4.2.0", range.Primitives.SemVer!.ExactValue);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using StellaOps.Concelier.Connector.Ics.Cisa.Internal;
|
||||
using Xunit;
|
||||
|
||||
namespace StellaOps.Concelier.Connector.Ics.Cisa.Tests.IcsCisa;
|
||||
|
||||
public class IcsCisaFeedParserTests
|
||||
{
|
||||
[Fact]
|
||||
public void Parse_ReturnsAdvisories()
|
||||
{
|
||||
var parser = new IcsCisaFeedParser();
|
||||
using var stream = File.OpenRead(Path.Combine("IcsCisa", "Fixtures", "sample-feed.xml"));
|
||||
|
||||
var advisories = parser.Parse(stream, isMedicalTopic: false, topicUri: new Uri("https://content.govdelivery.com/accounts/USDHSCISA/topics.rss"));
|
||||
|
||||
Assert.Equal(2, advisories.Count);
|
||||
|
||||
var first = advisories.First();
|
||||
Console.WriteLine("Description:" + first.DescriptionHtml);
|
||||
Console.WriteLine("Attachments:" + string.Join(",", first.Attachments.Select(a => a.Url)));
|
||||
Console.WriteLine("References:" + string.Join(",", first.References));
|
||||
Assert.Equal("ICSA-25-123-01", first.AdvisoryId);
|
||||
Assert.Contains("CVE-2024-12345", first.CveIds);
|
||||
Assert.Contains("Example Corp", first.Vendors);
|
||||
Assert.Contains("ControlSuite 4.2", first.Products);
|
||||
Assert.Contains(first.Attachments, attachment => attachment.Url == "https://example.com/security/icsa-25-123-01.pdf");
|
||||
Assert.Contains(first.References, reference => reference == "https://www.cisa.gov/news-events/ics-advisories/icsa-25-123-01");
|
||||
|
||||
var second = advisories.Last();
|
||||
Assert.True(second.IsMedical);
|
||||
Assert.Contains("CVE-2025-11111", second.CveIds);
|
||||
Assert.Contains("HealthTech", second.Vendors);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user