GithubHelp home page GithubHelp logo

anu1097 / golang-masking-tool Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 5.0 44 KB

A Simple to use golang masking tool to mask sensitive information from go-lang data-structures

License: MIT License

Go 97.96% Shell 2.04%

golang-masking-tool's People

Contributors

1llu5ion avatar anu1097 avatar eleduardo avatar seanpburke avatar yaronius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

golang-masking-tool's Issues

using reflect.MakeSlice should adjust for Array case

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

Nil value passed to maskdetails panics

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

  1. Create a new masking instance
  2. call masker.MaskDetails(nil)

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?

Not able to mask struct

I wasn't able to mask generated struct by protobuf. Is it possible to mask nested struct types?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.