Skip to content

Commit

Permalink
Merge pull request #75 from simonec73/dev
Browse files Browse the repository at this point in the history
Dev 2.2.2
  • Loading branch information
simonec73 authored May 24, 2024
2 parents a5a8138 + 154c475 commit a628848
Show file tree
Hide file tree
Showing 121 changed files with 726 additions and 600 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -357,4 +357,7 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd

# Threats Manager specific folders
/KnowledgeBases/Build/
5 changes: 5 additions & 0 deletions Sources/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<NoWarn>CS0649</NoWarn>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using ThreatsManager.Interfaces;

[assembly: ExtensionsContainer("2.2.1")]
[assembly: ExtensionsContainer("2.2.2")]
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<PropertyGroup>
<TargetFrameworks>net481</TargetFrameworks>
<Description>Threats Manager Platform AI Assistant library.</Description>
<AssemblyVersion>2.2.1.0</AssemblyVersion>
<AssemblyVersion>2.2.2.0</AssemblyVersion>
<Authors>Simone Curzi</Authors>
<Company>Simone Curzi</Company>
<Product>Threats Manager Platform</Product>
<Copyright>Copyright © Simone Curzi, 2018-2024. All Rights Reserved.</Copyright>
<PackageProjectUrl>https://www.nuget.org/packages/ThreatsManager.Engine/</PackageProjectUrl>
<RepositoryUrl>https://github.com/simonec73/threatsmanager</RepositoryUrl>
<FileVersion>2.2.1.0</FileVersion>
<Version>2.2.1</Version>
<FileVersion>2.2.2.0</FileVersion>
<Version>2.2.2</Version>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\ThreatsManager.Engine\ThreatsManager.snk</AssemblyOriginatorKeyFile>
<NoWarn>$(NoWarn);NU1505</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using ThreatsManager.Interfaces;

[assembly: ExtensionsContainer("2.2.1")]
[assembly: ExtensionsContainer("2.2.2")]
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<PropertyGroup>
<TargetFrameworks>net481</TargetFrameworks>
<Description>Threats Manager Platform Auto Generation Rules library.</Description>
<AssemblyVersion>2.2.1.0</AssemblyVersion>
<AssemblyVersion>2.2.2.0</AssemblyVersion>
<Authors>Simone Curzi</Authors>
<Company>Simone Curzi</Company>
<Product>Threats Manager Platform</Product>
<Copyright>Copyright © Simone Curzi, 2018-2024. All Rights Reserved.</Copyright>
<PackageProjectUrl>https://www.nuget.org/packages/ThreatsManager.Engine/</PackageProjectUrl>
<RepositoryUrl>https://github.com/simonec73/threatsmanager</RepositoryUrl>
<FileVersion>2.2.1.0</FileVersion>
<Version>2.2.1</Version>
<FileVersion>2.2.2.0</FileVersion>
<Version>2.2.2</Version>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\ThreatsManager.Engine\ThreatsManager.snk</AssemblyOriginatorKeyFile>
<NoWarn>$(NoWarn);NU1505</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using ThreatsManager.Interfaces;

[assembly: ExtensionsContainer("2.2.1")]
[assembly: ExtensionsContainer("2.2.2")]
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<PropertyGroup>
<TargetFrameworks>net481</TargetFrameworks>
<Description>Threats Manager Platform Auto Threat Generation library.</Description>
<AssemblyVersion>2.2.1.0</AssemblyVersion>
<AssemblyVersion>2.2.2.0</AssemblyVersion>
<Authors>Simone Curzi</Authors>
<Company>Simone Curzi</Company>
<Product>Threats Manager Platform</Product>
<Copyright>Copyright © Simone Curzi, 2018-2024. All Rights Reserved.</Copyright>
<PackageProjectUrl>https://www.nuget.org/packages/ThreatsManager.Engine/</PackageProjectUrl>
<RepositoryUrl>https://github.com/simonec73/threatsmanager</RepositoryUrl>
<FileVersion>2.2.1.0</FileVersion>
<Version>2.2.1</Version>
<FileVersion>2.2.2.0</FileVersion>
<Version>2.2.2</Version>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\ThreatsManager.Engine\ThreatsManager.snk</AssemblyOriginatorKeyFile>
<NoWarn>$(NoWarn);NU1505</NoWarn>
Expand Down
4 changes: 3 additions & 1 deletion Sources/Extensions/ThreatsManager.DevOps/DevOpsField.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using PostSharp.Patterns.Contracts;
using System.Xml.Linq;
using ThreatsManager.Utilities;

namespace ThreatsManager.DevOps
{
Expand All @@ -20,7 +22,7 @@ public DevOpsField([Required] string id, [Required] string label)

public override string ToString()
{
return Label;
return string.IsNullOrWhiteSpace(Label) ? ThreatModelManager.Undefined : Label;
}
}
}
3 changes: 2 additions & 1 deletion Sources/Extensions/ThreatsManager.DevOps/DevOpsItemInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using PostSharp.Patterns.Contracts;
using ThreatsManager.Utilities;

namespace ThreatsManager.DevOps
{
Expand Down Expand Up @@ -78,7 +79,7 @@ public string Serialize()

public override string ToString()
{
return Name;
return string.IsNullOrWhiteSpace(Name) ? ThreatModelManager.Undefined : Name;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using ThreatsManager.Interfaces;

[assembly: ExtensionsContainer("2.2.1")]
[assembly: ExtensionsContainer("2.2.2")]
3 changes: 2 additions & 1 deletion Sources/Extensions/ThreatsManager.DevOps/Iteration.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Newtonsoft.Json;
using ThreatsManager.Utilities;

namespace ThreatsManager.DevOps
{
Expand All @@ -23,7 +24,7 @@ public class Iteration

public override string ToString()
{
return Name;
return string.IsNullOrWhiteSpace(Name) ? ThreatModelManager.Undefined : Name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<PropertyGroup>
<TargetFrameworks>net481</TargetFrameworks>
<Description>Threats Manager Platform DevOps Integration library.</Description>
<AssemblyVersion>2.2.1.0</AssemblyVersion>
<AssemblyVersion>2.2.2.0</AssemblyVersion>
<Authors>Simone Curzi</Authors>
<Company>Simone Curzi</Company>
<Product>Threats Manager Platform</Product>
<Copyright>Copyright © Simone Curzi, 2018-2024. All Rights Reserved.</Copyright>
<PackageProjectUrl>https://www.nuget.org/packages/ThreatsManager.Engine/</PackageProjectUrl>
<RepositoryUrl>https://github.com/simonec73/threatsmanager</RepositoryUrl>
<FileVersion>2.2.1.0</FileVersion>
<Version>2.2.1</Version>
<FileVersion>2.2.2.0</FileVersion>
<Version>2.2.2</Version>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\ThreatsManager.Engine\ThreatsManager.snk</AssemblyOriginatorKeyFile>
<NoWarn>$(NoWarn);NU1505</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<PropertyGroup>
<TargetFrameworks>net481</TargetFrameworks>
<Description>Threats Manager Platform Extensions Client library.</Description>
<AssemblyVersion>2.2.1.0</AssemblyVersion>
<AssemblyVersion>2.2.2.0</AssemblyVersion>
<Authors>Simone Curzi</Authors>
<Company>Simone Curzi</Company>
<Product>Threats Manager Platform</Product>
<Copyright>Copyright © Simone Curzi, 2018-2024. All Rights Reserved.</Copyright>
<PackageProjectUrl>https://www.nuget.org/packages/ThreatsManager.Engine/</PackageProjectUrl>
<RepositoryUrl>https://github.com/simonec73/threatsmanager</RepositoryUrl>
<FileVersion>2.2.1.0</FileVersion>
<Version>2.2.1</Version>
<FileVersion>2.2.2.0</FileVersion>
<Version>2.2.2</Version>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\ThreatsManager.Engine\ThreatsManager.snk</AssemblyOriginatorKeyFile>
<RootNamespace>ThreatsManager.Extensions</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public Image GetIcon(int size)
}
}

if (result.Width != size)
if (result != null && result.Width != size)
{
try
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
using ThreatsManager.Interfaces;

[assembly: ExtensionsContainer("2.2.1")]
[assembly: ExtensionsContainer("2.2.2")]
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public IEnumerable<KeyValuePair<string, IPropertyType>> GetProperties([NotNull]
{
IEnumerable<KeyValuePair<string, IPropertyType>> result = null;

var entities = model.Entities?.OfType<IExternalInteractor>().OrderBy(x => x.Name).ToArray();
var entities = model.Entities?.OfType<IExternalInteractor>().OrderBy(x => x.ToString()).ToArray();

if (entities?.Any() ?? false)
{
Expand Down Expand Up @@ -71,7 +71,7 @@ public IEnumerable<ListItem> GetList(IThreatModel model)
{
IEnumerable<ListItem> result = null;

var entities = model.Entities?.OfType<IExternalInteractor>().OrderBy(x => x.Name).ToArray();
var entities = model.Entities?.OfType<IExternalInteractor>().OrderBy(x => x.ToString()).ToArray();

if (entities?.Any() ?? false)
{
Expand All @@ -85,7 +85,7 @@ public IEnumerable<ListItem> GetList(IThreatModel model)
if (itemRows?.Any() ?? false)
items.AddRange(itemRows);

list.Add(new ListItem(entity.Name, entity.Id, items));
list.Add(new ListItem(entity.ToString(), entity.Id, items));
}

result = list;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public IEnumerable<KeyValuePair<string, IPropertyType>> GetProperties([NotNull]
{
IEnumerable<KeyValuePair<string, IPropertyType>> result = null;

var flows = model.DataFlows?.OrderBy(x => x.Name).ToArray();
var flows = model.DataFlows?.OrderBy(x => x.ToString()).ToArray();

if (flows?.Any() ?? false)
{
Expand Down Expand Up @@ -71,7 +71,7 @@ public IEnumerable<ListItem> GetList(IThreatModel model)
{
IEnumerable<ListItem> result = null;

var flows = model.DataFlows?.OrderBy(x => x.Name).ToArray();
var flows = model.DataFlows?.OrderBy(x => x.ToString()).ToArray();

if (flows?.Any() ?? false)
{
Expand All @@ -82,17 +82,17 @@ public IEnumerable<ListItem> GetList(IThreatModel model)
var items = new List<ItemRow>();
items.Add(new TextRow("Description", flow.Description));
if (flow.Source != null)
items.Add(new TextRow("Source", $"[{flow.Source.GetIdentityTypeInitial()}] {flow.Source.Name}",
items.Add(new TextRow("Source", $"[{flow.Source.GetIdentityTypeInitial()}] {flow.Source.ToString()}",
null, null, new []{flow.SourceId}));
if (flow.Target != null)
items.Add(new TextRow("Target", $"[{flow.Target.GetIdentityTypeInitial()}] {flow.Target.Name}",
items.Add(new TextRow("Target", $"[{flow.Target.GetIdentityTypeInitial()}] {flow.Target.ToString()}",
null, null, new []{flow.TargetId}));
items.Add(new TextRow("Flow Type", flow.FlowType.GetEnumLabel()));
var itemRows = flow.GetItemRows()?.ToArray();
if (itemRows?.Any() ?? false)
items.AddRange(itemRows);

list.Add(new ListItem(flow.Name, flow.Id, items));
list.Add(new ListItem(flow.ToString(), flow.Id, items));
}

result = list;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,38 @@ public IEnumerable<string> GetTextEnumeration([NotNull] IThreatModel model)

var externalInteractors = model.EntityTemplates?
.Where(x => x.EntityType == EntityType.ExternalInteractor)
.OrderBy(x => x.Name)
.Select(x => x.Name)
.OrderBy(x => x.ToString())
.Select(x => x.ToString())
.ToArray();
if (externalInteractors?.Any() ?? false)
list.AddRange(externalInteractors);

var processes = model.EntityTemplates?
.Where(x => x.EntityType == EntityType.Process)
.OrderBy(x => x.Name)
.Select(x => x.Name)
.OrderBy(x => x.ToString())
.Select(x => x.ToString())
.ToArray();
if (processes?.Any() ?? false)
list.AddRange(processes);

var dataStores = model.EntityTemplates?
.Where(x => x.EntityType == EntityType.DataStore)
.OrderBy(x => x.Name)
.Select(x => x.Name)
.OrderBy(x => x.ToString())
.Select(x => x.ToString())
.ToArray();
if (dataStores?.Any() ?? false)
list.AddRange(dataStores);

var flows = model.FlowTemplates?
.OrderBy(x => x.Name)
.Select(x => x.Name)
.OrderBy(x => x.ToString())
.Select(x => x.ToString())
.ToArray();
if (flows?.Any() ?? false)
list.AddRange(flows);

var trustBoundaries = model.TrustBoundaryTemplates?
.OrderBy(x => x.Name)
.Select(x => x.Name)
.OrderBy(x => x.ToString())
.Select(x => x.ToString())
.ToArray();
if (trustBoundaries?.Any() ?? false)
list.AddRange(trustBoundaries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private void AddEntityTemplates([NotNull] List<ListItem> list, [NotNull] IThreat
{
var entities = model.EntityTemplates?
.Where(x => x.EntityType == entityType)
.OrderBy(x => x.Name).ToArray();
.OrderBy(x => x.ToString()).ToArray();
if (entities?.Any() ?? false)
{
foreach (var entity in entities)
Expand All @@ -146,15 +146,15 @@ private void AddEntityTemplates([NotNull] List<ListItem> list, [NotNull] IThreat
var itemRows = entity.GetItemRows()?.ToArray();
if (itemRows?.Any() ?? false)
items.AddRange(itemRows);
list.Add(new ListItem(entity.Name, entity.Id, items));
list.Add(new ListItem(entity.ToString(), entity.Id, items));
}
}
}

private void AddFlowTemplates([NotNull] List<ListItem> list, [NotNull] IThreatModel model)
{
var flows = model.FlowTemplates?
.OrderBy(x => x.Name).ToArray();
.OrderBy(x => x.ToString()).ToArray();
if (flows?.Any() ?? false)
{
foreach (var flow in flows)
Expand All @@ -165,15 +165,15 @@ private void AddFlowTemplates([NotNull] List<ListItem> list, [NotNull] IThreatMo
var itemRows = flow.GetItemRows()?.ToArray();
if (itemRows?.Any() ?? false)
items.AddRange(itemRows);
list.Add(new ListItem(flow.Name, flow.Id, items));
list.Add(new ListItem(flow.ToString(), flow.Id, items));
}
}
}

private void AddTrustBoundaryTemplates([NotNull] List<ListItem> list, [NotNull] IThreatModel model)
{
var trustBoundaries = model.TrustBoundaryTemplates?
.OrderBy(x => x.Name).ToArray();
.OrderBy(x => x.ToString()).ToArray();
if (trustBoundaries?.Any() ?? false)
{
foreach (var trustBoundary in trustBoundaries)
Expand All @@ -183,7 +183,7 @@ private void AddTrustBoundaryTemplates([NotNull] List<ListItem> list, [NotNull]
var itemRows = trustBoundary.GetItemRows()?.ToArray();
if (itemRows?.Any() ?? false)
items.AddRange(itemRows);
list.Add(new ListItem(trustBoundary.Name, trustBoundary.Id, items));
list.Add(new ListItem(trustBoundary.ToString(), trustBoundary.Id, items));
}
}
}
Expand Down
Loading

0 comments on commit a628848

Please sign in to comment.