Commit Graph
5 Commits
Author SHA1 Message Date
Arnaud Dartois f832d2fb62 refactor: use EF Core for SQLite persistence
Heimdall Gitea / Detect CI scope (pull_request) Successful in 4s
Heimdall Gitea / Build and tests (pull_request) Successful in 14m48s
Heimdall Gitea / Publish versioned release (pull_request) Skipped
Heimdall Gitea / Build and scan server image (pull_request) Successful in 4m24s
Heimdall Gitea / Build and scan agent image (pull_request) Successful in 9m12s
Heimdall Gitea / Publish Docker Hub latest tags (pull_request) Skipped
Heimdall Gitea / CI policy (pull_request) Successful in 4s
2026-10-26 08:19:44 +01:00
Arnaud Dartois 8cdbe6c7fa fix(deps): update vulnerable NuGet dependencies without weakening gates 2026-10-20 07:24:18 +02:00
Arnaud Dartois 17b973f010 fix(agent): chiffre l'API key au repos (IDataProtector) (#116)
Closes #21

L'API key de l'agent était persistée **en clair** dans `agent-state.json` (0600). Ce fix la chiffre au repos avec ASP.NET Core Data Protection (`IDataProtector`) :

- `AgentState.SaveAsync` écrit `apiKey` chiffrée + marqueur `apiKeyProtected: true` (format camelCase, lecture case-insensitive pour compat)
- Key ring Data Protection dans `{StateDirectory}/dp-keys` (0700), persisté pour survivre aux redémarrages
- **Migration automatique** : les fichiers legacy en clair sont détectés au `LoadAsync` et réécrits chiffrés immédiatement
- `SaveAsync` échoue si aucun protector n'est fourni — pas de fallback plaintext silencieux
- Key ring non déchiffrable → état traité comme corrompu, l'agent se ré-enregistre (log warning)

## Vérifications

- `dotnet build` : 0 warning / 0 erreur (TreatWarningsAsErrors)
- Tests Agent : **197/197 ✅** (dont 5 nouveaux : pas de clair sur disque, migration legacy, échec déchiffrement, fail-fast sans protector)
- Suite complète : Domain 142, Application 391, Web 225, Api 2, Integration 125 ✅ (en isolation)
- Échecs Infrastructure (24) : **préexistants sur main** (fixture Testcontainers `PostgreSqlContainer` — vérifié sur worktree baseline origin/main)

## Prod hardening (option documentée dans le code)

IDataProtector protège contre la lecture du fichier d'état seul. Contre une compromission complète du volume (qui exposerait aussi le key ring), binder le key ring à un TPM/HSM ou le monter hors du volume sauvegardé.

Reviewed-on: https://forgejo.tordais.cc/nonobis/Heimdall/pulls/116
2026-08-14 14:01:42 +02:00
Arnaud Dartois 3fc42be4b2 test(agent): add unit tests for AgentState, AgentHealthCheck, AgentRegistrationService
13 tests covering:
- AgentState file persistence (save, load, corrupt file, empty ID, clear)
- AgentHealthCheck (healthy, degraded, unhealthy states)
- AgentRegistrationService (successful registration, retry on failure,
  all retries exhausted, reuse existing identity, offline heartbeat on stop)
2026-07-18 14:16:13 +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