Skip to content

WithRedactFields option to respect struct tag value of - #59

@pjebs

Description

@pjebs
type User struct {
    Username string `json:"username"`
    Email    string `json:"email,omitempty"`
    Password string `json:"-"`      // This field will be ignored by the json package
}

It would be good if there was an option if any Field contains a stuct tag with a value of "-", it considers it sensitive.

The option should allow a list of struct tag keys to check. The user is expected to type in for example: "json".
If none is provided, then if ANY struct tag key contains a value of "-", that field gets redacted.

type User struct {
    Username string `xml:"-"`
    Email    string `json:"email", msgpack:"-"`
    Password string `json:"-"`      
}

In the above example, all Fields will be redacted (including Email field)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions