CerbiStream.GovernanceAnalyzer
1.1.34
dotnet add package CerbiStream.GovernanceAnalyzer --version 1.1.34
NuGet\Install-Package CerbiStream.GovernanceAnalyzer -Version 1.1.34
<PackageReference Include="CerbiStream.GovernanceAnalyzer" Version="1.1.34" />
<PackageVersion Include="CerbiStream.GovernanceAnalyzer" Version="1.1.34" />
<PackageReference Include="CerbiStream.GovernanceAnalyzer" />
paket add CerbiStream.GovernanceAnalyzer --version 1.1.34
#r "nuget: CerbiStream.GovernanceAnalyzer, 1.1.34"
#addin nuget:?package=CerbiStream.GovernanceAnalyzer&version=1.1.34
#tool nuget:?package=CerbiStream.GovernanceAnalyzer&version=1.1.34
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 thenamespace
) or inProperties/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
- License: MIT
- Email: hello@cerbi.io
- Website: https://cerbi.io
Secure β’ Structured β’ Compliant CerbiStream Governance Analyzer β Β© Cerbi LLC 2025
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 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. |
-
net8.0
- Cerbi.Governance.Core (>= 1.0.1)
- Microsoft.CodeAnalysis.CSharp (>= 4.14.0)
- Newtonsoft.Json (>= 13.0.3)
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 |