Skip to content
ato113Public

About

See and strip the hidden metadata (GPS, author, device) from photos and documents before you share them. One Go binary, no dependencies.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

metascrub

Türkçe · English

See — and strip — the hidden data your files carry before you share them.

CI Go License: MIT

The photo you just posted may carry the GPS coordinates of your home. The document you emailed has your full name and your company in it. None of this is visible when you look at the file — which is exactly why it leaks.

metascrub shows you that hidden data, then removes it. One command, no dependencies, one binary.

$ metascrub inspect holiday.jpg
holiday.jpg  (jpeg)
    Camera make            Apple
  ! Camera model           iPhone 15 Pro
  ! Date taken             2026:08:14 18:22:41
  ! GPS location           41.008240, 28.978359  (maps.google.com/?q=41.008240,28.978359)
  (lines marked ! can identify you or where you were)

$ metascrub clean holiday.jpg
holiday.jpg  ->  holiday.clean.jpg  (removed 4 item(s), 2.1 MB -> 2.1 MB)

That GPS line is a real map link to where the photo was taken. inspect makes the invisible visible; clean removes it.

Why "inspect" and "clean" are separate

Most tools strip metadata silently, so you never learn what you were leaking. metascrub shows you first. Seeing your home address come out of a holiday photo is the point — it's how you learn to check before you post.

Install

go install github.com/ato113/metascrub/cmd/metascrub@latest

Or build from source:

git clone https://github.com/ato113/metascrub
cd metascrub
go build -o metascrub ./cmd/metascrub
./metascrub inspect yourfile.jpg

Or with Docker (no Go needed):

docker build -t metascrub .
docker run --rm -v "$PWD:/work" metascrub inspect /work/photo.jpg

Usage

metascrub inspect <file>...        # show the hidden metadata
metascrub clean   <file>...        # write a cleaned copy (file.clean.ext)
metascrub clean -i <file>...       # overwrite the original instead
metascrub inspect -json <file>     # machine-readable output

By default clean writes a new file next to the original (photo.clean.jpg) and never touches the original. Pass -i / -in-place to overwrite.

Gate a commit or an upload

inspect -fail-on-sensitive exits non-zero when it finds identifying data, so you can stop a file with your location in it from being committed:

# in a pre-commit hook
metascrub inspect -fail-on-sensitive $(git diff --cached --name-only)

What it finds and removes

Format Metadata handled
JPEG EXIF (incl. GPS location, camera make/model/serial, timestamps, artist), XMP, IPTC, comments
PNG text chunks (tEXt/zTXt/iTXt), embedded EXIF, timestamps
Office — .docx, .xlsx, .pptx author, last-modified-by, company, manager, title, timestamps, custom properties

Cleaning is careful: a JPEG keeps its JFIF header and ICC colour profile, so the image and its colours are unchanged; an Office file keeps every part so it still opens everywhere — only the personal data goes. Every cleaned file is checked to still decode as a valid image or open as a valid document (that check is in the test suite).

Lines marked ! are the ones that can identify you or where you were — GPS, your name, your device's serial number, your company.

How it works

Nothing here reaches for a heavy library; it reads each format's structure directly with the Go standard library:

  • JPEG is a sequence of marker segments. clean drops the metadata ones (EXIF, XMP, IPTC, comments) and keeps the image. inspect parses the EXIF TIFF structure, including the GPS sub-IFD, which it converts from degrees/minutes/seconds rationals into a decimal coordinate and a map link.
  • PNG is a sequence of chunks; the text and EXIF chunks are ancillary, so dropping them leaves a valid image.
  • Office files are zip archives. The metadata lives in docProps/core.xml and docProps/app.xml; clean replaces them with empty equivalents rather than deleting them, so no content-type or relationship references break.

Roadmap

PDF and TIFF are the obvious next formats. PDF metadata (the /Info dictionary and XMP) needs careful handling to avoid corrupting the file, so it's deliberately not shipped half-done. A contribution that does it properly is very welcome.

Development

go test ./...
go test -race -cover ./...

The tests run against fixtures in testdata/ (a photo with GPS, a PNG with text, a Word file with an author). Every "clean" test re-decodes the result to prove the file is still valid, not just metadata-free.

Contributing

A new format means a parser in internal/scrub/ that can inspect and clean it; the CLI and reporting are shared. See the existing JPEG, PNG and OOXML files.

AI-assisted contributions are fine as long as you say so in the pull request and can explain what you're submitting.

A note on what this is not

metascrub removes metadata. It does not alter the image or document content itself, and it can't remove information that's part of the content (a face in a photo, a name typed into the document body). For sensitive files, always check the content too.

License

MIT — see LICENSE.

About

See and strip the hidden metadata (GPS, author, device) from photos and documents before you share them. One Go binary, no dependencies.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages