feat: build operational access audit console (#589)#601
Open
DeborahOlaboye wants to merge 9 commits into
Open
Conversation
Adds a full-stack admin console for reviewing operator permissions, access history, and sensitive administrative actions. Closes StellaBridge#589. - Backend: new /api/v1/admin/access-audit route with /entries, /stats, /roles, /sessions, and /export endpoints; restricted to admin:audit scope; flags privilege-escalation actions (permission changes, config edits, key revocations) - Frontend: OperationalAccessAudit page with three tabs — Access Changes (filterable, paginated audit log with diff viewer and flagging), Roles & Permissions (admin members + recent rotation events), and Sessions (active/expired/revoked user sessions) - Export: CSV download via authenticated fetch (x-api-key header) - Wired into App.tsx routing (/admin/access-audit) and Operations nav group
19467c6 to
6f463a3
Compare
Contributor
|
Good work so far, try to fix the Cl checks |
Contributor
Author
@Mosas2000 , Thank you. I'd work on that. |
Correlates price, liquidity, supply, and bridge-health signals to surface anomalies. Supports configurable thresholds per asset and bridge, tracks anomaly history with duplicate suppression, and exposes explainable detection output through API endpoints. Closes StellaBridge#587
Closes StellaBridge#590 Adds a safe sandbox where operators can test alert routing rules against synthetic data before enabling them in production. Backend: - POST /api/v1/admin/alert-routing/simulate dry-runs the routing evaluation logic for all active rules without dispatching anything. Returns per-rule match results with human-readable reasons and a summary (wouldDispatch, effectiveChannels, suppressionWindow). Frontend: - AlertSimulationSandbox page at /alert-sandbox with a two-panel layout. - Left panel: admin token input, six scenario presets (critical bridge failure, token exploit, TVL anomaly, reserve drift, gas spike, maintenance), and a full parameter form (severity, assetCode, sourceType, metric, triggered value, threshold, owner, run label). - Right panel: Results tab showing summary cards, effective channels, per-rule breakdown with match/no-match indicators and condition explanations, inactive-rule disclosure; History tab listing past runs stored in localStorage (up to 20), clickable to restore. - useAlertSimulation hook manages API calls, error state, and localStorage persistence of simulation history. - Nav entry added to the Operations group in MobileNav navigation.ts and route registered in App.tsx.
Adds a full-stack admin console for reviewing operator permissions, access history, and sensitive administrative actions. Closes StellaBridge#589. - Backend: new /api/v1/admin/access-audit route with /entries, /stats, /roles, /sessions, and /export endpoints; restricted to admin:audit scope; flags privilege-escalation actions (permission changes, config edits, key revocations) - Frontend: OperationalAccessAudit page with three tabs — Access Changes (filterable, paginated audit log with diff viewer and flagging), Roles & Permissions (admin members + recent rotation events), and Sessions (active/expired/revoked user sessions) - Export: CSV download via authenticated fetch (x-api-key header) - Wired into App.tsx routing (/admin/access-audit) and Operations nav group
- Remove extra closing brace at lib.rs:5783 that prematurely closed the impl BridgeWatchContract block, causing unexpected delimiter error at 8670 - Fix pool_events composite primary key (id, time) so TimescaleDB hypertable creation on the time column succeeds without index conflict - Lowercase github.repository in release-dry-run.yml Docker image tags to satisfy OCI registry requirement for lowercase image names
- Remove leftover git conflict marker (>>>>>>>) at lib.rs:1066 that was blocking Rust compilation - Fix search_analytics composite primary key (id, time) to satisfy TimescaleDB hypertable partitioning constraint in migration 006 - Reformat relay_contract_fuzz.rs to match rustfmt style: fix loop body indentation, expand inline if-else arms, wrap long method chains
- Remove stray brace and conflict marker from contracts/soroban/src/lib.rs - Run cargo fmt --all to fix formatting across all Rust source files - Fix TimescaleDB composite primary keys in migrations 007, 008, 017, 020, 022 - Update E2E mockApi with correct bridge names, wider globs, and catch-all route
7984c6b to
e557c27
Compare
Contributor
|
Good implementation, fix the conflict. |
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.
Overview
This PR implements the Operational Access Audit Console as described in issue #589. The feature adds a dedicated admin interface for reviewing operator permissions, tracking access changes, inspecting active sessions, and exporting audit data.
What was built
Backend —
backend/src/api/routes/operationalAccessAudit.tsA new Fastify route module registered at
/api/v1/admin/access-auditwith five endpoints:/entries/stats/roles/sessions/exportContent-Dispositionheader)Access control:
admin:auditscopeadmin:auditandadmin:configscopes401if thex-api-keyheader is absent,403if scopes are insufficientFlagging logic:
The following actions are automatically flagged as requiring review:
admin.user_permission_changedadmin.config_changedadmin.retention_policy_changedauth.api_key_revokedAny entry with
warningorcriticalseverity is also surfaced as flagged regardless of action type.Reuses existing services — no new DB migrations needed:
AuditService— queries the existingaudit_logstable (TimescaleDB hypertable)AdminRotationService— reads admin members and rotation eventsSessionService— readsuser_sessionsandsession_audit_logtablesFrontend —
frontend/src/pages/OperationalAccessAudit.tsxA full admin page at
/admin/access-auditstructured into three tabs:Tab 1 — Access Changes
<details>)fetchdownloadTab 2 — Roles & Permissions
Tab 3 — Sessions
UX details:
stellar-blue,stellar-dark,stellar-card,stellar-border,stellar-text-secondarybridge-watch:admin-api-key:v1key — no separate login needed if the user is already authenticated on another admin pageTypes —
frontend/src/types/index.tsNew exported interfaces:
AccessAuditEntry— mirrorsAuditEntryfrom the backend serviceAccessAuditStats— stats shape returned by/statsAdminMember— admin account with roles and activation stateAdminRotationEvent— role change / add / remove eventAccessSession— user session recordAccessAuditAction,AccessAuditSeverity,AdminMemberRole,AccessSessionStatus,AdminRotationEventTypeAPI service —
frontend/src/services/api.tsFive new exported functions:
getAccessAuditEntries(apiKey, options)getAccessAuditStats(apiKey, from?)getAccessAuditRoles(apiKey, activeOnly?)getAccessAuditSessions(apiKey, options)exportAccessAudit(apiKey, options)— usesfetch+URL.createObjectURLto trigger a real file download with the API key sent as a request header (not a query param)Routing & navigation
frontend/src/App.tsx: lazy-loadedOperationalAccessAuditcomponent at/admin/access-auditfrontend/src/components/MobileNav/navigation.ts: "Access Audit" added to the Operations nav group with description "Review operator roles, permissions, and access history"backend/src/api/routes/index.ts: route registered at/api/v1/admin/access-auditCloses #589