Feature RBAC maintenance#152
Conversation
hierarcy;
403 resp;
v2 created_by added for events and statuses;
TestValidateStatusesPatches relocated to v2_validation_test.go; 06 migration changed; new errores for maintenance validation; Incident model changed; TestValidateEventCreationTimes added; TestValidateEventCreationImpact added;
implemented SetJWTClaims.
…ame HasGroup to HasAuthorizedGroup
…gration RBAC tests
go version updated
7b950bc to
133b697
Compare
… from unauthenticated users
|
make version optionally for incidents and info |
rbac tests redesigned, main tests fixed.
|
Multi-IdP Authentication & RBAC Security Hardening (refactoring) SummaryImplements a "secure by default" architecture by removing all authentication/RBAC bypass toggles and adding dual-IdP support (Keycloak RSA + Local HMAC). Introduces structured audit logging, Keycloak resilience with retry/fallback, JWT audience validation, and comprehensive test coverage. Breaking Changes
Changes by CategorySecurity
Observability
Middleware Refactoring
Tests (new files)
Documentation
Test Coverage
|
Public key caching removed.
version field assert for incidents (tests) removed
fix(checker): handle optimistic locking race condition in maintenance processingProblemThe background When
SolutionIntroduced retry-with-refetch pattern in a new
Behavior Change
Code Changes
Execution Flow |
You can do it simpler. Because we will change this table, I won't use any db schemas changes. And you can just get the maintenance right before the patch and compare. |
…d improve reliability
events and update feature specifications
Review: Maintenance Visibility Rules & Checker SimplificationCommits:
|
| Test | Scenario |
|---|---|
TestVisibility_PendingReviewHiddenFromUnauth |
pending_review hidden from public |
TestVisibility_ReviewedHiddenFromUnauth |
reviewed hidden from public |
TestVisibility_CancelledMaintenanceWithoutPublicStatus |
cancelled before planned → hidden |
TestVisibility_CancelledAfterReviewedHidden |
pending_review → reviewed → cancelled → hidden |
TestVisibility_CancelledMaintenanceAfterPlanned |
cancelled after planned → visible |
TestVisibility_InternalStatusesFilteredFromUpdates |
updates array filtering |
TestVisibility_IncidentNotFiltered |
incident events unaffected |
TestVisibility_InfoEventNotFiltered |
info events unaffected (including cancelled) |
TestIsCancelledWithoutPublicStatus |
unit tests for the helper function |
TestToPublicIncidents_FiltersUpdates |
V1 status filtering |
Documentation Updated
docs/auth/permissions.md— expanded Visibility Rules sectionspecs/001-maintenance-rbac/spec.md— added FR-022-2, FR-022-3, FR-022-4, FR-023e
Notes
- Original implementation in
v2.gocontained logic to hide cancelledinfoevents withoutactivestatus — this was removed as it violates the requirement that onlymaintenanceevents are subject to visibility filtering. - Unit test
info_cancelled_without_active_statuswas corrected to expectfalse. - V1 test
TestToPublicIncidents_FiltersUpdateswas fixed (missingStartDatecaused nil dereference).
Implements Role-Based Access Control (RBAC) for maintenance event management as specified in
specs/001-maintenance-rbac/spec.md.Changes:
RBAC Implementation:
Admin>Operator>Creatorgroupsclaim via environment variables (SD_RBAC_GROUP_ADMINS,SD_RBAC_GROUP_OPERATORS,SD_RBAC_GROUP_CREATORS)Maintenance Workflow:
pending_reviewstatus, can modify/cancel own events while pendingpending_review→reviewed), cancel any pending event, create withplannedstatusreviewed→plannedField Visibility:
creator,contact_email,versionfields visible only to authenticated userspending_revieworreviewedstatus hidden from unauthenticated usersOptimistic Locking:
409 Conflicton version mismatchDocumentation:
docs/auth/rbac.mdwith roles, permissions, and workflowopenapi.yamlwith security schemes, RBAC description, 401/403/409 responsesreviewedstatus visibilityTesting:
Updates:
Testing: