anu1097 / golang-masking-tool Goto Github PK
View Code? Open in Web Editor NEWA Simple to use golang masking tool to mask sensitive information from go-lang data-structures
License: MIT License
A Simple to use golang masking tool to mask sensitive information from go-lang data-structures
License: MIT License
Describe the bug
Masking fails for uuid.UUID{} from "github.com/google/uuid"
To Reproduce
https://go.dev/play/p/cLHp_XmfGO3
`import (
"fmt"
mt "github.com/anu1097/golang-masking-tool"
"github.com/anu1097/golang-masking-tool/filter"
"github.com/google/uuid"
)
func main() {
maskTool := mt.NewMaskTool(filter.FieldPrefixFilter("Password"))
req := uuid.UUID{}
fmt.Println(maskTool.MaskDetails(req))
}
`
Expected behavior
No panic
Additional context
well known bug already addressed for example in stretchr testify https://github.com/stretchr/testify/pull/1473/files
Describe the bug
The code handles nil ptrs and other complex stuff well but there is one bug that happens if the value of the instance passed to maskDetails is nil. Of course it is silly to pass nil but sometimes the caller might now know (I hit this on an interceptor on a use case where one object was nil)
The original masker code that this was inspired from does handle that case right away
https://github.com/ggwhite/go-masker/blob/master/masker.go#L111-L113
To Reproduce
Very simple, just
Expected behavior
This seems like a gray are because it is an error to pass a nil, so either change MaskDetails to pass an error or, if nil is passed, just return nil?
Describe the bug
Is not a bug, is a improvement for documentation reading.
Screenshots
Readme.md
I wasn't able to mask generated struct by protobuf. Is it possible to mask nested struct types?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.