-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
An initial version of an Umbraco package to remove any personal data stored on a site.
- Loading branch information
0 parents
commit efd4fbd
Showing
60 changed files
with
2,865 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 4 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
# Sanitiser | ||
|
||
[![Downloads](https://img.shields.io/nuget/dt/Umbraco.Community.Sanitiser?color=cc9900)](https://www.nuget.org/packages/Umbraco.Community.Sanitiser/) | ||
[![NuGet](https://img.shields.io/nuget/vpre/Umbraco.Community.Sanitiser?color=0273B3)](https://www.nuget.org/packages/Umbraco.Community.Sanitiser) | ||
[![GitHub license](https://img.shields.io/github/license/richarth/sanitiser?color=8AB803)](https://github.com/richarth/sanitiser/blob/main/LICENSE) | ||
|
||
When enabled, this package will automatically remove personal data from your Umbraco website on startup. | ||
|
||
Out of the box the package will delete member data and form submissions. | ||
|
||
Umbraco versions supported: v10.8.5+ | ||
|
||
## Installation | ||
|
||
Add the package to your Umbraco website from nuget: | ||
|
||
`dotnet add package Umbraco.Community.Sanitiser` | ||
|
||
## Configuration | ||
|
||
To enable the package, add the following to your `appsettings.json`: | ||
|
||
```json | ||
{ | ||
"Sanitiser": { | ||
"Enabled": true | ||
} | ||
} | ||
``` | ||
|
||
### Member Data | ||
|
||
To enable the deletion of member data, add the following to your `appsettings.json`: | ||
|
||
```json | ||
{ | ||
"Sanitiser": { | ||
"Enabled": true, | ||
"MembersSanitiser": { | ||
"Enable": true | ||
} | ||
} | ||
} | ||
``` | ||
|
||
To exclude members whose email addresses belong to specific domains from deletion, add the following to your `appsettings.json`: | ||
|
||
```json | ||
{ | ||
"Sanitiser": { | ||
"Enabled": true, | ||
"MembersSanitiser": { | ||
"Enable": true, | ||
"DomainsToExclude": "test.com,example.com" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Umbraco Forms Submissions | ||
|
||
To enable the deletion of form submissions, add the following to your `appsettings.json`: | ||
|
||
```json | ||
{ | ||
"Sanitiser": { | ||
"Enabled": true, | ||
"UmbracoFormsSanitiser": { | ||
"Enable": true | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Custom database tables | ||
|
||
To enable the deletion of data from custom database tables, you can extend the `DatabaseTableSanitiser` class and create a poco with a table name attribute. | ||
|
||
For example, to have a table called `test` automatically emptied on startup, create a poco like this: | ||
|
||
```csharp | ||
using NPoco; | ||
|
||
[TableName("test")] | ||
public class Test; | ||
``` | ||
|
||
And extend the `DatabaseTableSanitiser` class like this with your poco class as a type parameter: | ||
|
||
```csharp | ||
using Umbraco.Cms.Infrastructure.Scoping; | ||
using Umbraco.Community.Sanitiser.Models; | ||
|
||
namespace Umbraco.Community.Sanitiser.sanitisers; | ||
|
||
public class TestTableSanitiser(IScopeProvider scopeProvider) : DatabaseTableSanitiser<Test>(scopeProvider) | ||
{ | ||
public override bool IsEnabled() | ||
{ | ||
return true; | ||
} | ||
} | ||
``` | ||
|
||
> [!WARNING] | ||
N.B. This package is not intended to be run on production sites, only enable sanitization on a development or staging environment. Before enabling please ensure you have a backup of your data and a backup of your backup. | ||
|
||
If there is a lot of data then the startup of your site may be delayed. Only enable when necessary. | ||
|
||
## Customisation | ||
|
||
To add your own sanitization logic, implement the `ISanitiser` interface. Your sanitization logic will be run automatically on startup when the sanitization service and your sanitizer are enabled. | ||
|
||
Add your logic to the `Sanitise` method. | ||
|
||
You will also need to implement the enabled check in the `IsEnabled` method. You could check for a value in Umbraco, simply return true or more likely add a setting to `appsettings.json`. | ||
|
||
If adding your own setting to the `Sanitiser` section of `appsettings.json`, you can add a new class which extends the `SanitiserOptions` class to include your new setting. The values from your `appsettings.json` will be automatically mapped to your new class. | ||
|
||
## Acknowledgements | ||
|
||
### Logo | ||
|
||
The package logo uses the [Sanitiser](https://thenounproject.com/icon/sanitiser-6216442/) (by [Manish Mittal](https://thenounproject.com/creator/butterfingers/)) icon from the [Noun Project](https://thenounproject.com), licensed under [CC BY 3.0 US](https://creativecommons.org/licenses/by/3.0/us/). | ||
|
||
## License | ||
MIT License |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Release Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "[0-9]+.[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
|
||
- name: Build project | ||
run: dotnet build src\Sanitiser\Sanitiser.csproj --configuration Release | ||
|
||
- name: Push to NuGet | ||
run: dotnet nuget push **\*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.vs/ | ||
|
||
.idea/ | ||
|
||
*.user | ||
|
||
.DS_Store | ||
|
||
# Build results | ||
|
||
[Dd]ebug/ | ||
[Rr]elease/ | ||
x64/ | ||
build/tools/ | ||
[Oo]bj/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Richard Thompson | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Sanitiser | ||
|
||
[![Downloads](https://img.shields.io/nuget/dt/Umbraco.Community.Sanitiser?color=cc9900)](https://www.nuget.org/packages/Umbraco.Community.Sanitiser/) | ||
[![NuGet](https://img.shields.io/nuget/vpre/Umbraco.Community.Sanitiser?color=0273B3)](https://www.nuget.org/packages/Umbraco.Community.Sanitiser) | ||
[![GitHub license](https://img.shields.io/github/license/richarth/sanitiser?color=8AB803)](https://github.com/richarth/sanitiser/blob/main/LICENSE) | ||
|
||
When enabled, this package will automatically remove personal data from your Umbraco website on startup. | ||
|
||
Out of the box the package will delete member data and form submissions. | ||
|
||
Umbraco versions supported: v10.8.5+ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.