Cerbi.Governance.Core
2.2.29
dotnet add package Cerbi.Governance.Core --version 2.2.29
NuGet\Install-Package Cerbi.Governance.Core -Version 2.2.29
<PackageReference Include="Cerbi.Governance.Core" Version="2.2.29" />
<PackageVersion Include="Cerbi.Governance.Core" Version="2.2.29" />
<PackageReference Include="Cerbi.Governance.Core" />
paket add Cerbi.Governance.Core --version 2.2.29
#r "nuget: Cerbi.Governance.Core, 2.2.29"
#:package Cerbi.Governance.Core@2.2.29
#addin nuget:?package=Cerbi.Governance.Core&version=2.2.29
#tool nuget:?package=Cerbi.Governance.Core&version=2.2.29
Cerbi.Governance.Core
v2.2.0 — The canonical governance engine for the CerbiShield logger ecosystem.
Cerbi.Governance.Core provides compile-time and runtime governance enforcement for structured logging across .NET applications. It is used by all CerbiShield logger plugins (CerbiStream, Serilog, MEL, NLog) and the CerbiShield Dashboard to define, validate, and score governance profiles.
Why Canonical Profile
Prior to v2.2.0, the codebase maintained two incompatible profile models:
| Model | Used By | FieldSeverities Type | Issues |
|---|---|---|---|
LogProfile (legacy) |
Runtime loggers, GovernanceConfigLoader |
Dict<string, string> |
No type safety, no metadata, no Dashboard compatibility |
Profile (canonical) |
Dashboard, GovernanceValidator, GovernanceRuntime |
Dict<string, SeverityLevel> |
Strongly-typed enums, flat schema, Dashboard JSON format |
This dual-model problem meant:
- Dashboard rule templates produced
ProfileJSON that loggers couldn't read - Runtime loggers used
LogProfileJSON that the Dashboard couldn't render - Two serialization formats, two validation paths, two sets of bugs
v2.2.0 eliminates the legacy model. The entire stack — Dashboard → GovernanceApi → GovernanceRuntime → Governance.Core → Logger plugins — now uses a single canonical Profile object. One JSON format. One validation path. One source of truth.
Key Features
Profile— Single canonical governance profile model with strongly-typed enumsSeverityLevelenum:Info,Warn,Error,ForbiddenFieldTypeenum:String,Int,Decimal,Guid,DateTime,Bool,Object,ArrayProfileStatusenum:Draft,PublishedEncryptionModeenum:None,Base64,AES
GovernanceConfigLoader— Static loader that reads canonical Profile JSON from file, with FileSystemWatcher hot-reloadGovernanceHelper— Runtime validation of log entries against loaded Profile (required fields, disallowed fields, field types, enum constraints, encryption, scoring)GovernanceValidator— Structural validation of Profile definitions (name, appName, version, required properties)ScoringSettings— Configurable scoring weights by severity, plugin weights, scoring version- Roslyn Helpers —
ExtractLoggedFieldsfor compile-time field analysis fromDictionary<string, object>expressions
Quickstart: Using GovernanceConfigLoader
using Cerbi.Governance;
using Cerbi.Governance.Core.Models;
// Load a canonical governance profile from a JSON file
GovernanceConfigLoader.SetGovernanceFilePath("cerbi_governance.json");
// Access the currently loaded profile
Profile? profile = GovernanceConfigLoader.CurrentProfile;
if (profile != null)
{
Console.WriteLine($"Profile: {profile.Name} (app: {profile.AppName})");
Console.WriteLine($"Version: {profile.Version}, Status: {profile.Status}");
Console.WriteLine($"Required fields: {profile.RequiredFields?.Count ?? 0}");
Console.WriteLine($"Disallowed fields: {profile.DisallowedFields?.Count ?? 0}");
Console.WriteLine($"Scoring enabled: {profile.Scoring?.Enabled ?? false}");
}
Validating a Log Entry
var logData = new Dictionary<string, object>
{
{ "requestId", Guid.NewGuid() },
{ "userId", "u-12345" },
{ "timestamp", DateTime.UtcNow }
};
bool isValid = GovernanceHelper.TryValidate("my-profile", logData, out var errors, out var score);
if (!isValid)
{
foreach (var error in errors)
Console.WriteLine($" Violation: {error}");
Console.WriteLine($" Score penalty: {score}");
}
Canonical Profile JSON
All governance profiles use this flat JSON schema — the same format produced by the CerbiShield Dashboard rule editor and consumed by all runtime loggers:
{
"name": "PII Protection",
"appName": "my-service",
"version": "1.0.0",
"status": "Published",
"metadata": {
"description": "Prevents PII leakage in application logs",
"owner": "security-team",
"createdAt": "2025-01-15T00:00:00Z"
},
"tags": ["pii", "compliance", "hipaa"],
"allowRelax": false,
"requiredFields": ["requestId", "timestamp", "correlationId"],
"disallowedFields": ["ssn", "creditCardNumber", "password"],
"fieldSeverities": {
"requestId": "Error",
"userId": "Warn",
"ssn": "Forbidden",
"debugInfo": "Info"
},
"fieldTypes": {
"requestId": "Guid",
"userId": "String",
"timestamp": "DateTime",
"retryCount": "Int",
"amount": "Decimal",
"isAdmin": "Bool"
},
"enums": {
"environment": ["dev", "staging", "production"],
"logLevel": ["Debug", "Info", "Warning", "Error", "Critical"]
},
"encryption": {
"mode": "AES",
"encryptedFields": ["ssn", "email"]
},
"scoring": {
"enabled": true,
"weightsBySeverity": {
"Error": 5.0,
"Warn": 1.0,
"Info": 0.1
},
"pluginWeights": {},
"version": "1.0.0"
}
}
Architecture
┌─────────────────────────────────────────────────────────┐
│ CerbiShield Dashboard (Next.js) │
│ → Creates/edits Profile JSON via rule editor │
│ → Reads Profile from GovernanceStore API │
└────────────────────────┬────────────────────────────────┘
│ canonical Profile JSON
┌────────────────────────▼────────────────────────────────┐
│ Cerbi.GovernanceRuntime (v2.0.0) │
│ → Loads Profile via FileGovernanceSource │
│ → Validates at runtime via CompiledProfile.Build │
└────────────────────────┬────────────────────────────────┘
│ uses
┌────────────────────────▼────────────────────────────────┐
│ Cerbi.Governance.Core (v2.2.0) ← YOU ARE HERE │
│ → GovernanceConfigLoader: loads Profile from JSON file │
│ → GovernanceHelper: validates log data against Profile │
│ → GovernanceValidator: validates Profile structure │
│ → Models: Profile, SeverityLevel, FieldType, etc. │
└────────────────────────┬────────────────────────────────┘
│ consumed by
┌────────────────────────▼────────────────────────────────┐
│ Logger Plugins │
│ → CerbiStream, Serilog, MEL, NLog │
│ → Load Profile → validate logs → ship scoring events │
└─────────────────────────────────────────────────────────┘
Comparison: Core vs Runtime vs Validator
| Concern | Cerbi.Governance.Core |
Cerbi.GovernanceRuntime |
GovernanceValidator |
|---|---|---|---|
| Scope | Shared models + helpers | Runtime validation engine | Profile structure check |
| Profile model | Profile (canonical) |
Profile (canonical) |
Profile (canonical) |
| Loading | GovernanceConfigLoader (file-based) |
FileGovernanceSource (file-based) |
N/A (accepts Profile) |
| Validation | GovernanceHelper.TryValidate |
CompiledProfile.Validate |
GovernanceValidator.Validate |
| Scoring | Weighted scoring via ScoringSettings |
Full scoring pipeline | N/A |
| Roslyn | ExtractLoggedFields helper |
N/A | N/A |
| Used by | All logger plugins, GovernanceRuntime | Logger plugins at runtime | Dashboard, GovernanceApi |
Profile Model Reference
public class Profile
{
public string? Name { get; set; }
public string? AppName { get; set; }
public string? Version { get; set; }
public ProfileStatus Status { get; set; } // Draft | Published
public ProfileMetadata? Metadata { get; set; }
public List<string>? Tags { get; set; }
public bool AllowRelax { get; set; }
public List<string>? AllowedTopics { get; set; }
public List<string>? RequiredFields { get; set; }
public List<string>? DisallowedFields { get; set; }
public Dictionary<string, SeverityLevel>? FieldSeverities { get; set; } // Info|Warn|Error|Forbidden
public Dictionary<string, FieldType>? FieldTypes { get; set; } // String|Int|Decimal|Guid|DateTime|Bool|Object|Array
public Dictionary<string, List<string>>? Enums { get; set; }
public Encryption? Encryption { get; set; }
public ScoringSettings? Scoring { get; set; }
}
Breaking Changes in v2.2.0
GovernanceConfigLoader.CurrentProfileis nowProfile?(was accessed viaTryGetProfilewithLogProfile)GovernanceConfigLoader.SetCurrentProfileForTest(Profile)— parameter changed fromLogProfiletoProfileGovernanceHelper.TryValidateusesProfile.FieldSeveritiesasDict<string, SeverityLevel>(wasDict<string, string>)GovernanceHelper.TryValidateusesProfile.FieldTypesasDict<string, FieldType>(wasDict<string, string>)GovernanceHelper.TryValidateusesProfile.Enums(wasFieldEnumsin legacy)- Removed:
TryGetProfile,GetAllowedLevels,GovernanceModefromGovernanceConfigLoader - Legacy models
LogProfileandCerbiGovernancestill exist in the codebase but are no longer used by ConfigLoader, Helper, or Validator
Installation
dotnet add package Cerbi.Governance.Core --version 2.2.0
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- CerbiShield.Contracts (>= 1.2.1)
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
-
net8.0
- CerbiShield.Contracts (>= 1.2.1)
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on Cerbi.Governance.Core:
| Package | Downloads |
|---|---|
|
CerbiStream
CerbiStream.Logging - Secure, Scalable, and Standardized Logging for Modern Applications. |
|
|
CerbiStream.GovernanceAnalyzer
Roslyn analyzer to enforce structured logging governance for CerbiStream apps. Ensures consistency, traceability, and compliance with score shipping support. |
|
|
Cerbi.MEL.Governance
Real-time governance enforcement for Microsoft.Extensions.Logging (MEL) using the Cerbi validation engine. |
|
|
Cerbi.Governance.Runtime
Real-time governance enforcement for CerbiStream and other structured loggers. Uses canonical Dashboard Profile model. |
|
|
Cerbi.Serilog.GovernanceAnalyzer
Serilog governance analyzer plugin: runtime validation, filtering, enrichment, live reload, correlation, relaxed diagnostics, and high-throughput score shipping with ArrayPool optimizations. Supports .NET 8.0+ and .NET 10.0. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.2.29 | 167 | 3/17/2026 |
| 2.0.28 | 81 | 3/17/2026 |
| 2.0.27 | 72 | 3/17/2026 |
| 2.0.26 | 75 | 3/17/2026 |
| 2.0.25 | 74 | 3/17/2026 |
| 2.0.24 | 82 | 3/17/2026 |
| 2.0.22 | 162 | 3/1/2026 |
| 2.0.20 | 90 | 2/26/2026 |
| 1.0.16 | 115 | 2/23/2026 |
| 1.0.15 | 1,013 | 12/19/2025 |
| 1.0.13 | 211 | 12/5/2025 |
| 1.0.12 | 211 | 11/24/2025 |
| 1.0.11 | 250 | 11/22/2025 |
| 1.0.10 | 267 | 11/22/2025 |
| 1.0.9 | 208 | 11/15/2025 |
| 1.0.8 | 224 | 10/30/2025 |
| 1.0.7 | 209 | 10/30/2025 |
| 1.0.6 | 213 | 10/30/2025 |
| 1.0.5 | 139 | 10/24/2025 |
| 1.0.4 | 152 | 10/24/2025 |