惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
U
Unit 42
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
小众软件
小众软件
V
Visual Studio Blog
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
博客园 - 叶小钗
GbyAI
GbyAI
爱范儿
爱范儿
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
D
DataBreaches.Net
博客园_首页
D
Docker
A
About on SuperTechFans
G
Google Developers Blog
I
InfoQ
T
The Blog of Author Tim Ferriss
V
V2EX
博客园 - Franky

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
🔒 Stop Exposing Emails, Phones & Cards in Logs — Meet `va...
Vishnu Sharm · 2026-05-08 · via DEV Community

Vishnu Sharma

🚀 I Built validata-py — A Lightweight Python Library for Masking Sensitive Data

While building backend systems, APIs, logging pipelines, and debugging tools, I kept running into the same problem:

Sensitive data was everywhere.

  • Phone numbers inside logs
  • Emails inside payloads
  • Card numbers in debug responses
  • PII leaking into monitoring systems
  • Raw customer data showing up during development

Every project ended up with custom masking utilities scattered across the codebase.

Some libraries handled emails.
Some handled cards.
Some only worked for regex scrubbing.

Nothing felt unified.

So I built validata-py — a lightweight Python package focused on one thing:

Simple, consistent, production-ready data masking.


✨ What is validata-py?

validata-py is a lightweight privacy-focused utility library for:

✅ Email masking
✅ Phone masking
✅ Card masking
✅ Payload anonymization
✅ Regex-based PII scrubbing
✅ CPF/CNPJ masking
✅ Generic string concealment

All with:

  • One import
  • One class
  • Zero dependencies
  • Clean API design

📦 Installation

pip install validata-py

Enter fullscreen mode Exit fullscreen mode


⚡ Quick Example

from validata_py import Veil

# Email masking
Veil.shield_email("alice@example.com")
# a****@e******.com

# Phone masking
Veil.shield_phone("+91 98765-43210")
# +91 *****-3210

# Card masking
Veil.shield_card("4111 1111 1111 1111")
# **** **** **** 1111

# PII scrubbing
Veil.scrub_text(
    "Contact me at dev@example.com or 9876543210"
)

# Contact me at [EMAIL] or [PHONE]

Enter fullscreen mode Exit fullscreen mode


🔥 One of My Favorite Features — Payload Masking

This became extremely useful while logging API payloads safely.

from validata_py import Veil

payload = {
    "name": "Priya Sharma",
    "email": "priya@example.com",
    "mobile": "+91-98765-43210",
    "salary": 950000,
}

blueprint = {
    "name": "text",
    "email": "email",
    "mobile": "phone",
    "salary": "zero",
}

Veil.shield_payload(payload, blueprint)

Enter fullscreen mode Exit fullscreen mode

Output:

{
    "name": "P**********a",
    "email": "p****@e******.com",
    "mobile": "+91-*****-3210",
    "salary": 0
}

Enter fullscreen mode Exit fullscreen mode


🧠 Why I Built It

I wanted a package that was:

  • Lightweight
  • Easy to use
  • Dependency-free
  • Consistent
  • Production-friendly
  • Formatting-safe

For example:

Veil.shield_phone("+91 98765-43210")

Enter fullscreen mode Exit fullscreen mode

preserves formatting automatically instead of returning broken unreadable strings.


🛠 Useful For

  • Backend APIs
  • Logging systems
  • GDPR/privacy workflows
  • Audit pipelines
  • Debug payload sanitization
  • Security tooling
  • Internal admin dashboards
  • Data anonymization

💡 Features

🔹 Generic String Concealment

Veil.cover("secret-token", from_index=3)
# sec*********

Enter fullscreen mode Exit fullscreen mode

🔹 Email Masking

Veil.shield_email("alice@example.com")
# a****@e******.com

Enter fullscreen mode Exit fullscreen mode

🔹 Phone Masking

Veil.shield_phone("+91 98765-43210")
# +91 *****-3210

Enter fullscreen mode Exit fullscreen mode

🔹 Card Masking

Veil.shield_card("4111 1111 1111 1111")
# **** **** **** 1111

Enter fullscreen mode Exit fullscreen mode

🔹 Free-Text PII Detection

Veil.scrub_text(
    "Call me at john@example.com"
)

# Call me at [EMAIL]

Enter fullscreen mode Exit fullscreen mode


🚀 Future Improvements

Some ideas I’m exploring:

  • PAN masking
  • Aadhaar masking
  • IBAN masking
  • Custom regex strategies
  • Async processing
  • FastAPI middleware integration
  • Structured log sanitizers

Would love ideas from the community.


🔗 Links

GitHub

https://github.com/vishnusharma511/validata-py

PyPI

https://pypi.org/project/validata-py/


❤️ Feedback Welcome

This is an early open-source release, and I’d genuinely love:

  • Feedback
  • Feature ideas
  • Bug reports
  • Contributions
  • Performance suggestions

If you work with APIs, logs, privacy tooling, or security systems, I’d love to hear how you would use it 🚀