Skip to content

msepici/PnrMasker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PNR Masker

Small but useful: a core library, CLI, and minimal API that mask PII/PCI fields in PNR/eticket JSON payloads.

Features

  • 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 via POST /mask, returns masked JSON; GET /health available.
  • Tests: xUnit coverage for core rules and CLI flow.

Quick start

dotnet build
dotnet test

CLI

# Read from file
dotnet run --project PnrMasker.Cli -- --input sample.json --pretty

# Read from STDIN
cat sample.json | dotnet run --project PnrMasker.Cli --

API

dotnet run --project PnrMasker.Api

curl -X POST http://localhost:5000/mask \
  -H "Content-Type: application/json" \
  -d "{\"email\":\"test@example.com\",\"pnr\":\"ABC123\"}"

Structure

  • PnrMasker.Core: masking rules and service.
  • PnrMasker.Cli: command-line interface.
  • PnrMasker.Api: minimal API.
  • PnrMasker.Tests: xUnit tests.

Notes

  • Default profile is extendable; currently targets identity, contact, payment, and document fields.
  • Returns an error for invalid JSON; warns on empty input.

Example

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": "***"
  }
}

About

PNR Masker is a tiny C# toolkit that scrubs PNR/eticket JSON. It ships with a masking engine, a CLI for pipelines, and a minimal API. Idempotent, deterministic masks for names, emails, phones, locators, cards, docs, and SSR bits. Tests included; easy to extend the profile.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages