Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shoenig/go-conceal
Stop logging secrets in Go
https://github.com/shoenig/go-conceal
conceal go golang
Last synced: 2 months ago
JSON representation
Stop logging secrets in Go
- Host: GitHub
- URL: https://github.com/shoenig/go-conceal
- Owner: shoenig
- License: bsd-3-clause
- Created: 2019-10-27T00:02:13.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-06T03:20:13.000Z (10 months ago)
- Last Synced: 2024-06-21T17:15:16.820Z (7 months ago)
- Topics: conceal, go, golang
- Language: Go
- Homepage:
- Size: 32.2 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
go-conceal
==========[![Go Reference](https://pkg.go.dev/badge/shoenig/go-conceal.svg)](https://pkg.go.dev/shoenig/go-conceal)
[![GitHub](https://img.shields.io/github/license/shoenig/go-conceal.svg)](LICENSE)Guard against logging secrets in Go.
```
conceal (verb):
1. to hide; withdraw or remove from observation
2. to keep secret; to prevent or avoid disclosing
```# Project Overview
Module `github.com/shoenig/go-conceal` can be used to help protect against sensitive
values from being exposed in places they shouldn't be, particularly in log lines.# Getting Started
The `conceal` package can be gotten with `go get`:
```
$ go get github.com/shoenig/go-conceal
```#### Example Usage
```golang
// protect a string value
text := conceal.New("abc123")
fmt.Sprintf("%s", text) // prints ""
fmt.Sprintf("%#v", text) // prints "conceal.Text{}"// protect a byte slice
b := conceal.NewBytes([]byte{1, 2, 3})
fmt.Sprintf("%s", b) // prints ""
fmt.Sprintf("%#v", b) // prints "conceal.Bytes{}"// get access to the underlying secret values
doThings(text.Unveil(), b.Unveil())
```# Contributing
The `github.com/shoenig/go-conceal` module is always improving with new features
and error corrections. For contributing bug fixes and new features please file
an issue.# License
The `github.com/shoenig/go-conceal` module is open source under the [BSD-3-Clause](LICENSE) license.