Skip to content

Commit 398b51f

Browse files
committed
fix(NPOI): pin 传递漏洞 System.Text.Encodings.Web + Cryptography.Xml
治理 NPOI 2.8.0 传递依赖漏洞: - System.Security.Cryptography.Xml 8.0.2 (High) → pin 8.0.3 - Core ns2.0/2.1 路径经 RazorEngine 拉 System.Text.Encodings.Web 4.7.1 (Critical) → TFM 条件 PackageReference 提升到 8.0.0 实现: - props 加 PackageVersion System.Security.Cryptography.Xml 8.0.3 + System.Text.Encodings.Web 8.0.0 - Excel.NPOI.csproj 加顶层 PackageReference (CPM 下不写 Version) - Core.csproj ns2.x 条件 ItemGroup 加 System.Text.Encodings.Web (net6+ 无此传递) dotnet list package --vulnerable 对两个项目输出无易受攻击包。
1 parent f18bf22 commit 398b51f

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

Directory.Packages.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
2626
<PackageVersion Include="System.ComponentModel.Annotations" Version="4.7.0" />
2727
<PackageVersion Include="System.Runtime.Loader" Version="4.3.0" />
28+
<!-- Transitive CVE overrides (Stage 2 Step 6): see Excel.NPOI.csproj for context.
29+
Top-level PackageReference in the consumer csproj forces NuGet to honor these. -->
30+
<PackageVersion Include="System.Text.Encodings.Web" Version="8.0.0" />
31+
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.3" />
2832
<PackageVersion Include="NPOI" Version="2.8.0" />
2933
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
3034
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />

src/Magicodes.ExporterAndImporter.Core/Magicodes.IE.Core.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
<PackageReference Include="System.ComponentModel.Annotations" />
88
</ItemGroup>
99

10+
<!-- Override transitive CVE: System.Text.Encodings.Web 4.7.1 (Critical, GHSA-ghhp-997w-qr28)
11+
brought in by RazorEngine/Magicodes.RazorEngine.NetCore on netstandard2.0/2.1.
12+
Reference: https://github.com/dotnetcore/Magicodes.IE/issues/554 -->
13+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' ">
14+
<PackageReference Include="System.Text.Encodings.Web" />
15+
</ItemGroup>
16+
1017
<!-- netstandard 2.x 依赖 (System.Runtime.Loader 仅 ns2.0+ 需要) -->
1118
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard2.1' ">
1219
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />

src/Magicodes.IE.Excel.NPOI/Magicodes.IE.Excel.NPOI.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,15 @@
99
<ProjectReference Include="..\Magicodes.ExporterAndImporter.Core\Magicodes.IE.Core.csproj" />
1010
<!--TODO::peel off Epplus-->
1111
</ItemGroup>
12+
13+
<!-- Override transitive CVEs brought in by NPOI 2.8.0:
14+
System.Text.Encodings.Web 4.7.1 (Critical, GHSA-ghhp-997w-qr28)
15+
System.Security.Cryptography.Xml 8.0.2 (High, GHSA-37gx-xxp4-5rgx / GHSA-w3x6-4m5h-cxqf)
16+
Top-level PackageReference forces NuGet to resolve to a non-vulnerable version
17+
(versions declared in Directory.Packages.props).
18+
Reference: https://github.com/dotnetcore/Magicodes.IE/issues/554 -->
19+
<ItemGroup>
20+
<PackageReference Include="System.Text.Encodings.Web" />
21+
<PackageReference Include="System.Security.Cryptography.Xml" />
22+
</ItemGroup>
1223
</Project>

0 commit comments

Comments
 (0)