fix: upgrade log4net 2.0.17 → 3.3.1 to resolve NU1902 vulnerability#564
Merged
Conversation
…lity GHSA-4f7c-pmjv-c25w Agent-Logs-Url: https://github.com/elastic/ecs-dotnet/sessions/384a9bef-56ee-4d5d-b2ef-86ed65f9bc6d Co-authored-by: mallendem <105422197+mallendem@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix restore-time package vulnerability NU1902 for log4net
fix: upgrade log4net 2.0.17 → 3.3.1 to resolve NU1902 vulnerability
May 6, 2026
There was a problem hiding this comment.
Pull request overview
This PR upgrades the log4net dependency used by Elastic.CommonSchema.Log4net from 2.0.17 to 3.3.1 to resolve a restore-time NU1902 vulnerability failure (warnings-as-errors) tied to advisory GHSA-4f7c-pmjv-c25w.
Changes:
- Bump
log4netpackage reference in the Log4net formatter project from2.0.17to3.3.1.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Mpdreamz
approved these changes
May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI was failing at restore with
NU1902(warnings-as-errors) due tolog4net2.0.17 carrying GHSA-4f7c-pmjv-c25w. There is no 2.0.18 — the patch ships in the 3.x line, with 3.3.1 being the first release to explicitly address this advisory.Changes
src/Elastic.CommonSchema.Log4net/Elastic.CommonSchema.Log4net.csproj— bumplog4netfrom2.0.17to3.3.1The 3.x public API surface used by this project (
LayoutSkeleton,LoggingEvent,ThreadContextStack,LogicalThreadContextStack,SystemStringFormat) is unchanged, so no source modifications are required.Original prompt
The GitHub Actions job failed in repository
elastic/ecs-dotneton PR #562 due to a restore-time package vulnerability being treated as an error (NU1902).Failure details:
.github/workflows/test.yml24968209539, job74593383050ee4b7df118fbf98a3e435fb6f1018a1222dee28fsrc/Elastic.CommonSchema.Log4net/Elastic.CommonSchema.Log4net.csproj : error NU1902: Warning As Error: Package 'log4net' 2.0.17 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-4f7c-pmjv-c25wtests/Elastic.CommonSchema.Log4net.Tests/Elastic.CommonSchema.Log4net.Tests.csproj : error NU1902as a consequence of referencing the affected projectRelevant files:
.github/workflows/test.yml— Linux build job runs./build.sh build -s true, which fails during restore/build.src/Elastic.CommonSchema.Log4net/Elastic.CommonSchema.Log4net.csprojcurrently contains:<PackageReference Include="log4net" Version="2.0.17" />tests/Elastic.CommonSchema.Log4net.Tests/Elastic.CommonSchema.Log4net.Tests.csprojreferences the Log4net source project and should not need a direct package change.Requested fix:
log4netdependency insrc/Elastic.CommonSchema.Log4net/Elastic.CommonSchema.Log4net.csprojfrom2.0.17to a patched non-vulnerable version (for example2.0.18, or the latest safe compatible version available).NU1902; fix the underlying vulnerable dependency instead.log4netpackage.Acceptance criteria:
log4net2.0.17 in the affected project.NU1902forlog4net.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The failure is caused by restore treating a package vulnerability warning as an error:
src/Elastic.CommonSchema.Log4net/Elastic.CommonSchema.Log4net.csproj#L13pinslog4netto2.0.17NU1902for advisoryGHSA-4f7c-pmjv-c25wtests/Elastic.CommonSchema.Log4net.Tests/Elastic.CommonSchema.Log4net.Tests.csproj#L9The failing workflow step is the Linux build job in
.github/workflows/test.yml#L70-L80, where./build.sh build -s truerestores and builds the solution.Fix
Upgrade
log4netinsrc/Elastic.CommonSchema.Log4net/Elastic.CommonSchema.Log4net.csproj#L13to a non-vulnerable version.Suggested change:
If a newer patched release is available in your dependency policy, prefer the latest safe version instead of
2.0.18.Patch
Why this solves it
The logs show the only restore errors are:
src/Elastic.CommonSchema.Log4net/Elastic.CommonSchema.Log4net.csproj : error NU1902tests/Elastic.CommonSchema.Log4net.Tests/Elastic.CommonSchema.Log4net.Tests.csproj : error NU1902Since the test project references the Log4net project rather than directly referencing
log4net, updating the package in the source project removes the vulnerable dependency for both restore paths.Files involved
.github/workflows/test.ymlsrc/Elastic.CommonSchema.Log4net/Elastic.CommonSchema.Log4net.csproj#L13tests/Elastic.CommonSchema.Log4net.Tests/Elastic.CommonSchema.Log4net.Tests.csproj#L9If compatibility with a patched
log4netrelease is a concern, the onl...This pull request was created from Copilot chat.