Skip to content

Commit 746a45d

Browse files
committed
net10 fix deprecations and pull-up vulns refs
1 parent de77e3a commit 746a45d

5 files changed

Lines changed: 52 additions & 17 deletions

File tree

src/cloudscribe.SimpleContent.Syndication/RssChannelProvider.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Microsoft.AspNetCore.Mvc;
1313
using Microsoft.AspNetCore.Mvc.Infrastructure;
1414
using Microsoft.AspNetCore.Mvc.Routing;
15+
using Microsoft.AspNetCore.Routing;
1516
using Microsoft.Extensions.Localization;
1617
using System;
1718
using System.Collections.Generic;
@@ -30,7 +31,6 @@ public RssChannelProvider(
3031
IBlogRoutes blogRoutes,
3132
IHttpContextAccessor contextAccessor,
3233
IUrlHelperFactory urlHelperFactory,
33-
IActionContextAccessor actionContextAccesor,
3434
IContentProcessor contentProcessor,
3535
IStringLocalizer<RssChannelProvider> localizer
3636
)
@@ -40,14 +40,12 @@ IStringLocalizer<RssChannelProvider> localizer
4040
BlogUrlResolver = blogUrlResolver;
4141
ContextAccessor = contextAccessor;
4242
UrlHelperFactory = urlHelperFactory;
43-
ActionContextAccesor = actionContextAccesor;
4443
ContentProcessor = contentProcessor;
4544
BlogRoutes = blogRoutes;
4645
sr = localizer;
4746
}
4847

4948
protected IUrlHelperFactory UrlHelperFactory { get; private set; }
50-
protected IActionContextAccessor ActionContextAccesor { get; private set; }
5149
protected IHttpContextAccessor ContextAccessor { get; private set; }
5250
protected IProjectService ProjectService { get; private set; }
5351
protected IBlogService BlogService { get; private set; }
@@ -102,7 +100,13 @@ IStringLocalizer<RssChannelProvider> localizer
102100
}
103101
}
104102

105-
var urlHelper = UrlHelperFactory.GetUrlHelper(ActionContextAccesor.ActionContext);
103+
// Get ActionContext from HttpContext for URL generation
104+
var actionContext = new ActionContext(
105+
ContextAccessor.HttpContext,
106+
ContextAccessor.HttpContext.GetRouteData(),
107+
new Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor()
108+
);
109+
var urlHelper = UrlHelperFactory.GetUrlHelper(actionContext);
106110

107111
if (!string.IsNullOrEmpty(project.Image))
108112
{

src/cloudscribe.SimpleContent.Web/Services/Blog/BlogUrlResolver.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Microsoft.AspNetCore.Mvc;
55
using Microsoft.AspNetCore.Mvc.Infrastructure;
66
using Microsoft.AspNetCore.Mvc.Routing;
7+
using Microsoft.AspNetCore.Routing;
78
using System;
89
using System.Threading.Tasks;
910

@@ -14,29 +15,31 @@ public class BlogUrlResolver : IBlogUrlResolver
1415
public BlogUrlResolver(
1516
IHttpContextAccessor contextAccessor,
1617
IUrlHelperFactory urlHelperFactory,
17-
IActionContextAccessor actionContextAccesor,
1818
IContentProcessor contentProcessor,
1919
IBlogRoutes blogRoutes
2020
)
2121
{
2222
_contextAccessor = contextAccessor;
2323
_urlHelperFactory = urlHelperFactory;
24-
_actionContextAccesor = actionContextAccesor;
2524
_contentProcessor = contentProcessor;
2625
_blogRoutes = blogRoutes;
2726
}
2827

2928
private readonly IHttpContextAccessor _contextAccessor;
3029
private readonly IUrlHelperFactory _urlHelperFactory;
31-
private readonly IActionContextAccessor _actionContextAccesor;
3230
private readonly IContentProcessor _contentProcessor;
3331
private readonly IBlogRoutes _blogRoutes;
3432

3533
public Task<string> ResolveBlogUrl(IProjectSettings blog)
3634
{
3735
//await EnsureBlogSettings().ConfigureAwait(false);
3836

39-
var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccesor.ActionContext);
37+
var actionContext = new ActionContext(
38+
_contextAccessor.HttpContext,
39+
_contextAccessor.HttpContext.GetRouteData(),
40+
new Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor()
41+
);
42+
var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext);
4043
var result = urlHelper.RouteUrl(_blogRoutes.BlogIndexRouteName);
4144

