API keys used by camera agents were missing 'permission' claims,
causing all endpoints with ApiKey + Policy to return 403 Forbidden
(e.g. POST /api/events, POST /api/events/{id}/snapshot).
Add CameraWrite, CameraRead, CameraLive, SiteRead, EventRead
permissions — matching agent operational needs (Supervisor minus
Person permissions).
- First registered user is auto-assigned Admin role (empty DB)
- Add auth.public-registration.enabled setting to disable public
registration (only admins can create users via POST /api/users)
- Add DELETE /api/users/{id} endpoint (Admin only) with guards:
- Cannot delete own account
- Cannot delete the last administrator
- Guard AssignRolesAsync to prevent removing Admin from last admin
- Add AuthSettings constants class for well-known setting keys
Changed BoundedChannelFullMode from DropOldest to DropWrite.
With DropOldest, the oldest queued job is silently removed when the
channel is full, but its TaskCompletionSource is never completed —
causing the caller to hang indefinitely.
DropWrite rejects new writes when full, returning TryWrite=false,
which triggers the existing graceful fallback (tcs.TrySetResult(null)).
The returnUrl query parameter is now validated as a local/relative URL
(starts with '/' and does not contain '://') before being used as a
redirect target after login.
Both Login and Register pages had identical JsRuntime.InvokeVoidAsync calls
with the same anonymous object shape. Extracted to a shared AuthHelper
static class with SignInAsync(IJSRuntime, object) and CreateSignInPayload(UserInfo).
- New file: Services/AuthHelper.cs
- Login.razor and Register.razor now call AuthHelper.SignInAsync
- Pre-existing fix: Person.cs IAuditableEntity setters made public
Define --auth-* variables on .auth-page for all colors, shadows, and
backgrounds. Dark mode now only overrides variables on .auth-page —
zero selector duplication, single source of truth for theme values.
- Disable auth-card entrance animation when user prefers reduced motion
- Disable auth-footer link color transition
- Respects WCAG accessibility guidelines for vestibular disorders
- Light mode: .auth-header p and .auth-footer p #64748b → #475569 (~6.5:1 contrast)
- Dark mode: .auth-header p and .auth-footer p #94a3b8 → #cbd5e1
Both pass WCAG AA and now approach AAA (7:1) for small text readability.
Adds S3-compatible snapshot storage (Alarik) with AWS Signature V4,
upload, thumbnail, and delete operations. Backfills Phase 2 & 3 with
27 new tests covering camera assignment strategies, event CRUD with
filtering, snapshot attachment, and API contract validation.
- SnapshotService with S3 REST API via HttpClient + SigV4 signing
- 10 unit tests for CameraAssignmentService (assign, release, failover, history)
- 9 unit tests for CameraEventService (create, query, filter, delete, snapshot)
- 8 integration tests for AssignmentsController + EventsController
- SnapshotService registration with 5-min timeout HTTP client
Multi-agent sites need automatic camera distribution, failover when
an agent goes offline, and rebalancing when new agents join.
Adds CameraAssignment entity with audit trail, 4 assignment strategies
(RoundRobin, GpuPriority, LeastCameras, Failover), a Hangfire failover
job that checks for stale heartbeats every 60s, a discovery coordinator
for leader election, 6 REST endpoints, EF migration, and DI registration.
Manual camera configuration does not scale beyond a few devices.
Automated discovery is needed to support deployments with 50+
cameras across heterogeneous protocols (ONVIF, mDNS, HTTP, ARP).
Phase 1 introduces 5 network probe services, a stream tester, an
orchestrating discovery service with IP+MAC deduplication, 11 REST
endpoints, a pre-verification endpoint, 57 tests, and DI registration.
Add complete camera discovery and stream testing specification,
Domain entities, enums, DTOs, Application interfaces, and EF Core
configurations for automated ONVIF/mDNS/HTTP/ARP camera detection.
- 4 new enums: CameraDiscoveryMethod, DetectedCameraType,
StreamProtocol, CameraCapability (flags)
- Camera entity extended with 15+ discovery/test fields
- New entities: CameraDiscoveryResult, DiscoveredStreamUrl
- DTOs: ProbeRequest/Response, StreamTestRequest/Session, etc.
- Interface: ICameraDiscoveryService (8 methods)
- EF Core configurations for all new tables + columns
- Full spec doc: docs/specifications/detection-camera.md (16 sections)
- 145 tests pass, 0 warnings
Inspiré de Strix (github.com/eduard256/Strix) — moteur de
découverte de flux IP supportant 3600+ marques, 100K+ patterns.
The service was registered only as AuthenticationStateProvider (base class),
but Login.razor, Register.razor, and MainLayout.razor inject the concrete
@inject HeimdallAuthStateProvider. Blazor's DI could not resolve it,
causing InvalidOperationException on page render.
Fix: register the concrete type first, then make the base class
registration resolve to the same instance via GetRequiredService.
- 🔴 Fix startup crash when DB is temporarily unavailable: add 5x retry
with exponential backoff to Database.MigrateAsync() in API and Workers
- 🔴 Fix EF Core 'required navigation with query filter' warnings:
add matching soft-delete query filters to AgentSetting, CameraCredentials,
CameraDetectionProfile, UserSite
- 🔴 Add Sentry error tracking to Workers (Hangfire background jobs)
- 🟡 Make Sentry/GlitchTip DSN configurable via SENTRY_DSN env var
(applies to API, Web, Agent, Workers)
- 🟡 Suppress EF Core RedundantIndexRemoved informational messages
Closes GlitchTip #538
Fix the filtered index column name casing in ALL .Designer.cs files
and AppDbContextModelSnapshot.cs:
- "status" → "Status" (Agent.LastHeartbeat index)
- "is_deleted" → "IsDeleted" (Site.IsDeleted index)
These must match the actual column names (PascalCase) since
PostgreSQL quoted identifiers are case-sensitive.
Also fix the InitialCreate migration .cs file directly.
All 10 references across 5 snapshot files corrected.
Pattern #4 from cross-project learning analysis: HeartbeatMonitorJob
injected AppDbContext directly (not thread-safe). Changed to
IDbContextFactory<AppDbContext> + registered factory in DI.
Other patterns verified already in place:
- CancellationToken on all async methods ✅ (100% controller adoption)
- N+1 per-entity loops ✅ (all services use bulk-loading)
- AsNoTracking ✅ (explicit on read-only queries)
- Global QueryTrackingBehavior.NoTracking deferred: safe for
new projects but requires write-path audit on existing codebase
The filtered index IX_sites_IsDeleted uses a WHERE clause
referencing "is_deleted" (lowercase underscore) but the column
is "IsDeleted" (PascalCase). PostgreSQL quoted identifiers are
case-sensitive, causing Npgsql.PostgresException on migration.
Fixes remaining HEIMDALL issues on GlitchTip.
The filtered index IX_agents_LastHeartbeat uses a WHERE clause
referencing "status" (lowercase) but the column is "Status"
(PascalCase). PostgreSQL quoted identifiers are case-sensitive,
causing Npgsql.PostgresException 42703 on migration.
Fixes HEIMDALL-2 on GlitchTip.
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
Replace the background MigrationHostedService with inline
db.Database.MigrateAsync() before Identity role seeding. The
IHostedService started after app.Run(), but seeding ran synchronously
before app.Run() — causing 42P01 when RoleManager queried the roles
table that didn't exist yet.
- Add await db.Database.MigrateAsync() with 120s timeout before seeding
- Add structured logging (ILogger) and error handling around migration
- Remove MigrationHostedService.cs (dead code — inline migration makes
it permanently no-op)
- Remove unused using Heimdall.Infrastructure.Services
- Unify using style (using var instead of using block)
Worker.cs was a template artifact that only logged 'running' every
second. It was never registered in DI. AgentRegistrationService
handles all background work.