CerbiStream.GovernanceAnalyzer 1.1.34

dotnet add package CerbiStream.GovernanceAnalyzer --version 1.1.34
                    
NuGet\Install-Package CerbiStream.GovernanceAnalyzer -Version 1.1.34
                    
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="CerbiStream.GovernanceAnalyzer" Version="1.1.34" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CerbiStream.GovernanceAnalyzer" Version="1.1.34" />
                    
Directory.Packages.props
<PackageReference Include="CerbiStream.GovernanceAnalyzer" />
                    
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 CerbiStream.GovernanceAnalyzer --version 1.1.34
                    
#r "nuget: CerbiStream.GovernanceAnalyzer, 1.1.34"
                    
#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=CerbiStream.GovernanceAnalyzer&version=1.1.34
                    
Install as a Cake Addin
#tool nuget:?package=CerbiStream.GovernanceAnalyzer&version=1.1.34
                    
Install as a Cake Tool

CerbiStream Governance Analyzer


πŸ›‘οΈ What is CerbiStream Governance Analyzer?

A high-performance Roslyn analyzer that enforces your organization’s structured-logging governance rules at build-time – before code reaches production. It supports customizable config files, flexible placement, and actionable diagnostics.

  • Prevents PII leakage and missing telemetry fields
  • Guarantees encryption settings for sensitive profiles
  • Emits build errors with clear CERBI-IDs your CI pipeline can fail on

Zero code changes required. Add the NuGet package, define a governance profile, and compile.


πŸ€” For Stakeholders

Cerbi helps your teams log securely, consistently, and in compliance with privacy laws.

Concern Cerbi Helps By...
Security Blocking logs with PII/PHI or insecure data
Compliance (HIPAA/GDPR) Enforcing encryption and structure for audit-readiness
Developer productivity Catching errors early so bugs don’t ship or waste debugging time
Incident response Making logs consistent, complete, and searchable during outages
CI/CD Integrity Preventing risky changes from merging via automated checks

Cerbi is a seatbelt for your logs: invisible until something goes wrong β€” and essential when it does.


πŸš€ Quick-start

# Add to your project
$ dotnet add package CerbiStream.GovernanceAnalyzer

🧱 Now Powered by Cerbi.Governance.Core

As of v1.1.6, this analyzer depends on Cerbi.Governance.Core, a shared library containing:

  • Governance config models (LogProfile, GovernanceMode, etc.)
  • Plugin interface (ICustomGovernancePlugin)
  • Runtime validator (GovernanceHelper.TryValidate(...))
  • Developer attributes (CerbiTopic, CerbiGovernanceConfig)

These are now decoupled and precompiled, improving analyzer stability and cross-runtime reuse.


πŸ“‚ Define Your Governance File

Create a profile (e.g. Configs/my_profile.json):

{
  "EnforcementMode": "Strict",
  "LoggingProfiles": {
    "default": {
      "RequireTopic": true,
      "AllowedTopics": ["Auth", "Payments"],
      "FieldSeverities": {
        "userId": "Required",
        "password": "Forbidden"
      },
      "EncryptionSettings": {
        "Mode": "AES",
        "FieldSeverity": "Required"
      },
      "AllowRelax": true
    }
  }
}

πŸ” Declare Config File in Your App

[assembly: Cerbi.Governance.CerbiGovernanceConfig("Configs/my_profile.json")]

βœ… Place this at the top of any .cs file (before the namespace) or in Properties/AssemblyInfo.cs


πŸ“„ Real-world Examples

// βœ… Valid structured log
logger.LogInformation(new Dictionary<string, object>
{
    ["Topic"] = "Auth",
    ["userId"] = "user-123"
});
// 🚫 Missing required field 'email'
logger.LogInformation(new Dictionary<string, object>
{
    ["userId"] = "abc-123"
});
// βœ… Relaxed log entry (valid only if profile allows it)
logger.LogInformation(new Dictionary<string, object>
{
    ["Topic"] = "Payments",
    ["GovernanceRelaxed"] = true,
    ["userId"] = "abc-123"
});
// βœ… Class-level [CerbiTopic] declaration
[CerbiTopic("Payments")]
public class PaymentService
{
    public void Charge()
    {
        _logger.LogInformation(new Dictionary<string, object> {
            ["userId"] = "abc-001"
        }); // Implied Topic = "Payments"
    }
}

✨ Relaxation works only if the profile allows it via "AllowRelax": true.


πŸ—‚οΈ Diagnostics

ID Description Severity
CERBI000 Governance relaxed (allowed) Info
CERBI001 Required field missing Error
CERBI002 Forbidden field present Error
CERBI007 Relaxation not allowed Error
CERBI020 Unknown topic Error
CERBI021 Topic missing Error

πŸ›€ Config Path Options

Location Works? Recommended
Properties/AssemblyInfo.cs βœ… βœ… βœ… βœ…
Top of Program.cs βœ… βœ…
Any .cs file (before namespace) βœ… πŸ‘Œ Optional
[assembly: Cerbi.Governance.CerbiGovernanceConfig("Configs/gdpr-profile.json")]

The path is relative to the file being analyzed, not to the build output.


πŸ•±οΈ Multi-Profile Support

Logs are matched to governance profiles using:

  • Topic field in the log itself
  • [CerbiTopic("...")] on the class or method

The analyzer enforces the matched profile's rules.


πŸ‰ Plugin & Reload Support

  • Runtime enforcement supported via GovernanceHelper.TryValidate(...)
  • Plugins enabled via ICustomGovernancePlugin
  • Reloads governance config on file change (for runtime only)

⚠️ Limitations

  • ❌ Build-time analyzers require the JSON config to be local and use precompiled models
  • βœ… Runtime validation (via CerbiStream) supports remote configs (e.g., Blob, GitHub)
  • Analyzer supports only 1 config per project (via [CerbiGovernanceConfig(...)])
  • Governance logic is now resolved via Cerbi.Governance.Core

πŸ“ Package Info

Package Source
CerbiStream.GovernanceAnalyzer NuGet
Cerbi.Governance.Core NuGet
CerbiStream NuGet

πŸ“’ Support & Contact

Secure β€’ Structured β€’ Compliant CerbiStream Governance Analyzer β€” Β© Cerbi LLC 2025

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.34 147 5/18/2025
1.1.33 106 5/18/2025
1.1.32 101 5/17/2025
1.1.31 116 5/17/2025
1.1.30 219 5/15/2025
1.1.29 223 5/15/2025
1.1.28 219 5/15/2025
1.1.27 217 5/15/2025
1.1.25 220 5/15/2025
1.1.24 229 5/13/2025
1.1.23 218 5/13/2025
1.1.22 217 5/13/2025
1.1.21 280 5/12/2025
1.1.10 154 4/29/2025
1.1.9 151 4/29/2025
1.1.8 154 4/24/2025
1.1.7 144 4/24/2025
1.1.6 149 4/24/2025
1.1.5 157 4/24/2025
1.1.4 83 4/19/2025
1.1.0 170 4/18/2025
1.0.5 126 3/28/2025
1.0.4 464 3/26/2025
1.0.3 161 3/23/2025
1.0.2 147 3/20/2025
1.0.1 205 3/19/2025
1.0.0 149 3/19/2025