feat(platform): harden telemetry pipeline and unify Semi UI workspaces
This commit is contained in:
@@ -253,6 +253,8 @@ func requiredRole(r *http.Request) string {
|
||||
path := r.URL.Path
|
||||
if r.Method == http.MethodPost {
|
||||
switch path {
|
||||
case "/api/v2/auth/logout":
|
||||
return "viewer"
|
||||
case "/api/vehicle-service/overviews", "/api/history/raw-frames/query", "/api/v2/access/summary", "/api/v2/access/vehicles", "/api/v2/alerts/summary", "/api/v2/alerts/events", "/api/v2/exports":
|
||||
return "viewer"
|
||||
case "/api/v2/alerts/notifications/read":
|
||||
|
||||
@@ -147,6 +147,15 @@ func TestAPIAuthSessionAndDisabledMode(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuthSelfServiceEndpointsAllowCustomerRole(t *testing.T) {
|
||||
if role := requiredRole(httptest.NewRequest(http.MethodPost, "/api/v2/auth/logout", nil)); role != "viewer" {
|
||||
t.Fatalf("logout should allow authenticated customers, required role=%s", role)
|
||||
}
|
||||
if role := requiredRole(httptest.NewRequest(http.MethodPut, "/api/v2/auth/password", nil)); role != "viewer" {
|
||||
t.Fatalf("password change should allow authenticated customers, required role=%s", role)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPIAuthMisconfigurationFailsClosed(t *testing.T) {
|
||||
cases := []config.Config{
|
||||
{AuthMode: "enforce"},
|
||||
|
||||
Reference in New Issue
Block a user