Skip to content

Commit 7572ef5

Browse files
emmagarlandronaldbarendseemmagarlandrskJasonElkin
authored
NuGet vulnerability warnings: Warn in non-Release mode, Error in non-Release mode (#17244)
* Initial adjustment of the projects with package vulnerabilities that errored, to change to ignore the four specific Nuget vulnerability warnings in Debug mode (but not Release) as per https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1901-nu1904 (NU1901,NU1902,NU1903,NU1904) * Fixed formatting errors with tests * No trailing whitespace * Move NuGet vulnerability warnings error suppression to Directory.Build.props, combine WarningsNotAsErrors and fix minor issues * Update Umbraco.JsonSchema.csproj Removed unwanted change * Update Umbraco.JsonSchema.csproj Removed unwanted change * Revert unecessary changes since merge * Tweak more unecessary changes * Small tweaks * Remove space * Reverted spacing changes * Remove no longer required warning exclusions * Reverted unwanted change * Reversed order * A few tweaks to reduce warnings in Umbraco.TestData * More warnings removed as no longer an issue --------- Co-authored-by: Ronald Barendse <[email protected]> Co-authored-by: Emma Garland <[email protected]> Co-authored-by: Jason Elkin <[email protected]>
1 parent 61f1c4a commit 7572ef5

File tree

14 files changed

+36
-40
lines changed

14 files changed

+36
-40
lines changed

src/Umbraco.Cms.Api.Delivery/Umbraco.Cms.Api.Delivery.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Title>Umbraco CMS - Delivery API</Title>
44
<Description>Contains the presentation layer for the Umbraco CMS Delivery API.</Description>
55
</PropertyGroup>
6-
76
<PropertyGroup>
87
<!--
98
TODO: Fix and remove overrides:
@@ -12,7 +11,6 @@
1211
-->
1312
<WarningsNotAsErrors>$(WarningsNotAsErrors),ASP0019,CS0618,CS0612</WarningsNotAsErrors>
1413
</PropertyGroup>
15-
1614
<ItemGroup>
1715
<ProjectReference Include="..\Umbraco.Cms.Api.Common\Umbraco.Cms.Api.Common.csproj" />
1816
<ProjectReference Include="..\Umbraco.Web.Common\Umbraco.Web.Common.csproj" />

src/Umbraco.Cms.Persistence.SqlServer/Umbraco.Cms.Persistence.SqlServer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<PropertyGroup>
88
<!--
99
TODO: Fix and remove overrides:
10-
[SA1405] Debug assret message text
10+
[SA1405] Debug assert message text
1111
[SA1121] resolve hiding inherited members
1212
[SA1117] remove async or make method synchronous
1313
[IDE1006] fix naming rule violation

src/Umbraco.Cms.Persistence.Sqlite/Umbraco.Cms.Persistence.Sqlite.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
<Title>Umbraco CMS - Persistence - SQLite</Title>
44
<Description>Adds support for SQLite to Umbraco CMS.</Description>
55
</PropertyGroup>
6-
6+
77
<PropertyGroup>
88
<!--
99
TODO: Fix and remove overrides:
1010
[CS0114] Resolve hiding inherited members
1111
-->
1212
<WarningsNotAsErrors>$(WarningsNotAsErrors),CS0114</WarningsNotAsErrors>
1313
</PropertyGroup>
14-
1514
<ItemGroup>
1615
<PackageReference Include="Microsoft.Data.Sqlite" />
1716
</ItemGroup>

src/Umbraco.Cms.Targets/Umbraco.Cms.Targets.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<IncludeBuildOutput>false</IncludeBuildOutput>
66
<IncludeSymbols>false</IncludeSymbols>
77
</PropertyGroup>
8-
98
<PropertyGroup>
109
<!--
1110
TODO: Fix and remove overrides:

src/Umbraco.Core/Umbraco.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
[CS0618]/[CS0672]/[SYSLIB0051]/[SYSLIB0044]/[SYSLIB0023]/[SYSLIB0003]/[SYSLIB0045] adjust obsolete references
1717
[CS0067] unused event
1818
[SA1405] debug provide message text
19-
[CS0168]/[CS0169] unused fields/variables
19+
[CS0168] and [CS0169] unused fields/variables
2020
[CS0183] always of type
2121
[SA1111] adjust parenthesis
2222
[CA2017] match parameters number

src/Umbraco.Examine.Lucene/Umbraco.Examine.Lucene.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Description>Adds Examine searching support using Lucene to Umbraco CMS.</Description>
66
<RootNamespace>Umbraco.Cms.Infrastructure.Examine</RootNamespace>
77
</PropertyGroup>
8-
8+
99
<PropertyGroup>
1010
<!--
1111
TODO: Fix and remove overrides:
@@ -22,7 +22,6 @@
2222
<!-- Take top-level depedendency on System.Security.Cryptography.Xml, because Examine depends on a vulnerable version -->
2323
<PackageReference Include="System.Security.Cryptography.Xml" />
2424
<!-- Take top-level depedendency on Lucene.Net.Replicator, because Examine depends on a vulnerable version -->
25-
<!-- Take top-level depedendency on Lucene.Net.Replicator-->
2625
<PackageReference Include="Lucene.Net.Replicator" />
2726
</ItemGroup>
2827

src/Umbraco.Web.Common/Umbraco.Web.Common.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<Description>Contains the web assembly needed to run Umbraco CMS.</Description>
66
<RootNamespace>Umbraco.Cms.Web.Common</RootNamespace>
77
</PropertyGroup>
8-
98
<PropertyGroup>
109
<!--
1110
TODO: Fix and remove overrides:

src/Umbraco.Web.Website/Umbraco.Web.Website.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
<Description>Contains the website assembly needed to run the frontend of Umbraco CMS.</Description>
66
<RootNamespace>Umbraco.Cms.Web.Website</RootNamespace>
77
</PropertyGroup>
8-
8+
99
<PropertyGroup>
1010
<!--
1111
TODO: Fix and remove overrides:
1212
[ASP0019] use IHeaderDictionary.Append or the indexer to append or set headers
1313
[CS0618] handle member obsolete appropriately
1414
[SA1401] make fields private
15-
[SA1649] update file name, and remove this override
15+
[SA1649] update file name
1616
[IDE1006] fix naming rule violation
1717
-->
1818
<WarningsNotAsErrors>$(WarningsNotAsErrors),ASP0019,CS0618,SA1401,SA1649,IDE1006</WarningsNotAsErrors>
1919
</PropertyGroup>
20-
20+
2121
<ItemGroup>
2222
<ProjectReference Include="..\Umbraco.Web.Common\Umbraco.Web.Common.csproj" />
2323
</ItemGroup>

tests/Umbraco.TestData/LoadTestController.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ public class LoadTestController : Controller
2727
private const string FootHtml = @"</body>
2828
</html>";
2929

30-
private static readonly Random s_random = new();
31-
private static readonly Lock s_locko = new();
30+
private static readonly Random _random = new();
31+
private static readonly Lock _locko = new();
3232

33-
private static volatile int s_containerId = -1;
33+
private static volatile int _containerId = -1;
3434

35-
private static readonly string s_headHtml = @"<html>
35+
private static readonly string _headHtml = @"<html>
3636
<head>
3737
<title>LoadTest</title>
3838
<style>
@@ -53,7 +53,7 @@ public class LoadTestController : Controller
5353
</div>
5454
";
5555

56-
private static readonly string s_containerTemplateText = @"
56+
private static readonly string _containerTemplateText = @"
5757
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
5858
@inject Umbraco.Cms.Core.Configuration.IUmbracoVersion _umbracoVersion
5959
@{
@@ -65,7 +65,7 @@ @inject Umbraco.Cms.Core.Configuration.IUmbracoVersion _umbracoVersion
6565
var wurl = Context.Request.Query[""u""] == ""1"";
6666
var missing = contents.Length > 0 && contents[contents.Length - 1].Id - contents[0].Id >= contents.Length;
6767
}
68-
" + s_headHtml + @"
68+
" + _headHtml + @"
6969
<div class=""block"">
7070
<span @Html.Raw(missing ? ""style=\""color:red;\"""" : """")>@contents.Length items</span>
7171
<ul>
@@ -147,14 +147,14 @@ public IActionResult Index()
147147

148148
private IActionResult EnsureInitialize()
149149
{
150-
if (s_containerId > 0)
150+
if (_containerId > 0)
151151
{
152152
return null;
153153
}
154154

155-
lock (s_locko)
155+
lock (_locko)
156156
{
157-
if (s_containerId > 0)
157+
if (_containerId > 0)
158158
{
159159
return null;
160160
}
@@ -177,12 +177,12 @@ private IActionResult EnsureInitialize()
177177
return ContentHtml("Panic! Container is missing.");
178178
}
179179

180-
s_containerId = container.Id;
180+
_containerId = container.Id;
181181
return null;
182182
}
183183
}
184184

185-
private IActionResult ContentHtml(string s) => Content(s_headHtml + s + FootHtml, "text/html");
185+
private IActionResult ContentHtml(string s) => Content(_headHtml + s + FootHtml, "text/html");
186186

187187
public IActionResult Install()
188188
{
@@ -205,7 +205,7 @@ public IActionResult Install()
205205
var containerTemplate = ImportTemplate(
206206
"LoadTestContainer",
207207
"LoadTestContainer",
208-
s_containerTemplateText);
208+
_containerTemplateText);
209209

210210
var containerType = new ContentType(_shortStringHelper, -1)
211211
{
@@ -276,7 +276,7 @@ public IActionResult Create(int n = 1, int r = 0, string o = null)
276276
for (var i = 0; i < n; i++)
277277
{
278278
var name = Guid.NewGuid().ToString("N").ToUpper() + "-" + (restart ? "R" : "X") + "-" + o;
279-
var content = _contentService.Create(name, s_containerId, ContentAlias);
279+
var content = _contentService.Create(name, _containerId, ContentAlias);
280280
content.SetValue("origin", o);
281281
_contentService.Save(content);
282282
_contentService.Publish(content, content.AvailableCultures.ToArray());
@@ -294,9 +294,9 @@ public IActionResult Create(int n = 1, int r = 0, string o = null)
294294

295295
private static int GetRandom(int minValue, int maxValue)
296296
{
297-
lock (s_locko)
297+
lock (_locko)
298298
{
299-
return s_random.Next(minValue, maxValue);
299+
return _random.Next(minValue, maxValue);
300300
}
301301
}
302302

@@ -354,7 +354,7 @@ public IActionResult Domains()
354354
var pos = currentName.IndexOf('-');
355355
if (pos > 0)
356356
{
357-
currentName = currentName.Substring(0, pos);
357+
currentName = currentName[..pos];
358358
}
359359

360360
var text = new StringBuilder();

tests/Umbraco.TestData/Umbraco.TestData.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
<!--
44
TODO: Fix and remove overrides:
55
[CS0618] handle member obsolete appropriately
6-
[IDE1006] fix naming rule violation
7-
[IDE0057] simplify substring
86
-->
9-
<WarningsNotAsErrors>$(WarningsNotAsErrors),CS0618,IDE1006,IDE0057</WarningsNotAsErrors>
7+
<WarningsNotAsErrors>$(WarningsNotAsErrors),CS0618</WarningsNotAsErrors>
108
</PropertyGroup>
119

1210
<ItemGroup>

0 commit comments

Comments
 (0)