Cerbi.Governance.Runtime 1.1.1

dotnet add package Cerbi.Governance.Runtime --version 1.1.1
                    
NuGet\Install-Package Cerbi.Governance.Runtime -Version 1.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cerbi.Governance.Runtime" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cerbi.Governance.Runtime" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Cerbi.Governance.Runtime" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cerbi.Governance.Runtime --version 1.1.1
                    
#r "nuget: Cerbi.Governance.Runtime, 1.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Cerbi.Governance.Runtime&version=1.1.1
                    
Install Cerbi.Governance.Runtime as a Cake Addin
#tool nuget:?package=Cerbi.Governance.Runtime&version=1.1.1
                    
Install Cerbi.Governance.Runtime as a Cake Tool

Cerbi.Governance.Runtime

🛡️ Real-time Governance Enforcement for Structured Logging

Cerbi.Governance.Runtime enables runtime validation of log messages against Cerbi governance profiles. It ensures your logs adhere to required and forbidden field policies, validates types, supports [CerbiTopic] inference, and enriches metadata for downstream audit and ML pipelines.


✅ Key Features

  • Validates fields by severity: Required, Forbidden, Info
  • Enforces type constraints (string, int, bool, etc.)
  • Supports enumerated value enforcement (e.g., Status = Approved | Rejected)
  • Detects [CerbiTopic] from method/class scope
  • Honors GovernanceRelaxed = true override with proper tagging
  • Tags every log with enforcement metadata:
    • GovernanceProfileUsed
    • GovernanceViolations
    • GovernanceEnforced
    • GovernanceMode
  • Supports hot-reloading from JSON configuration

📦 Installation

dotnet add package Cerbi.Governance.Runtime

Also see:


🧩 Governance JSON Example

{
  "EnforcementMode": "Strict",
  "LoggingProfiles": {
    "Orders": {
      "RequireTopic": true,
      "AllowedTopics": ["Orders", "Users"],
      "FieldSeverities": {
        "userId": "Required",
        "email": "Required",
        "password": "Forbidden"
      },
      "FieldTypes": {
        "userId": "string",
        "email": "string"
      },
      "FieldEnums": {
        "Status": ["Pending", "Approved", "Rejected"]
      },
      "AllowRelax": true
    }
  }
}

🚀 Usage

With Manual Validation:

var validator = new RuntimeGovernanceValidator(
    isEnabled: () => true,
    profileName: "Orders",
    source: new FileGovernanceSource("cerbi_governance.json")
);

var log = new Dictionary<string, object>
{
    ["userId"] = "abc123",
    ["email"] = "invalid@example.com",
    ["Status"] = "Failed"
};

validator.ValidateInPlace(log); // Tags log with violations and metadata

With ILogger Extensions:

logger.LogInformation(validator, "Processing order", Guid.NewGuid().ToString());

🔄 Environment Metadata Support

The following environment variables are optionally read for ILogger extension tagging:

  • CERBI_APP_ID → overrides ApplicationId
  • CERBI_REGION → overrides Region
  • CERBI_CLOUD → overrides CloudProvider

Fallbacks include:

  • MachineName for InstanceId
  • Default literals ("Unknown") if unset

🔌 Extending the Source

Use IRuntimeGovernanceSource to support custom loading strategies:

public interface IRuntimeGovernanceSource
{
    CerbiGovernance? Load();
    DateTime GetLastUpdatedUtc();
}

Provided:

  • FileGovernanceSource (reloads when modified)

Future support planned:

  • Azure Blob, GitHub raw JSON, GCS, S3

🔒 Relaxation Mode

Set GovernanceRelaxed = true in log data to bypass enforcement. Log will still be tagged as relaxed for audit:

{
  "GovernanceRelaxed": true,
  "GovernanceEnforced": false,
  "GovernanceProfileUsed": "Orders",
  "GovernanceMode": "Strict"
}

📄 License

MIT


This package is part of the Cerbi Suite – enabling governed, observable, and secure logging from the source.

Contact: hello@cerbi.io

Product 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Cerbi.Governance.Runtime:

Package Downloads
CerbiStream

CerbiStream.Logging - Secure, Scalable, and Standardized Logging for Modern Applications.

Cerbi.MEL.Governance

Real-time governance enforcement for Microsoft.Extensions.Logging (MEL) using the Cerbi validation engine.

Cerbi.Serilog.GovernanceAnalyzer

Roslyn analyzer that enforces structured logging governance for Serilog-based CerbiStream apps. Prevents forbidden fields, ensures required fields, and enables enterprise-grade compliance enforcement.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 209 5/19/2025
1.0.1 124 5/19/2025
1.0.0 135 5/19/2025