{"id":46291994,"url":"https://github.com/ggwhite/go-masker","last_synced_at":"2026-04-19T20:01:20.171Z","repository":{"id":40614326,"uuid":"179202045","full_name":"ggwhite/go-masker","owner":"ggwhite","description":"Simple utility of creating a mask for sensitive information","archived":false,"fork":false,"pushed_at":"2025-11-26T06:51:59.000Z","size":86,"stargazers_count":123,"open_issues_count":4,"forks_count":35,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-03-04T13:08:27.754Z","etag":null,"topics":["go","golang","golang-tools","masker"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/ggwhite/go-masker","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ggwhite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-04-03T03:18:29.000Z","updated_at":"2025-12-12T03:40:17.000Z","dependencies_parsed_at":"2024-06-18T15:21:28.987Z","dependency_job_id":"ea8d816e-7372-42e3-ae57-1f3a31f2b7f8","html_url":"https://github.com/ggwhite/go-masker","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/ggwhite/go-masker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggwhite%2Fgo-masker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggwhite%2Fgo-masker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggwhite%2Fgo-masker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggwhite%2Fgo-masker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ggwhite","download_url":"https://codeload.github.com/ggwhite/go-masker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ggwhite%2Fgo-masker/sbom","scorecard":{"id":425427,"data":{"date":"2025-08-11","repo":{"name":"github.com/ggwhite/go-masker","commit":"2e0bcb248e156bc26162b3ea9d73916bd1de421c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Code-Review","score":4,"reason":"Found 8/19 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/ggwhite/go-masker/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/ggwhite/go-masker/go.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T02:08:37.898Z","repository_id":40614326,"created_at":"2025-08-19T02:08:37.899Z","updated_at":"2025-08-19T02:08:37.899Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32020702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","golang-tools","masker"],"created_at":"2026-03-04T08:30:54.031Z","updated_at":"2026-04-19T20:01:20.124Z","avatar_url":"https://github.com/ggwhite.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Masker v2\n\n[![build workflow](https://github.com/ggwhite/go-masker/actions/workflows/go.yml/badge.svg)](https://github.com/ggwhite/go-masker/actions)\n[![GoDoc](https://godoc.org/github.com/ggwhite/go-masker?status.svg)](https://godoc.org/github.com/ggwhite/go-masker)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ggwhite/go-masker)](https://goreportcard.com/report/github.com/ggwhite/go-masker)\n[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/ggwhite/go-masker/blob/master/LICENSE)\n[![Release](https://img.shields.io/github/release/ggwhite/go-masker.svg?style=flat-square)](https://github.com/ggwhite/go-masker/releases/latest)\n\nGo Masker v2 is a simple and extensible library for masking sensitive data in Go structs. Use struct tags to control how fields are masked — passwords, emails, IDs, credit cards, and more.\n\n* [Install](#install)\n* [Quick Start](#quick-start)\n* [Masker Types](#masker-types)\n* [Custom Mask Character](#custom-mask-character)\n* [Abuse Masker](#abuse-masker)\n* [Custom Masker](#custom-masker)\n* [Contributors](#contributors)\n\n## Install\n\n```bash\ngo get -u github.com/ggwhite/go-masker/v2\n```\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n    \"log\"\n    masker \"github.com/ggwhite/go-masker/v2\"\n)\n\ntype User struct {\n    Name     string `mask:\"name\"`\n    Email    string `mask:\"email\"`\n    Password string `mask:\"password\"`\n    Mobile   string `mask:\"mobile\"`\n}\n\nfunc main() {\n    u := \u0026User{\n        Name:     \"John Doe\",\n        Email:    \"john@gmail.com\",\n        Password: \"secret\",\n        Mobile:   \"0987654321\",\n    }\n\n    m := masker.NewMaskerMarshaler()\n    masked, err := m.Struct(u)\n    if err != nil {\n        log.Fatal(err)\n    }\n    log.Println(masked) // \u0026{J**n D**e joh****@gmail.com ************** 0987***321}\n}\n```\n\nYou can also use the package-level default instance:\n\n```go\nmasked, err := masker.DefaultMaskerMarshaler.Struct(u)\n```\n\n## Masker Types\n\n| Tag | Description | Example Input | Example Output |\n|-----|-------------|---------------|----------------|\n| `none` | No masking, return as-is | `foo` | `foo` |\n| `password` | Always returns 14 asterisks | `secret` | `**************` |\n| `name` | Masks middle characters | `John Doe` | `J**n D**e` |\n| `addr` | Masks last 6 characters | `台北市內湖區內湖路一段737巷1號` | `台北市內湖區內湖路一段7******` |\n| `email` | Keeps first 3 chars and domain | `john@gmail.com` | `joh****@gmail.com` |\n| `mobile` | Masks 3 digits from 4th position | `0987654321` | `0987***321` |\n| `tel` | Formats and masks last 4 digits | `0227993078` | `(02)2799-****` |\n| `id` | Masks digits 7–10 | `A123456789` | `A12345****` |\n| `credit` | Masks digits 7–12 | `4111111111111111` | `411111******1111` |\n| `url` | Masks URL password | `http://user:pass@host` | `http://user:xxxxx@host` |\n| `abuse` | Masks abusive words via trie | `bad word` | `*** word` |\n| `struct` | Recursively masks nested struct | — | — |\n\n### Masking Slices\n\nString slices are also supported:\n\n```go\ntype Foo struct {\n    Tags []string `mask:\"name\"`\n}\n```\n\n### Masking Nested Structs\n\n```go\ntype Address struct {\n    Street string `mask:\"addr\"`\n}\n\ntype User struct {\n    Name    string  `mask:\"name\"`\n    Address Address `mask:\"struct\"`\n}\n```\n\n## Custom Mask Character\n\nBy default, `*` is used as the mask character. Use `SetMasker` to change it:\n\n```go\nm := masker.NewMaskerMarshaler()\nm.SetMasker(\"#\")\n\nmasked, _ := m.Struct(u)\n// Name \"John\" -\u003e \"J##n\"\n```\n\n## Abuse Masker\n\nThe abuse masker uses a trie for efficient word matching and replacement.\n\n### Basic Usage\n\n```go\nabuseWords := []string{\"bad\", \"terrible\", \"awful\"}\nabuseMasker := masker.NewAbuseMaskerWithWords(abuseWords)\n\ntext := \"This is a bad and terrible situation\"\nmasked := abuseMasker.Marshal(\"*\", text)\n// Output: \"This is a *** and ******** situation\"\n```\n\n### Load Words from File\n\n```go\nloader := masker.NewAbuseWordLoader()\nwords, err := loader.LoadFromFile(\"abuse_words.txt\")\nif err != nil {\n    log.Fatal(err)\n}\nabuseMasker := masker.NewAbuseMaskerWithWords(words)\n```\n\n### Use with Struct Tags\n\n```go\ntype Post struct {\n    Title   string `mask:\"name\"`\n    Content string `mask:\"abuse\"`\n}\n\nm := masker.NewMaskerMarshaler()\nm.Register(masker.MaskerTypeAbuse, masker.NewAbuseMaskerWithWords([]string{\"bad\"}))\n\nmasked, _ := m.Struct(\u0026Post{Title: \"Hello\", Content: \"bad content\"})\n```\n\n## Custom Masker\n\nImplement the `Masker` interface to create your own masker:\n\n```go\ntype Masker interface {\n    Marshal(maskChar string, value string) string\n}\n```\n\nExample:\n\n```go\ntype SSNMasker struct{}\n\nfunc (m *SSNMasker) Marshal(s, i string) string {\n    if len(i) != 9 {\n        return i\n    }\n    return \"***-**-\" + i[7:]\n}\n\nm := masker.NewMaskerMarshaler()\nm.Register(\"ssn\", \u0026SSNMasker{})\n\ntype Person struct {\n    SSN string `mask:\"ssn\"`\n}\n```\n\n## Contributors\n\nThanks to all the people who already contributed!\n\n\u003ca href=\"https://github.com/ggwhite/go-masker/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contributors-img.web.app/image?repo=ggwhite/go-masker\" /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fggwhite%2Fgo-masker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fggwhite%2Fgo-masker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fggwhite%2Fgo-masker/lists"}