Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nil value passed to maskdetails panics #8

Closed
eleduardo opened this issue Mar 2, 2023 · 0 comments
Closed

Nil value passed to maskdetails panics #8

eleduardo opened this issue Mar 2, 2023 · 0 comments

Comments

@eleduardo
Copy link
Contributor

eleduardo commented Mar 2, 2023

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?

eleduardo added a commit to eleduardo/golang-masking-tool that referenced this issue Mar 3, 2023
@anu1097 anu1097 closed this as completed in 8123ae5 Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant