![]() |
VOOZH | about |
dotnet add package ControlR.Libraries.DataRedaction --version 0.24.16
NuGet\Install-Package ControlR.Libraries.DataRedaction -Version 0.24.16
<PackageReference Include="ControlR.Libraries.DataRedaction" Version="0.24.16" />
<PackageVersion Include="ControlR.Libraries.DataRedaction" Version="0.24.16" />Directory.Packages.props
<PackageReference Include="ControlR.Libraries.DataRedaction" />Project file
paket add ControlR.Libraries.DataRedaction --version 0.24.16
#r "nuget: ControlR.Libraries.DataRedaction, 0.24.16"
#:package ControlR.Libraries.DataRedaction@0.24.16
#addin nuget:?package=ControlR.Libraries.DataRedaction&version=0.24.16Install as a Cake Addin
#tool nuget:?package=ControlR.Libraries.DataRedaction&version=0.24.16Install as a Cake Tool
A lightweight library for redacting sensitive data in logs and outputs using Microsoft's data compliance framework.
This library provides tools to automatically redact sensitive information during logging operations, helping you maintain security and comply with data protection regulations. It uses Microsoft's Microsoft.Extensions.Compliance.Redaction package to seamlessly integrate with standard .NET logging infrastructure.
dotnet add package ControlR.Libraries.DataRedaction
Add the redactor to your service collection:
using ControlR.Libraries.DataRedaction;
var builder = WebApplication.CreateBuilder(args);
// Add redaction services
builder.Services.AddStarRedactor();
var app = builder.Build();
Use the ProtectedDataClassification attribute to mark properties that should be redacted:
public class User
{
public string Name { get; set; }
[ProtectedDataClassification]
public string Password { get; set; }
[ProtectedDataClassification]
public string ApiKey { get; set; }
}
When you log objects with protected properties, they'll automatically be redacted:
var user = new User
{
Name = "John Doe",
Password = "secret123",
ApiKey = "sk_live_abc123"
};
logger.LogInformation("User details: {@User}", user);
// Output: User details: { Name: "John Doe", Password: "****", ApiKey: "****" }
[ProtectedDataClassification] attribute to mark sensitive properties****AddStarRedactor()Registers the StarRedactor and enables redaction in the logging pipeline.
services.AddStarRedactor();
ProtectedDataClassificationAttributeMarks a property as containing protected data that should be redacted.
[ProtectedDataClassification]
public string SensitiveData { get; set; }
StarRedactorThe default redactor that replaces sensitive values with ****.
DefaultDataClassificationsProvides standard data classification types:
Protected: Data that should be redactedPublic: Data that can be logged without redactionYou can use the built-in classifications for more granular control:
using Microsoft.Extensions.Compliance.Classification;
public class CustomModel
{
[DataClassification(DefaultDataClassifications.Public)]
public string PublicInfo { get; set; }
[DataClassification(DefaultDataClassifications.Protected)]
public string PrivateInfo { get; set; }
}
For more information about data redaction in .NET, see the official documentation:
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on ControlR.Libraries.DataRedaction:
| Package | Downloads |
|---|---|
|
ControlR.Libraries.Api.Contracts
ControlR is an open-source remote control and remote access solution. This library defines the data structures and interfaces used for communication between the ControlR API clients and server. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.24.16 | 0 | 6/18/2026 |
| 0.24.14 | 68 | 6/16/2026 |
| 0.23.17 | 538 | 6/2/2026 |
| 0.22.79 | 3,618 | 5/4/2026 |
| 0.21.59 | 987 | 4/7/2026 |
| 0.20.88 | 135 | 3/12/2026 |
| 0.20.87 | 125 | 3/12/2026 |
| 0.20.86 | 124 | 3/5/2026 |
| 0.20.85 | 123 | 3/4/2026 |
| 0.20.84-dev | 119 | 3/4/2026 |
| 0.20.82-dev | 121 | 3/4/2026 |
| 0.20.79-dev | 109 | 3/3/2026 |
| 0.19.2 | 410 | 1/27/2026 |
| 0.18.22 | 172 | 1/12/2026 |
| 0.17.20 | 171 | 12/31/2025 |
| 0.17.19-dev | 133 | 12/31/2025 |
| 0.17.17 | 153 | 12/31/2025 |