Skip to content

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jul 4, 2025

This PR contains the following updates:

Package Change Age Confidence
github.com/go-viper/mapstructure/v2 v2.2.1 -> v2.3.0 age confidence

GitHub Vulnerability Alerts

GHSA-fv92-fjc5-jj9h

Summary

Use of this library in a security-critical context may result in leaking sensitive information, if used to process sensitive fields.

Details

OpenBao (and presumably HashiCorp Vault) have surfaced error messages from mapstructure as follows:

https://github.com/openbao/openbao/blob/98c3a59c040efca724353ca46ca79bd5cdbab920/sdk/framework/field_data.go#L43-L50

			_, _, err := d.getPrimitive(field, schema)
			if err != nil {
				return fmt.Errorf("error converting input for field %q: %w", field, err)
			}

where this calls mapstructure.WeakDecode(...): https://github.com/openbao/openbao/blob/98c3a59c040efca724353ca46ca79bd5cdbab920/sdk/framework/field_data.go#L181-L193

func (d *FieldData) getPrimitive(k string, schema *FieldSchema) (interface{}, bool, error) {
	raw, ok := d.Raw[k]
	if !ok {
		return nil, false, nil
	}

	switch t := schema.Type; t {
	case TypeBool:
		var result bool
		if err := mapstructure.WeakDecode(raw, &result); err != nil {
			return nil, false, err
		}
		return result, true, nil

Notably, WeakDecode(...) eventually calls one of the decode helpers, which surfaces the original value:

https://github.com/go-viper/mapstructure/blob/1a66224d5e54d8757f63bd66339cf764c3292c21/mapstructure.go#L679-L686

https://github.com/go-viper/mapstructure/blob/1a66224d5e54d8757f63bd66339cf764c3292c21/mapstructure.go#L726-L730

https://github.com/go-viper/mapstructure/blob/1a66224d5e54d8757f63bd66339cf764c3292c21/mapstructure.go#L783-L787

& more.

PoC

To reproduce with OpenBao:

$ podman run -p 8300:8300 openbao/openbao:latest server -dev -dev-root-token-id=root -dev-listen-address=0.0.0.0:8300

and in a new tab:

$ BAO_TOKEN=root BAO_ADDR=http://localhost:8300 bao auth enable userpass
Success! Enabled userpass auth method at: userpass/
$ curl -X PUT -H "X-Vault-Request: true" -H "X-Vault-Token: root" -d '{"password":{"asdf":"my-sensitive-value"}}' "http://localhost:8300/v1/auth/userpass/users/adsf"
{"errors":["error converting input for field \"password\": '' expected type 'string', got unconvertible type 'map[string]interface {}', value: 'map[asdf:my-sensitive-value]'"]}

Impact

This is an information disclosure bug with little mitigation. See https://discuss.hashicorp.com/t/hcsec-2025-09-vault-may-expose-sensitive-information-in-error-logs-when-processing-malformed-data-with-the-kv-v2-plugin/74717 for a previous version. That version was fixed, but this is in the second part of that error message (starting at '' expected a map, got 'string' -- when the field type is string and a map is provided, we see the above information leak -- the previous example had a map type field with a string value provided).

This was rated 4.5 Medium by HashiCorp in the past iteration.


Release Notes

go-viper/mapstructure (github.com/go-viper/mapstructure/v2)

v2.3.0

Compare Source

What's Changed

New Contributors

Full Changelog: go-viper/mapstructure@v2.2.1...v2.3.0


Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added the renovate label Jul 4, 2025
@renovate renovate bot requested a review from a team July 4, 2025 22:22
@renovate renovate bot requested a review from a team as a code owner July 4, 2025 22:22
@renovate renovate bot added the renovate label Jul 4, 2025
Copy link

netlify bot commented Jul 4, 2025

Deploy Preview for polite-licorice-3db33c canceled.

Name Link
🔨 Latest commit 458f0cf
🔍 Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/68685425c59ee1000879c497

@renovate renovate bot merged commit caa0ed0 into main Jul 5, 2025
15 checks passed
@renovate renovate bot deleted the renovate/vulnerability-updates branch July 5, 2025 02:51
@github-actions github-actions bot mentioned this pull request Jul 5, 2025
beeme1mr pushed a commit that referenced this pull request Jul 14, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>flagd: 0.12.6</summary>

##
[0.12.6](flagd/v0.12.5...flagd/v0.12.6)
(2025-07-10)


### 🐛 Bug Fixes

* **security:** update module github.com/go-viper/mapstructure/v2 to
v2.3.0 [security]
([#1667](#1667))
([caa0ed0](caa0ed0))


### ✨ New Features

* add sync_context to SyncFlags
([#1642](#1642))
([07a45d9](07a45d9))
</details>

<details><summary>flagd-proxy: 0.7.5</summary>

##
[0.7.5](flagd-proxy/v0.7.4...flagd-proxy/v0.7.5)
(2025-07-10)


### 🐛 Bug Fixes

* **security:** update module github.com/go-viper/mapstructure/v2 to
v2.3.0 [security]
([#1667](#1667))
([caa0ed0](caa0ed0))


### ✨ New Features

* add sync_context to SyncFlags
([#1642](#1642))
([07a45d9](07a45d9))
</details>

<details><summary>core: 0.11.6</summary>

##
[0.11.6](core/v0.11.5...core/v0.11.6)
(2025-07-10)


### ✨ New Features

* add sync_context to SyncFlags
([#1642](#1642))
([07a45d9](07a45d9))
* allowing null/missing defaultValue
([#1659](#1659))
([3f6b78c](3f6b78c))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants