fix(deps): CVE bloquantes Trivy — AutoMapper 16.1.1, OpenApi 10.0.11, Newtonsoft 13, SQLitePCLRaw 2.1.13 (#128)

## Contexte
Trivy (bloquant) détecte 4 CVE HIGH dans les images PR. Ces vulnérabilités sont dans la base du projet (pas liées aux PR #117/#118) → PR dédiée.

## Changements
- **AutoMapper 13.0.1 → 16.1.1** (CVE-2026-32933) : AddAutoMapper passe par cfg.AddMaps(assembly) (v16 : plus de surcharge Assembly) ; MapperConfiguration des tests → constructeur 2 args (NullLoggerFactory.Instance).
- **Microsoft.AspNetCore.OpenApi 10.0.8 → 10.0.11** (CVE-2026-49451) : tire Microsoft.OpenApi 2.7.5.
- **Newtonsoft.Json 13.0.1** en référence directe (CVE-2024-21907, transitif 11.0.1 forcé).
- **SQLitePCLRaw.bundle_e_sqlite3 2.1.13** en référence directe (CVE-2025-6965, transitif 2.1.11 forcé).

## Tickets liés
Fixes #127

## Résultats des tests
- dotnet build Heimdall.slnx -c Release : 0 erreur, 0 warning
- Application.Tests (Mapping + NotificationHandler) : 22/22
- Infrastructure.Tests (NotificationServiceTests, Testcontainers) : 10/10

## SonarQube
À valider sur la CI (gate bloquant).

## CVE
Corrigées par les bumps ci-dessus (à confirmer par Trivy sur le run).

## Checklist
- [x] PR par ticket
- [x] Build + tests locaux verts
- [ ] CI verte (Trivy sans HIGH/CRITICAL)
- [ ] Sonar gate OK

Reviewed-on: https://forgejo.tordais.cc/nonobis/Heimdall/pulls/128
This commit is contained in:
Arnaud Dartois authored and Arnaud Dartois committed 2026-08-15 09:11:25 +02:00
1 parent de291b7674
commit 45ce41ce7e
8 files changed
+17 -6

No files matched your search

+1
View File
@@ -54,6 +54,7 @@ jobs:
trivy-enabled: 'true'
trivy-image: eltruncho/heimdall
dependency-check-enabled: 'true'
dependency-check-path: Heimdall.slnx
docker-images: |
eltruncho/heimdall docker/Dockerfile
eltruncho/heimdall-agent docker/Dockerfile.agent
+2
View File
@@ -0,0 +1,2 @@
re-run post infra fix — 20260814T165358Z
re-run post serialisation tests DB template — 20260815T025200Z
@@ -23,7 +23,8 @@ public static class DependencyInjection
});
// AutoMapper — scan assembly for profiles (including MappingProfile)
services.AddAutoMapper(assembly);
// (v16 : AddAutoMapper n'accepte plus Assembly en 2e arg — AddMaps requis)
services.AddAutoMapper(cfg => cfg.AddMaps(assembly));
// FluentValidation — auto-register all validators
services.AddValidatorsFromAssembly(assembly);
@@ -5,7 +5,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="AutoMapper" Version="16.1.1" />
<PackageReference Include="FluentValidation" Version="11.11.0" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.11.0" />
<PackageReference Include="MediatR" Version="12.5.0" />
+4 -1
View File
@@ -22,10 +22,13 @@
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.17" />
<PackageReference Include="Scalar.AspNetCore" Version="2.0.2" />
<PackageReference Include="Hangfire.PostgreSql" Version="1.20.10" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.8" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.11" />
<PackageReference Include="MudBlazor" Version="9.8.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="10.0.8" />
<PackageReference Include="Sentry.AspNetCore" Version="6.8.0" />
<!-- CVE bloquantes Trivy (ticket #127) : forcer les versions corrigées des dépendances transitives -->
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.5" />
</ItemGroup>
</Project>
@@ -11,6 +11,7 @@ using Heimdall.Application.Notifications.Queries.GetUnreadCount;
using Heimdall.Application.Tests.Common;
using Heimdall.Domain.Entities;
using Heimdall.Domain.Enums;
using Microsoft.Extensions.Logging.Abstractions;
using NSubstitute;
namespace Heimdall.Application.Tests.Handlers.Notifications;
@@ -18,7 +19,7 @@ namespace Heimdall.Application.Tests.Handlers.Notifications;
public class NotificationHandlerTests
{
private static readonly IMapper Mapper = new MapperConfiguration(cfg =>
cfg.AddProfile(new NotificationMappingProfile())).CreateMapper();
cfg.AddProfile(new NotificationMappingProfile()), NullLoggerFactory.Instance).CreateMapper();
private readonly IApplicationDbContext _context;
private readonly CancellationToken _ct = CancellationToken.None;
@@ -1,6 +1,7 @@
using AutoMapper;
using Heimdall.Application.DTOs;
using Heimdall.Domain.Entities;
using Microsoft.Extensions.Logging.Abstractions;
namespace Heimdall.Application.Tests.Mappings;
@@ -11,7 +12,7 @@ public class MappingProfileTests
var config = new MapperConfiguration(cfg =>
{
cfg.AddMaps(typeof(Heimdall.Application.DependencyInjection).Assembly);
});
}, NullLoggerFactory.Instance);
return config.CreateMapper();
}
@@ -11,6 +11,7 @@ using Heimdall.Infrastructure.Services;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using NSubstitute;
using Shouldly;
@@ -45,8 +46,9 @@ public class NotificationServiceTests : IDisposable
_context.Database.EnsureCreated();
// Real AutoMapper with the actual notification mapping profile
// (v16 : constructeur 2 args — ILoggerFactory requis)
var mapperConfig = new MapperConfiguration(cfg =>
cfg.AddProfile<NotificationMappingProfile>());
cfg.AddProfile<NotificationMappingProfile>(), NullLoggerFactory.Instance);
_mapper = mapperConfig.CreateMapper();
_broadcast = Substitute.For<INotificationBroadcastService>();