https://github.com/dimuzzo/sentinel-shield
A modular TypeScript library for data sanitization and security.
https://github.com/dimuzzo/sentinel-shield
Last synced: 29 days ago
JSON representation
A modular TypeScript library for data sanitization and security.
- Host: GitHub
- URL: https://github.com/dimuzzo/sentinel-shield
- Owner: dimuzzo
- License: mit
- Created: 2026-03-31T21:21:52.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-03-31T22:32:20.000Z (2 months ago)
- Last Synced: 2026-04-01T01:07:02.774Z (2 months ago)
- Language: TypeScript
- Size: 53.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🛡️ Sentinel Shield



A lightweight, modular, and secure data sanitization library for TypeScript applications.
## Overview
Sentinel Shield provides a robust defense layer for your application by automating data validation, XSS protection, and sensitive information masking.
## Key Features
* **XSS Protection:** Automatically escapes dangerous HTML tags to prevent cross-site scripting.
* **Schema Validation:** Ensures incoming JSON objects match your expected structure.
* **Data Masking:** Protects user privacy by masking emails, credit cards, and phone numbers.
## Installation
The project can be used locally by cloning the repository:
```bash
git clone https://github.com/dimuzzo/sentinel-shield.git
cd sentinel-shield
npm install
```
## Quick Start
```typescript
import { Sentinel, type Schema } from './src/index';
const guard = new Sentinel();
// 1. Protect an entire object
const userSchema: Schema = { username: 'string', bio: 'string' };
const rawData = { username: 'dev_hero', bio: 'alert("hacked")' };
const safeData = guard.shieldObject(userSchema, rawData);
// bio becomes: <script>alert("hacked")</script>
// 2. Mask sensitive data
const maskedEmail = guard.mask('dev@example.com', 'email'); // d********@example.com
```
## Testing
```bash
npm test
```
## Try the Demo
Check out the `examples/` folder to see Sentinel Shield in action with real-world scenarios.
Run the demo locally using:
```bash
npx ts-node examples/demo.ts
```
---
> Created with passion by [dimuzzo](https://github.com/dimuzzo)