Commit Graph
23 Commits
Author SHA1 Message Date
arnaud.dartois 1d60f04691 fix(auth): safely report cookie sign-in failures (#310)
Heimdall Gitea / Detect CI scope (push) Successful in 33s
Heimdall Gitea / Build and tests (push) Successful in 26m42s
Heimdall Gitea / Publish versioned release (push) Skipped
Heimdall Gitea / Build and scan server image (push) Successful in 8m45s
Heimdall Gitea / Build and scan agent image (push) Successful in 9m14s
Heimdall Gitea / Build and scan NVIDIA Agent image (push) Successful in 19m34s
Heimdall Gitea / Publish Docker Hub latest tags (push) Successful in 1m37s
Heimdall Gitea / CI policy (push) Successful in 2s
## Résumé
Le flux navigateur reçoit maintenant un résultat HTTP explicite du pont cookie; les échecs de cookie sont diagnostiqués sans exposer les messages d’exception ni les données de session. La validation 2FA par code de récupération recharge également l’utilisateur après rotation du security stamp avant d’émettre la session.

## Issue
Refs #304 — l’observation GlitchTip post-déploiement reste nécessaire avant résolution.

## Travail effectué
- `/_auth/signin` renvoie des erreurs génériques et journalise uniquement l’étape et le type d’exception.
- Le pont JavaScript retourne le statut HTTP; les interruptions de circuit sont distinctes des réponses non-2xx.
- Suppression des adresses e-mail des journaux auth/2FA.
- Correction du chemin code de récupération 2FA pour émettre un jeton cohérent avec le security stamp actualisé.
- Ajout de tests unitaires et d’intégration; documentation dans `skills/heimdall-identity/SKILL.md`.

## Preuves
- `dotnet restore tests/Heimdall.Web.Tests/Heimdall.Web.Tests.csproj --locked-mode` — réussi.
- `dotnet restore tests/Heimdall.IntegrationTests/Heimdall.IntegrationTests.csproj --locked-mode` — réussi.
- `AuthHelperTests` — 6/6 réussis.
- Tests d’intégration ciblés 2FA/recovery-cookie/TOTP-cookie/token malformé — 3/3 réussis.
- Acceptance Compose source-built `heimdall-auth-cookie-20261108170745-28547` — bootstrap 200, TOTP 200, cookie sign-in 200, API avec cookie 200, jeton malformé 401 générique, secrets absents des logs. Nettoyage vérifié: conteneurs/volumes/réseau absents et tag `heimdall:heimdall-auth-cookie-20261108170745-28547-central` supprimé.
- Analyse de l’événement GlitchTip: le circuit navigateur se déconnecte avant toute trace HTTP observée de `/_auth/signin`; la cause de cette occurrence production reste donc non démontrée. La correction améliore la visibilité sûre et le flux synthétique, sans prétendre reproduire cet événement.

## À suivre
Après déploiement de ce commit, observer GlitchTip pendant au moins sept jours et vérifier si HEIMDALL-DU réapparaît. Ne pas résoudre l’issue avant cette preuve réelle.

Reviewed-on: #310
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2026-11-08 20:03:03 +01:00
arnaud.dartois 6e61d38ca8 fix(web): serve native agent Python supervisor (#140)
Heimdall Gitea / Detect CI scope (push) Successful in 6s
Heimdall Gitea / Build and tests (push) Successful in 22m48s
Heimdall Gitea / Publish versioned release (push) Skipped
Heimdall Gitea / Build and scan server image (push) Successful in 8m18s
Heimdall Gitea / Build and scan agent image (push) Successful in 20m1s
Heimdall Gitea / Publish Docker Hub latest tags (push) Successful in 2m15s
Heimdall Gitea / CI policy (push) Successful in 12s
## Résumé

Ajoute le type MIME `text/x-python` au middleware statique Central. Sans cette association, ASP.NET Core renvoie 404 pour le superviseur Linux `.py` même si le fichier figure dans le publish.

## Validation

- Recette Compose jetable source : `/healthz` sain; `install-agent.sh` et `agent-supervisor.py` répondent 200 et sont identiques aux sources.
- Teardown vérifié : 0 conteneur, volume, réseau; tag unique supprimé et absent.
- `git diff --check` passé.

La vérification de l’instance publique reste requise après publication de l’image et redémarrage de Central.

Reviewed-on: #140
Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2026-11-06 09:41:48 +01:00
Arnaud Dartois 8d35518d1a feat(agent): add Pangolin-style native installs and updates
Heimdall Gitea / Detect CI scope (pull_request) Successful in 5s
Heimdall Gitea / Build and tests (pull_request) Failing after 2m11s
Heimdall Gitea / Build and scan server image (pull_request) Skipped
Heimdall Gitea / Build and scan agent image (pull_request) Skipped
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / Publish versioned release (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Failing after 3s
2026-10-26 11:38:29 +01:00
Arnaud Dartois 6503a17545 Merge main into repository health fix
Heimdall Gitea / Build and tests (pull_request) Failing after 1m2s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
2026-10-23 20:21:43 +02:00
Arnaud Dartois d93eaca043 Sign agent releases and complete snapshot media lifecycle 2026-10-23 18:54:14 +02:00
Arnaud Dartois 9e27e89af5 Fix health check failures and align patch dependencies
Heimdall Gitea / Build and tests (pull_request) Failing after 1m34s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
2026-10-23 03:14:43 +02:00
Arnaud Dartois f0cf011c30 Remove RabbitMQ and use existing SignalR agent channel
Heimdall Gitea / Build and tests (pull_request) Failing after 49s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
2026-10-21 17:52:53 +02:00
Arnaud Dartois 8cdbe6c7fa fix(deps): update vulnerable NuGet dependencies without weakening gates 2026-10-20 07:24:18 +02:00
Arnaud Dartois bf2ccad537 feat(broker): RabbitMQ + MassTransit job broker pour l'analyse inter-sites
feat(broker): add RabbitMQ + MassTransit job broker for cross-site analysis

Mutualise les ressources IA/GPU entre sites via un broker de jobs durable.
RabbitMQ + MassTransit avec connexion AMQP sortante (pas de port entrant).

- Heimdall.Contracts: contrats de messages partagés
- RabbitMQ: conteneur docker + credentials via env vars
- MassTransit Central: publication de jobs d'analyse
- MassTransit Agent: consommateur avec backpressure GPU

Fixes #72
2026-08-28 01:11:12 +02:00
Arnaud Dartois 2d1734114f feat(metrics): métriques OpenTelemetry Prometheus (spec §13.1) (#161) 2026-08-20 18:22:37 +02:00
Arnaud Dartois 2ac2789728 chore(hangfire): migrate from obsolete UsePostgreS 2026-08-20 18:14:28 +02:00
Arnaud Dartois 45ce41ce7e 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
2026-08-15 09:11:25 +02:00
Arnaud Dartois 17ed0a19a1 feat(web): navigation & layout responsive — drawer adaptatif, badge notif, dark toggle (Fixes #33)
- Drawer : Breakpoint.Sm + mini-variant (64px) — responsive mobile/desktop.
- Nav restructurée : Événements et Snapshots SORTIS de la section
  Administration (bug d'accès : masqués aux non-admin alors que les pages
  sont autorisées) — section Navigation pour tous les connectés.
- Badge notifications temps réel : NotificationsHubClient (SignalR,
  access_token JWT, reconnexion auto, fallback silencieux) +
  NotificationBadge dans l'AppBar (compteur non lues, clic → /events).
- Toggle clair/sombre dans l'AppBar (IsDarkMode du MudThemeProvider).
- PageTestBase : enregistre NotificationsHubClient pour les tests bUnit.
172 tests Web verts.
2026-08-10 22:49:37 +02:00
Arnaud Dartois d6c7ca1194 fix(web): bindings MudCheckBox/MudSwitch @bind-Value (au lieu de @bind-Checked)
MudBlazor 9.x ignore silencieusement l'attribut inconnu 'Checked'
(CaptureUnmatchedValues) : les checkboxes de rôles et les switches de
configuration ne se liaient jamais. Passage à l'API Value/ValueChanged
+ mise à jour MudBlazor 9.1.0 → 9.8.0 (Web + tests). Vérifié en réel :
la case Admin est cochée à l'ouverture du dialog utilisateur.
2026-08-10 16:46:08 +02:00
Arnaud Dartois 450e019617 feat(infra): intégration Sentry/GlitchTip complète
- Upgrade Sentry.AspNetCore v6.7.0 → v6.8.0
- Ajout Sentry base package à Infrastructure (pour SentryErrorReporter)
- Configuration SDK enrichie dans Web et Agent:
  - AutoSessionTracking=false (GlitchTip ne supporte pas)
  - EnableLogs=true (logs structurés)
  - CaptureBlockingCalls=true (détection .Result/.Wait())
  - CaptureFailedRequests=true (capture 4xx/5xx HttpClient)
  - IncludeActivityData=true (DiagnosticSource)
  - SetBeforeSend pour nettoyage PII (password, token, secret)
  - SetBeforeBreadcrumb pour filtrage breadcrumbs
  - SampleRate, AttachStacktrace, MaxBreadcrumbs configurés
  - Release depuis la config, Environment auto
  - StackTraceMode.Enhanced
  - double.Parse avec CultureInfo.InvariantCulture
  - UseSentry avec type explicite SentryAspNetCoreOptions
- Abstraction IErrorReporter dans Application (0 dép. Sentry)
- Implémentation SentryErrorReporter dans Infrastructure
- Enregistrement DI dans Infrastructure
- DSN de développement dans appsettings.Development.json
- .env.example avec Sentry__Dsn et Sentry__TracesSampleRate
2026-07-28 14:52:52 +00:00
Arnaud Dartois 1d70455abb fix(web): make integration tests work with Heimdall.Web as entry point
- Add InternalsVisibleTo for Heimdall.Api.Tests and
  Heimdall.IntegrationTests in Web.csproj
- Add partial class Program for WebApplicationFactory<Program>
- Pass builder.Environment.EnvironmentName instead of env var
  so AddInfrastructure correctly detects Testing environment
- Skip DATABASE_URL check, Hangfire setup, migrations, and
  recurring jobs when environment is Testing
- Update test project references from Heimdall.Api to Heimdall.Web
2026-07-20 20:32:32 +00:00
Arnaud Dartois d9a3ea52ba refactor: remove Heimdall.Api, move all routes into Heimdall.Web
Heimdall.Api controllers/hubs/filters were exact duplicates of
files already in Heimdall.Web (same namespace, same content).
The Api project was a leftover from before the single-image merge.

Changes:
- Add missing registrations to Web/Program.cs (JWT Bearer auth,
  rate limiting, controllers with ExceptionFilter, FluentValidation,
  SignalR + broadcast services, OpenAPI/Scalar, CORS, hub mappings)
- Add FluentValidation.AspNetCore, Scalar.AspNetCore,
  Microsoft.AspNetCore.OpenApi NuGet packages to Web.csproj
- Remove Heimdall.Api from solution and delete the project
- All routes continue working at their existing paths
2026-07-20 20:22:30 +00:00
Arnaud Dartois 630e7987fe refactor(docker): merge worker and web into single heimdall image
Combine Heimdall.Web and Heimdall.Workers into one process/image.
Hangfire background jobs now run inside the web process.

- Move job classes to Infrastructure/Jobs/ (no Worker SDK dependency)
- Add Hangfire server + recurring jobs to Web/Program.cs
- Add missing AddInfrastructure/AddApplication DI registrations to Web
- Rename image: heimdall (was heimdall-web / heimdall-workers)
- Remove src/Heimdall.Workers project entirely
- Remove tests/Heimdall.Workers.Tests (placeholder)
- Simplify Dockerfile: single build target, no workers publish
- Update docker-compose files: one service heimdall, no workers
- Update Makefile, .env.example
2026-07-20 17:22:56 +00:00
Arnaud Dartois cc52214404 feat: add Sentry (GlitchTip) client to Api, Agent, Web
Add Sentry.AspNetCore v6.7.0 with hardcoded DSN constant
(not overridable by env) pointing to GlitchTip instance at
https://glitchtip.tordais.cc/6.

Same DSN configured across all three entry-point projects:
- Heimdall.Api
- Heimdall.Agent
- Heimdall.Web
2026-07-18 19:41:57 +00:00
Arnaud Dartois 015711e156 fix(build): keep UseAppHost=false global for Alpine compatibility
Reverts per-project scoping from previous commit — Alpine build env
needs this globally because even Debug mode tries to create a native
host. The 4 Docker-published projects also inherit it from the global
Directory.Build.props.

Proper long-term fix: build CI on non-Alpine image, or set
UseAppHost=false only in Dockerfile publish args via /p flag.
2026-07-17 19:24:00 +00:00
Arnaud Dartois 3060f38979 fix(build): scope UseAppHost=false to Docker-published projects in Release only
The Alpine workaround was applied globally via Directory.Build.props,
preventing native host generation even for local dev builds. Moved to
only the 4 Docker-published projects (Api, Web, Workers, Agent) with
Condition='==Release'. Dev builds still get native
executables.
2026-07-17 19:22:05 +00:00
Arnaud Dartois b217c932e8 feat(mvp): implement MVP multi-site platform
Complete MVP implementation (Étape 1) covering:
- Domain: primitives (Entity<TId>, ValueObject), 10 entities, 6 enums
- EF Core: AppDbContext + Identity, 8 EntityTypeConfigurations, audit/soft-delete interceptors, initial migration
- Application: service interfaces, DTOs, FluentValidation, ServiceResult pattern
- Security: Identity + JWT + API Key multi-auth, role-based permissions, constant-time key validation
- API: Auth/Sites/Agents controllers with explicit auth scheme policies
- Workers: Hangfire PostgreSQL setup with schema isolation, HeartbeatMonitorJob
- Agent: registration service + 30s heartbeat loop
- Docker: multi-stage Dockerfiles for central + agent, docker-compose.yml
- CI/CD: GitHub Actions pipeline with build+test and Docker build
- Tests: 13 domain tests (Site, Agent, Camera entities)

Architecture decisions per deliberation council:
- API Key via AuthenticationHandler<T> (not middleware)
- Explicit [Authorize(AuthenticationSchemes)] on all endpoints
- Event/Recording/Person/Vehicle deferred from initial migration
- Hangfire compatible with .NET 10 (v1.8.17)
2026-07-16 20:53:56 +00:00
Arnaud Dartois bfb3e06bc1 feat: initialize .NET 10 Clean Architecture solution
Create Heimdall solution with 17 projects following Clean
Architecture for a maintainable and loosely coupled codebase.

src/ (9 projects):
- Domain, Domain.Primitives, Contracts (core layer, no deps)
- Application (ref. Domain) — CQRS/MediatR ready
- Infrastructure (ref. Application + Domain) — EF Core
  PostgreSQL ready
- Api, Web (Blazor), Agent, Workers (hosts, ref. Application +
  Infrastructure)

tests/ (8 projects):
- xUnit + Shouldly + NSubstitute + bUnit (Web.Tests)
- One test project per source project (Domain -> IntegrationTests)

Config: Directory.Build.props (Nullable, ImplicitUsings,
TreatWarningsAsErrors)
2026-07-16 19:09:28 +00:00