4245
return Task.FromResult(result);
@@ -45,7 +48,12 @@ public Task<string> ResolveBlogUrl(IProjectSettings blog)
4548
public Task<string> ResolvePostUrl(IPost post, IProjectSettings projectSettings)
4649
{
4750

48-
var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccesor.ActionContext);
51+
var actionContext = new ActionContext(
52+
_contextAccessor.HttpContext,
53+
_contextAccessor.HttpContext.GetRouteData(),
54+
new Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor()
55+
);
56+
var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext);
4957
string postUrl;
5058
if (projectSettings.IncludePubDateInPostUrls)
5159
{

src/cloudscribe.SimpleContent.Web/Services/Page/PageUrlResolver.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Microsoft.AspNetCore.Mvc;
44
using Microsoft.AspNetCore.Mvc.Infrastructure;
55
using Microsoft.AspNetCore.Mvc.Routing;
6+
using Microsoft.AspNetCore.Routing;
67
using System.Threading.Tasks;
78

89
namespace cloudscribe.SimpleContent.Web.Services
@@ -12,27 +13,29 @@ public class PageUrlResolver : IPageUrlResolver
1213
public PageUrlResolver(
1314
IHttpContextAccessor contextAccessor,
1415
IUrlHelperFactory urlHelperFactory,
15-
IActionContextAccessor actionContextAccesor,
1616
IContentProcessor contentProcessor,
1717
IPageRoutes pageRoutes
1818
)
1919
{
2020
_contextAccessor = contextAccessor;
2121
_urlHelperFactory = urlHelperFactory;
22-
_actionContextAccesor = actionContextAccesor;
2322
_contentProcessor = contentProcessor;
2423
_pageRoutes = pageRoutes;
2524
}
2625

2726
private readonly IHttpContextAccessor _contextAccessor;
2827
private readonly IUrlHelperFactory _urlHelperFactory;
29-
private readonly IActionContextAccessor _actionContextAccesor;
3028
private readonly IContentProcessor _contentProcessor;
3129
private readonly IPageRoutes _pageRoutes;
3230

3331
public Task<string> ResolvePageUrl(IPage page)
3432
{
35-
var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccesor.ActionContext);
33+
var actionContext = new ActionContext(
34+
_contextAccessor.HttpContext,
35+
_contextAccessor.HttpContext.GetRouteData(),
36+
new Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor()
37+
);
38+
var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext);
3639
var result = urlHelper.RouteUrl(_pageRoutes.PageRouteName, new { slug = page.Slug });
3740
return Task.FromResult(result);
3841
}

src/cloudscribe.SimpleContent.Web/Services/Page/PagesNavigationTreeBuilder.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
using cloudscribe.SimpleContent.Models;
99
using cloudscribe.Web.Navigation;
10+
using Microsoft.AspNetCore.Http;
1011
using Microsoft.AspNetCore.Mvc;
1112
using Microsoft.AspNetCore.Mvc.Infrastructure;
1213
using Microsoft.AspNetCore.Mvc.Routing;
14+
using Microsoft.AspNetCore.Routing;
1315
using System.Linq;
1416
using System.Threading.Tasks;
1517

@@ -24,14 +26,14 @@ public PagesNavigationTreeBuilder(
2426
IUrlHelperFactory urlHelperFactory,
2527
IPageRoutes pageRoutes,
2628
IBlogRoutes blogRoutes,
27-
IActionContextAccessor actionContextAccesor
29+
IHttpContextAccessor httpContextAccessor
2830
)
2931
{
3032
_projectService = projectService;
3133
_pageService = pageService;
3234
_prefixProvider = prefixProvider;
3335
_urlHelperFactory = urlHelperFactory;
34-
_actionContextAccesor = actionContextAccesor;
36+
_httpContextAccessor = httpContextAccessor;
3537
_pageRoutes = pageRoutes;
3638
_blogRoutes = blogRoutes;
3739
}
@@ -42,7 +44,7 @@ IActionContextAccessor actionContextAccesor
4244
private IUrlHelperFactory _urlHelperFactory;
4345
private IPageRoutes _pageRoutes;
4446
private IBlogRoutes _blogRoutes;
45-
private IActionContextAccessor _actionContextAccesor;
47+
private IHttpContextAccessor _httpContextAccessor;
4648
private TreeNode<NavigationNode> _rootNode = null;
4749

4850
public string Name
@@ -83,7 +85,12 @@ private async Task<TreeNode<NavigationNode>> BuildTreeInternal(NavigationTreeBui
8385
var rootList = await _pageService.GetRootPages().ConfigureAwait(false);
8486
var rootListCount = rootList.Count();
8587

86-
var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccesor.ActionContext);
88+
var actionContext = new ActionContext(
89+
_httpContextAccessor.HttpContext,
90+
_httpContextAccessor.HttpContext.GetRouteData(),
91+
new Microsoft.AspNetCore.Mvc.Abstractions.ActionDescriptor()
92+
);
93+
var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext);
8794
//var folderPrefix = _prefixProvider.GetPrefix();
8895
if ((homePage != null) && project.UseDefaultPageAsRootNode)
8996
{

src/cloudscribe.SimpleContent.Web/cloudscribe.SimpleContent.Web.csproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@
6060
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.1.0" />
6161

6262
<PackageReference Include="Esprima" Version="3.0.5" />
63+
64+
<!-- JK: Net10 - dealing with persistent security vuln warnings: -->
65+
66+
<!-- Security vulnerability fixes - must match versions in Core/Logging repos -->
67+
<!-- GHSA-ghhp-997w-qr28: Critical vulnerability in System.Text.Encodings.Web < 4.5.1 -->
68+
<PackageReference Include="System.Text.Encodings.Web" Version="10.0.0" />
69+
<!-- GHSA-5crp-9r3c-p9vr: High severity vulnerability in Newtonsoft.Json < 13.0.1 -->
70+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
71+
<!-- GHSA-cmhx-cq75-c4mj: High severity vulnerability in System.Text.RegularExpressions < 4.3.1 -->
72+
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
73+
<!-- GHSA-7jgj-8wvc-jh57: High severity vulnerability in System.Net.Http < 4.3.4 -->
74+
<PackageReference Include="System.Net.Http" Version="4.3.4" />
75+
6376
</ItemGroup>
6477
<ItemGroup>
6578
<None Include="README.md" Pack="true" PackagePath="/" />

0 commit comments

Comments
 (0)