Skip to content

Commit

Permalink
fix(security): dont marshal secrets to JSON (#2153)
Browse files Browse the repository at this point in the history
* fix(security): dont marshal secrets to JSON

* chore: add missing config options in ITs

* chore: bump changelog
  • Loading branch information
markphelps authored Sep 21, 2023
1 parent 3c13f75 commit b56f594
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
This format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.27.2](https://github.com/flipt-io/flipt/releases/tag/v1.27.2) - 2023-09-21

### Fixed

- `security`: dont marshal secrets to JSON

## [v1.27.1](https://github.com/flipt-io/flipt/releases/tag/v1.27.1) - 2023-09-18

### Added
Expand Down
5 changes: 5 additions & 0 deletions build/testing/integration/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1233,9 +1233,14 @@ func API(t *testing.T, ctx context.Context, client sdk.SDK, namespace string, au
for _, name := range []string{
"log",
"ui",
"authentication",
"audit",
"cache",
"cors",
"server",
"storage",
"db",
"tracing",
} {
field, ok := configMap[name]
assert.True(t, ok, "Missing %s.", name)
Expand Down
8 changes: 4 additions & 4 deletions internal/config/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ func (a AuthenticationMethodOIDCConfig) info() AuthenticationMethodInfo {
// AuthenticationOIDCProvider configures provider credentials
type AuthenticationMethodOIDCProvider struct {
IssuerURL string `json:"issuerURL,omitempty" mapstructure:"issuer_url"`
ClientID string `json:"clientID,omitempty" mapstructure:"client_id"`
ClientSecret string `json:"clientSecret,omitempty" mapstructure:"client_secret"`
ClientID string `json:"-" mapstructure:"client_id"`
ClientSecret string `json:"-" mapstructure:"client_secret"`
RedirectAddress string `json:"redirectAddress,omitempty" mapstructure:"redirect_address"`
Scopes []string `json:"scopes,omitempty" mapstructure:"scopes"`
UsePKCE bool `json:"usePKCE,omitempty" mapstructure:"use_pkce"`
Expand Down Expand Up @@ -423,8 +423,8 @@ func (a AuthenticationMethodKubernetesConfig) info() AuthenticationMethodInfo {
// AuthenticationMethodGithubConfig contains configuration and information for completing an OAuth
// 2.0 flow with GitHub as a provider.
type AuthenticationMethodGithubConfig struct {
ClientSecret string `json:"clientSecret,omitempty" mapstructure:"client_secret"`
ClientId string `json:"clientId,omitempty" mapstructure:"client_id"`
ClientId string `json:"-" mapstructure:"client_id"`
ClientSecret string `json:"-" mapstructure:"client_secret"`
RedirectAddress string `json:"redirectAddress,omitempty" mapstructure:"redirect_address"`
Scopes []string `json:"scopes,omitempty" mapstructure:"scopes"`
}
Expand Down
2 changes: 1 addition & 1 deletion internal/config/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ type RedisCacheConfig struct {
Host string `json:"host,omitempty" mapstructure:"host"`
Port int `json:"port,omitempty" mapstructure:"port"`
RequireTLS bool `json:"requireTLS" mapstructure:"require_tls"`
Password string `json:"password,omitempty" mapstructure:"password"`
Password string `json:"-" mapstructure:"password"`
DB int `json:"db,omitempty" mapstructure:"db"`
PoolSize int `json:"poolSize" mapstructure:"pool_size"`
MinIdleConn int `json:"minIdleConn" mapstructure:"min_idle_conn"`
Expand Down
2 changes: 1 addition & 1 deletion internal/config/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type DatabaseConfig struct {
ConnMaxLifetime time.Duration `json:"connMaxLifetime,omitempty" mapstructure:"conn_max_lifetime"`
Name string `json:"name,omitempty" mapstructure:"name,omitempty"`
User string `json:"user,omitempty" mapstructure:"user,omitempty"`
Password string `json:"password,omitempty" mapstructure:"password,omitempty"`
Password string `json:"-" mapstructure:"password,omitempty"`
Host string `json:"host,omitempty" mapstructure:"host,omitempty"`
Port int `json:"port,omitempty" mapstructure:"port,omitempty"`
Protocol DatabaseProtocol `json:"protocol,omitempty" mapstructure:"protocol,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions internal/config/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type ServerConfig struct {
HTTPPort int `json:"httpPort,omitempty" mapstructure:"http_port"`
HTTPSPort int `json:"httpsPort,omitempty" mapstructure:"https_port"`
GRPCPort int `json:"grpcPort,omitempty" mapstructure:"grpc_port"`
CertFile string `json:"certFile,omitempty" mapstructure:"cert_file"`
CertKey string `json:"certKey,omitempty" mapstructure:"cert_key"`
CertFile string `json:"-" mapstructure:"cert_file"`
CertKey string `json:"-" mapstructure:"cert_key"`
}

func (c *ServerConfig) setDefaults(v *viper.Viper) error {
Expand Down
10 changes: 5 additions & 5 deletions internal/config/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ type Git struct {
Repository string `json:"repository,omitempty" mapstructure:"repository"`
Ref string `json:"ref,omitempty" mapstructure:"ref"`
PollInterval time.Duration `json:"pollInterval,omitempty" mapstructure:"poll_interval"`
Authentication Authentication `json:"authentication,omitempty" mapstructure:"authentication,omitempty"`
Authentication Authentication `json:"-" mapstructure:"authentication,omitempty"`
}

// Object contains configuration of readonly object storage.
Expand Down Expand Up @@ -143,8 +143,8 @@ type S3 struct {
// not all inputs are given but only partially, we will return a validation error.
// (e.g. if username for basic auth is given, and token is also given a validation error will be returned)
type Authentication struct {
BasicAuth *BasicAuth `json:"basic,omitempty" mapstructure:"basic,omitempty"`
TokenAuth *TokenAuth `json:"token,omitempty" mapstructure:"token,omitempty"`
BasicAuth *BasicAuth `json:"-" mapstructure:"basic,omitempty"`
TokenAuth *TokenAuth `json:"-" mapstructure:"token,omitempty"`
}

func (a *Authentication) validate() error {
Expand All @@ -165,8 +165,8 @@ func (a *Authentication) validate() error {
// BasicAuth has configuration for authenticating with private git repositories
// with basic auth.
type BasicAuth struct {
Username string `json:"username,omitempty" mapstructure:"username"`
Password string `json:"password,omitempty" mapstructure:"password"`
Username string `json:"-" mapstructure:"username"`
Password string `json:"-" mapstructure:"password"`
}

func (b BasicAuth) validate() error {
Expand Down

0 comments on commit b56f594

Please sign in to comment.