Skip to content

Commit 1197cfb

Browse files
Merge branch 'master' into feature/pathmask
2 parents 1f9bf0b + fcee321 commit 1197cfb

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog for Serilog.Enrichers.Sensitive
22

3+
## 1.7.4
4+
5+
- Add masking options for properties [#29](https://github.com/serilog-contrib/Serilog.Enrichers.Sensitive/issues/29)
6+
37
## 1.7.3
48

59
- Add support for masking property values that contain a `Uri`, reported by @yadanilov19

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>1.8.0.0</Version>
3+
<Version>1.7.4.0</Version>
44
<Authors>Sander van Vliet, Huibert Jan Nieuwkamer, Scott Toberman, sunnamed434</Authors>
55
<Company>Codenizer BV</Company>
66
<Copyright>2023 Sander van Vliet</Copyright>

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Serilog.Enrichers.Sensitive
1+
# Serilog.Enrichers.Sensitive
22

33
[![build-and-test](https://github.com/serilog-contrib/Serilog.Enrichers.Sensitive/actions/workflows/dotnet.yml/badge.svg)](https://github.com/serilog-contrib/Serilog.Enrichers.Sensitive/actions/workflows/dotnet.yml) [![release](https://github.com/serilog-contrib/Serilog.Enrichers.Sensitive/actions/workflows/release.yml/badge.svg)](https://github.com/serilog-contrib/Serilog.Enrichers.Sensitive/actions/workflows/release.yml) [![NuGet Serilog.Enrichers.Sensitive](https://buildstats.info/nuget/Serilog.Enrichers.Sensitive)](https://www.nuget.org/packages/Serilog.Enrichers.Sensitive/)
44

@@ -172,6 +172,27 @@ When the mask is `***MASKED***` and we pass in `[email protected]
172172

173173
Note that this example uses `EmailAddressMaskingOperator` which has a fairly complex regular expression. If possible change your regular expression to have match groups so you can more easily access them through the `match` parameter.
174174

175+
#### Partially mask a value
176+
177+
Similar to the previous example you might want to only mask part of the value. Using `MaskOptions` you can specify:
178+
179+
- To show the first `n` characters and mask the rest (using `ShowFirst`)
180+
- To show the last `n` characters and mask the rest (using `ShowLast`)
181+
- To preserve the length of the original value (using `PreserveLength`)
182+
183+
The [`WhenMaskingWithOptions`](https://github.com/serilog-contrib/Serilog.Enrichers.Sensitive/blob/master/test/Serilog.Enrichers.Sensitive.Tests.Unit/WhenMaskingWithOptions.cs) test has examples of how the options work.
184+
185+
#### Partially mask a URI
186+
187+
When it comes to URIs you may want to mask only a very specific part of the URI and keep te rest visible. To support that you can use the `UriMaskOptions` to control which parts of the URI are _kept_:
188+
189+
- `ShowScheme`
190+
- `ShowHost`
191+
- `ShowPath`
192+
- `ShowQueryString`
193+
194+
By default every part of the URI will be masked.
195+
175196
### Always mask a property
176197

177198
It may be that you always want to mask the value of a property regardless of whether it matches a pattern for any of the masking operators. In that case you can specify that the property is always masked:

0 commit comments

Comments
 (0)