Small but useful: a core library, CLI, and minimal API that mask PII/PCI fields in PNR/eticket JSON payloads.
- Default masking profile: name, email, phone, PNR locator, card and document numbers.
PnrMasker.Cli: reads from file or STDIN, masks, writes to stdout.PnrMasker.Api: accepts JSON viaPOST /mask, returns masked JSON;GET /healthavailable.- Tests: xUnit coverage for core rules and CLI flow.
dotnet build
dotnet test# Read from file
dotnet run --project PnrMasker.Cli -- --input sample.json --pretty
# Read from STDIN
cat sample.json | dotnet run --project PnrMasker.Cli --dotnet run --project PnrMasker.Api
curl -X POST http://localhost:5000/mask \
-H "Content-Type: application/json" \
-d "{\"email\":\"test@example.com\",\"pnr\":\"ABC123\"}"PnrMasker.Core: masking rules and service.PnrMasker.Cli: command-line interface.PnrMasker.Api: minimal API.PnrMasker.Tests: xUnit tests.
- Default profile is extendable; currently targets identity, contact, payment, and document fields.
- Returns an error for invalid JSON; warns on empty input.
Input:
{
"pnr": "AB12CD",
"email": "jane.doe@example.com",
"phone": "+90-555-123-4567",
"payments": { "cardNumber": "4111111111111111", "cvv": "123" }
}Output (pretty):
{
"pnr": "AB***CD",
"email": "j***e@e***m",
"phone": "+xx-xxx-xxx-xx67",
"payments": {
"cardNumber": "XXXXXXXXXXXX1111",
"cvv": "***"
}
}