Migrate from Microsoft.NET.Sdk.Worker to Microsoft.NET.Sdk.Web to
enable HTTP health checks. Add /healthz endpoint via
AgentHealthCheck (reports healthy when registered with Central).
Configure Docker HEALTHCHECK with 30s interval and 15s start period.
Heimdall.Agent does not use EF Core, Identity, or any Infrastructure
services. Removing the reference eliminates unnecessary transitive
dependencies (Npgsql, Hangfire, EF Core) and speeds up builds.
Add explicit Microsoft.Extensions.Http package (was transitively
provided by Infrastructure).
Introduce SystemMetricsProvider that reads /proc on Linux (with
safe fallbacks on other platforms) and includes CPU usage, memory
usage, disk usage, and uptime in every heartbeat payload. Allows
Central to monitor agent health proactively.
Replace the mutable AgentState POCO with a file-persisted version.
On startup, load existing identity from /var/lib/heimdall/agent-state.json
and skip re-registration. On first registration, save identity to disk.
Prevents orphaned agents in Central after agent restarts.
Override StopAsync to send a final heartbeat with IsOffline=true
before the agent stops. This allows Central to distinguish between
intentional shutdown and unexpected disconnection.
Wrap agent registration in 5-attempt retry loop with exponential
backoff (2^attempt seconds). Prevents crash-loop when Central is
temporarily unavailable on startup. OperationCanceledException
bubbles up immediately for clean shutdown.
Use IHttpClientFactory instead of manual new HttpClient() in
ResolvePublicIpAsync to prevent socket exhaustion in long-running
agent service. Register a named 'IpResolver' client for this purpose.
bunit 2.8.4-preview transitively pulls AngleSharp 1.4.0 which has a
known moderate severity vulnerability (GHSA-pgww-w46g-26qg). Adding
a direct PackageReference to AngleSharp 1.5.2 overrides the transitive
version and resolves the CI build failure.
Alarik is a drop-in S3-compatible replacement requiring no application
code changes. All S3 APIs (upload, download, list, delete, multipart)
are fully supported.
Adds .AsNoTracking() to all read-only list/pagination queries in
SiteService, AgentService, CameraService, AuditLogService, and
UserService. Prevents EF Core change tracker overhead when only
displaying data.
UserService.ListAsync and UserSites query benefit most (materialize
AppUser/UserSite entities). AuditLogService, SiteService, CameraService,
AgentService paginated lists are read-only so AsNoTracking is safe.
- Add ICredentialProtector/DataProtectorCredentialProtector using ASP.NET Core Data Protection
- Register AddDataProtection + ICredentialProtector in Infrastructure DI
- Update CameraCredentials XML comments to reference real protector
- Add SetCredentialsAsync to CameraService with encryption
- Update ICameraService interface
No implementation exists and no controller injects it.
The DTOs (ApiKeyResponse, CreateApiKeyResponse) are kept
as they may be reused by a future endpoint.
- Mark ✅/⏳ for all 23 phases based on actual implementation
- Add stats: 83 files, 34 tests, 13 pages, 30+ endpoints
- Clearly separate done vs v2/v3 (hardware-dependent)
- Document stack choices (no MediatR at MVP)
ListAsync called UserManager.GetRolesAsync() per user (N queries
for N users). Now loads all roles and user-site assignments in two
bulk queries, grouped by userId in memory for O(1) lookup.
Added IsUnicode(false) to hostname, version, status, IP, hash,
prefix, key, URL, timezone, theme, language, YOLO model name,
and enum-based string columns. These columns only contain ASCII
data — disabling Unicode improves PostgreSQL index efficiency
and reduces storage.
Excluded natural text columns (Address, DisplayName, Site.Name)
that may contain Unicode characters like accented letters.
All sensitive fields (OnvifPassword, RtspPassword, etc.) had public
setters allowing uncontrolled modification. Encapsulated via private
setters with a dedicated SetCredentials() method that updates all
values atomically and sets UpdatedAt.
Replaced the always-null GetPublicIp stub with a proper async
implementation. IP is resolved once at registration time (not per
heartbeat) and stored in AgentState for reuse. Uses 5s timeout
and graceful failure (null if unreachable).
Added SHA256 blacklist of revoked refresh tokens (in-memory
ConcurrentDictionary). RefreshTokenAsync now checks the blacklist
before validating the token. LogoutAsync hashes and stores the
revoked token. Added audit log entry for logout.
For multi-instance deployments, replace with DB-backed store.
IStatsService was the only service returning raw Task<T> instead of
ServiceResult<T>. Also fixed 'activeSites = totalSites' copy-paste
bug — now counts sites where Enabled == true.
The seed password 'Admin123!' (9 chars) was silently rejected by
UserManager.CreateAsync because Identity Password.RequiredLength=12.
Updated to 'Admin123!Pass' (13 chars) and synchronized in readme.md
and Api.http.
NavMenu.razor contained Counter/Weather links from the default Blazor
template and was never used (MainLayout.razor has its own navigation).
Removed the associated scoped CSS file to fix BLAZOR102 build error.
StatsController was constructing an anonymous response object that
differed from the StatsResponse DTO shape. Now wraps the actual DTO
in a standard envelope { data, timestamp } consistent with the rest
of the API.
Both CreateAsync and RegisterAsync called SaveChangesAsync twice —
once for the main operation and once for the audit log. This creates
a risk of partial persistence if the second call fails.
Moved audit log addition before a single SaveChangesAsync call.
Added AppUser navigation property to AuditLog entity with EF Core
configuration (FK -> UserId, SetNull on delete). Replaced the sub-query
in AuditLogService ListAsync with a direct navigation property access,
enabling EF Core to generate a single LEFT JOIN instead of N sub-queries.
Migration: AddAuditLogUserRelation
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.
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.
Query string (?apiKey=...) leaks credentials in server logs, referrer
headers, and browser history. Only Authorization header and X-API-Key
header are now accepted for API key authentication.
Setting LockoutEnd to UtcNow locked the user out instead of forcing
a password change. Added MustChangePassword boolean to AppUser entity
with EF Core migration. ResetPasswordAsync now sets this flag instead
of locking the account.
GenerateTemporaryPassword now uses RandomNumberGenerator (cryptographic)
and guarantees at least 1 digit, 1 lowercase letter to satisfy Identity
password rules (RequireDigit=true, RequireLowercase=true).
Also shuffles the result to avoid predictable position patterns.
Fixes flaky ResetPassword_WithAdminAuth_ReturnsTemporaryPassword test.
- Full project documentation in readme.md (FR)
- Quick start: Docker + development modes
- API endpoint reference table with auth requirements
- Security documentation (JWT, API Key, rate limiting)
- Test suite documentation (34 tests)
- Stack technology table
- IAuditLogService + AuditLogService avec pagination et filtres
- AuditLogsController: GET /api/audit-logs (resourceType, action, page)
- AuditLogsPage Blazor: liste paginée avec filtres + coloration par action
- Lien vers le journal dans le menu Admin (visible pour les Admins)
Forgejo-only CI enforcement:
- cicd-pipeline skill: forgejo.tordais.cc by default, GA = legacy
- devops-agent: .forgejo/ scope, blocking CI checklist
- pre-commit hook: CI lint blocks GA references
- scripts/ci-lint.sh: standalone audit with --fix
- enforcement.md: CI lint in pre-commit checklist
- Add Scalar.AspNetCore package (beautiful OpenAPI UI)
- MapScalarApiReference() available at /scalar in Development
- Complement to the existing /openapi/v1.json endpoint
- Add PlaceholderTest.cs to Api.Tests, Application.Tests, Infrastructure.Tests,
Web.Tests, Workers.Tests (1 passing test each)
- Prevents 'no test available' warnings in CI
- Add RegisterAdminAsync to IAuthService interface
- Implement in AuthService (creates user + assigns Admin role)
- AuthController.register-admin now delegates to service layer
- No more 'new AppUser' in controller
- StatsController: aggregates sites, cameras, agents counts in one DB query
- Dashboard: now uses stats endpoint (2 API calls instead of N*2+1)
- ApiClient: GetStatsAsync + StatsResult DTO
- Dashboard now shows: total sites, total cameras, online agents, active sites
- Stats loaded in parallel with Task.WhenAll for performance
- Falls back gracefully if cameras/agents endpoints return no data
- Users: replace single MudSelect role picker with MudCheckBox multi-select
- Users: users can now have multiple roles (Admin + Supervisor, etc.)
- Users: edit dialog validates at least one role is selected
- Build: suppress MudBlazor analyzer MUD0002 (false positive on Checked bind)
- Login: redirect to original page after auth via returnUrl query param
- RedirectToLogin: encodes current URL as ?returnUrl=/path
- API URL: configurable via appsettings.json ApiBaseUrl or API_BASE_URL env
- NotFound page: preserved from template