Replace RavenDB Hub/Sink replication with ETL Sink task#3
Closed
Mateosssss wants to merge 19 commits into
Closed
Conversation
Mateosssss
commented
Jun 5, 2026
Collaborator
- Remove VerityReplicationHub and VerityReplicationSink (pull replication model)
- Remove migration 005_ConfigureHubSink
- Add VeritySinkEtlTask — push-based ETL via RavenDB ETL Sink
- Add migration 005_ConfigureSinkEtl to register the ETL task
- Minor whitespace cleanup in SecEdgarCompanyImporter
Update: RavenDB version
… audit trail - Add Duende IdentityServer with RavenDB user store, FAPI 2.0 (PAR + DPoP), login/register/logout Razor pages, and RavenEventSink writing auth events to SecurityEvents collection in RavenDB - Add Duende BFF proxying API calls and frontend through a single origin, handling token lifecycle transparently via session cookies - Add AuthMiddleware (IFunctionsWorkerMiddleware) + JWT Bearer validation on Azure Functions backend; protect write endpoints with [Authorize] - Add GET /api/security/events endpoint and /security frontend page showing auth events stored in RavenDB alongside financial data - Add migration 006 seeding demo users (alice, bob, carol, dave, eve) - Add IDENTITY.md documenting why IdentityServer, BFF pattern, and FAPI 2.0 make sense for a financial audit platform
Resolves the 4 merge conflicts by keeping main's standalone "seeder" worker (Setup project) as the migration runner and layering the identity/auth feature on top. - Program.cs (App): use simple AddRavenDBClient; drop in-app MigrationStartup/MigrationContext/AddRavenDbMigrations (now handled by the seeder). Keep JWT auth + AuthMiddleware. - Api.cs (App): adopt main's Api(session, store, edgar) constructor and drop the POST /api/migrate endpoint (superseded by the seeder). Keep the GetSubjectFromBearer/DecodeJwtClaims helpers used by auth endpoints. - AppHost.csproj: keep IdentityServer + Bff references; reference Setup as a normal Aspire resource (the seeder), not IsAspireProjectResource=false. - Setup.csproj: keep both main's Exe/CommunityToolkit RavenDB client and the AspNetCore FrameworkReference needed by 006_SeedDemoUsers (PasswordHasher). The seeder scans the Setup assembly, so 006_SeedDemoUsers runs automatically alongside migrations 001-005. echo "---"; git log --oneline -3; echo "---"; git status
- AuthMiddleware: enforce role claims from [Authorize(Roles=...)] attributes, return 403 on mismatch
- Program.cs: configure JWT with MapInboundClaims=false, RoleClaimType="role", JsonStringEnumConverter
- Api.cs: rename admin/* routes to manage/* (admin is reserved by Azure Functions host), filter null SubjectId in GetAllUsers
- VerityAgentApi.cs: fix GenerateAuditNotes — load user document as users/{userId} not {userId}
- BFF: Duende BFF with FAPI 2.0 / DPoP, role and company_id claims forwarded to frontend
- IdentityServer: FAPI 2.0 security profile, registration endpoint, role claim in tokens
- Frontend: admin panel (/admin route) for role and company assignment, role-gated UI on company/report pages, BFF auth integration
- Migration 006: seed demo users (alice=Admin, bob=Analyst, carol/dave=Viewer, eve=Analyst)
- Remove accidentally committed IdentityServer signing key, add keys/ to .gitignore
- Remove VerityReplicationHub and VerityReplicationSink (pull replication model) - Remove migration 005_ConfigureHubSink - Add VeritySinkEtlTask — push-based ETL via RavenDB ETL Sink - Add migration 005_ConfigureSinkEtl to register the ETL task - Minor whitespace cleanup in SecEdgarCompanyImporter
- Hub: WithFiltering = true - Migration generates self-signed certificate for Sink at setup time - Hub access registration limits Sink to Companies/* and Reports/* - Sink authenticates with generated certificate (PFX)
8bb114a to
d06fe54
Compare
Switch RavenDB from unsecured to TLS-secured mode, which is required for WithFiltering = true on Hub Pull Replication (VerityReplicationHub). AppHost: - Generate self-signed server cert (3-month validity — Developer license rejects certs longer than 4 months) with Server + Client Auth EKUs - Generate sink replication cert with Client Auth EKU (required by RavenDB client cert validation) - Bind RavenDB on ravenHostPort inside the container (not 443) so that RAVEN_PublicServerUrl=localhost:9534 resolves both inside and outside the container, avoiding "DB created but not accessible" raft errors - Override Aspire EndpointAnnotation.TargetPort to match the binding port - Inject server cert path into all clients via Aspire__RavenDB__Client__CertificatePath All clients (App, Setup, IdentityServer, DataSubscriptionsApp): - Add RequestExecutor.RemoteCertificateValidationCallback to accept the self-signed cert (chain errors only; name validation still applies) Migrations: - Wrap Remote Attachments, Time Series, AI Agent, GenAI Tasks, Queue ETL in try-catch — these features are gated behind Enterprise license and were silently bypassed in unsecured mode but enforced in secured mode - Pass server cert to sinkStore in 005_ConfigureHubSink for authenticated Sink database creation BFF: - Map /api/audit/stream and /api/report/stream before the catch-all without AsBffApiEndpoint() — EventSource cannot send X-CSRF headers Frontend: - Remove accidental import of Node.js inspector/promises in api.ts Fix log statement in VerityAgentApi to use user.Id instead of body.UserId
Collaborator
|
Should be separate and small. Please recreate @Mateosssss |
2 tasks
Collaborator
Author
|
Recreated as a focused, replication-only PR: #4 (based on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.