DEV Community

Ashish Pagariya
Ashish Pagariya

Posted on

I Built a Privacy Scanner With Zero Dependencies —SafeSearch

DESCRIPTION

SafeShare is a simple security tool that helps prevent accidental sharing of sensitive information. It scans text and files and looks for things like API keys, Bearer tokens, JWTs, passwords, and other credentials that should not be publicly shared.

The idea came from a common problem: developers can accidentally expose sensitive information while sharing code, logs, screenshots, configuration files, or uploading projects to GitHub. SafeShare acts as an extra check before that happens.

PROBLEM STATEMENT

Sensitive information is often exposed accidentally during development. A developer might copy a token into a message, commit a secret to GitHub, or share a configuration file containing credentials.

Many existing security tools can be complicated to set up or depend on multiple external packages. For a small and focused security check, I wanted something lightweight that could run locally with minimal setup.

SOLUTION

SafeShare scans the provided content and checks it against patterns for different types of sensitive information. When something suspicious is detected, the tool identifies what was found and assigns an appropriate severity level.

The scanning happens locally, so the content does not need to be sent to an external service just to perform the basic security check.

KEY FEATURES

  • Detects Bearer authentication tokens
  • Detects JWTs
  • Detects API keys and other credential-like patterns
  • Helps identify passwords and sensitive values
  • Provides severity levels for detected risks
  • Can scan text and files
  • Runs locally
  • Has zero external dependencies
  • Includes automated tests for the detection system

WHAT MAKES IT DIFFERENT

The main focus of SafeShare is simplicity. It does not try to be a complete enterprise security platform. Instead, it focuses on one practical problem: catching sensitive information before it gets shared.

Another important part of the project is that it uses zero external dependencies. This keeps the project lightweight, reduces setup requirements, and makes it easier to understand and run.

TECHNOLOGY USED

  • JavaScript
  • Node.js
  • Regular Expressions
  • Node.js built-in File System APIs
  • Node.js built-in testing tools

HOW IT WORKS

The user provides text or a file to SafeShare. The tool scans the content using detection patterns designed for different types of credentials and sensitive information.

If a possible secret is found, SafeShare reports the type of information detected along with its severity. This gives the user an opportunity to remove or secure the information before sharing the content.

TESTING

I also created automated tests to check whether SafeShare can correctly identify different types of sensitive information.

The tests include cases such as Bearer tokens and JWTs, along with other credential patterns. This helps make sure that changes to the detection logic do not accidentally break existing functionality.

PRIVACY

SafeShare is designed with local processing in mind. Sensitive content can be checked locally instead of being uploaded to a third-party service for scanning.

This is especially useful when working with private source code, configuration files, logs, or other information that should not leave the user's system.

PROJECT GOAL

The goal of SafeShare is not to replace professional security scanners. The goal is to provide a lightweight first layer of protection that can catch obvious credential leaks quickly and with almost no setup.

FUTURE IMPROVEMENTS

Some improvements I would like to add in the future include:

  • More credential detection patterns
  • Better handling of false positives
  • Support for additional file formats
  • Configurable detection rules
  • Git pre-commit integration
  • CI/CD integration
  • More detailed security reports

PROJECT OUTCOME

SafeShare demonstrates that a useful security-focused tool can be built using a small amount of code and built-in Node.js functionality. The project currently detects several common types of exposed credentials, provides severity information, and has automated tests to validate its core functionality.

GITHUB

https://github.com/ashuuakk06/SafeShare

DEMO VIDEO

https://youtu.be/xdCAfbfUNfI?si=durWKlty9wn2q2-C

Top comments (0)