1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00
Forgejo runner - alpha release, should not be considered secure enough to deploy in production
Find a file
Renovate Bot 4c3cfd3dd7
Update github.com/go-viper/mapstructure/v2 (indirect) to v2.3.0 [SECURITY] (#622)
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) | `v2.2.1` -> `v2.3.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fgo-viper%2fmapstructure%2fv2/v2.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fgo-viper%2fmapstructure%2fv2/v2.2.1/v2.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### mapstructure May Leak Sensitive Information in Logs When Processing Malformed Data
[GHSA-fv92-fjc5-jj9h](https://github.com/advisories/GHSA-fv92-fjc5-jj9h)

<details>
<summary>More information</summary>

#### Details
##### 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:

98c3a59c04/sdk/framework/field_data.go (L43-L50)

```go
			_, _, 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(...)`: 98c3a59c04/sdk/framework/field_data.go (L181-L193)

```go

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:

1a66224d5e/mapstructure.go (L679-L686)

1a66224d5e/mapstructure.go (L726-L730)

1a66224d5e/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.

#### Severity
- CVSS Score: 5.3 / 10 (Medium)
- Vector String: `CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N`

#### References
- [https://github.com/go-viper/mapstructure/security/advisories/GHSA-fv92-fjc5-jj9h](https://github.com/go-viper/mapstructure/security/advisories/GHSA-fv92-fjc5-jj9h)
- [https://github.com/go-viper/mapstructure](https://github.com/go-viper/mapstructure)

This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-fv92-fjc5-jj9h) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)).
</details>

---

### Release Notes

<details>
<summary>go-viper/mapstructure (github.com/go-viper/mapstructure/v2)</summary>

### [`v2.3.0`](https://github.com/go-viper/mapstructure/releases/tag/v2.3.0)

[Compare Source](https://github.com/go-viper/mapstructure/compare/v2.2.1...v2.3.0)

#### What's Changed

- build(deps): bump actions/checkout from 4.1.7 to 4.2.0 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/46
- build(deps): bump golangci/golangci-lint-action from 6.1.0 to 6.1.1 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/47
- \[enhancement] Add check for `reflect.Value` in `ComposeDecodeHookFunc` by [@&#8203;mahadzaryab1](https://github.com/mahadzaryab1) in https://github.com/go-viper/mapstructure/pull/52
- build(deps): bump actions/setup-go from 5.0.2 to 5.1.0 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/51
- build(deps): bump actions/checkout from 4.2.0 to 4.2.2 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/50
- build(deps): bump actions/setup-go from 5.1.0 to 5.2.0 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/55
- build(deps): bump actions/setup-go from 5.2.0 to 5.3.0 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/58
- ci: add Go 1.24 to the test matrix by [@&#8203;sagikazarmark](https://github.com/sagikazarmark) in https://github.com/go-viper/mapstructure/pull/74
- build(deps): bump golangci/golangci-lint-action from 6.1.1 to 6.5.0 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/72
- build(deps): bump golangci/golangci-lint-action from 6.5.0 to 6.5.1 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/76
- build(deps): bump actions/setup-go from 5.3.0 to 5.4.0 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/78
- feat: add decode hook for netip.Prefix by [@&#8203;tklauser](https://github.com/tklauser) in https://github.com/go-viper/mapstructure/pull/85
- Updates by [@&#8203;sagikazarmark](https://github.com/sagikazarmark) in https://github.com/go-viper/mapstructure/pull/86
- build(deps): bump github/codeql-action from 2.13.4 to 3.28.15 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/87
- build(deps): bump actions/setup-go from 5.4.0 to 5.5.0 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/93
- build(deps): bump github/codeql-action from 3.28.15 to 3.28.17 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/92
- build(deps): bump github/codeql-action from 3.28.17 to 3.28.19 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/97
- build(deps): bump ossf/scorecard-action from 2.4.1 to 2.4.2 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/96
- Update README.md by [@&#8203;peczenyj](https://github.com/peczenyj) in https://github.com/go-viper/mapstructure/pull/90
- Add omitzero tag. by [@&#8203;Crystalix007](https://github.com/Crystalix007) in https://github.com/go-viper/mapstructure/pull/98
- Use error structs instead of duplicated strings by [@&#8203;m1k1o](https://github.com/m1k1o) in https://github.com/go-viper/mapstructure/pull/102
- build(deps): bump github/codeql-action from 3.28.19 to 3.29.0 by [@&#8203;dependabot](https://github.com/dependabot) in https://github.com/go-viper/mapstructure/pull/101
- feat: add common error interface by [@&#8203;sagikazarmark](https://github.com/sagikazarmark) in https://github.com/go-viper/mapstructure/pull/105
- update linter by [@&#8203;sagikazarmark](https://github.com/sagikazarmark) in https://github.com/go-viper/mapstructure/pull/106
- Feature allow unset pointer by [@&#8203;rostislaved](https://github.com/rostislaved) in https://github.com/go-viper/mapstructure/pull/80

#### New Contributors

- [@&#8203;tklauser](https://github.com/tklauser) made their first contribution in https://github.com/go-viper/mapstructure/pull/85
- [@&#8203;peczenyj](https://github.com/peczenyj) made their first contribution in https://github.com/go-viper/mapstructure/pull/90
- [@&#8203;Crystalix007](https://github.com/Crystalix007) made their first contribution in https://github.com/go-viper/mapstructure/pull/98
- [@&#8203;rostislaved](https://github.com/rostislaved) made their first contribution in https://github.com/go-viper/mapstructure/pull/80

**Full Changelog**: https://github.com/go-viper/mapstructure/compare/v2.2.1...v2.3.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "" (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

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

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xLjQiLCJ1cGRhdGVkSW5WZXIiOiI0MS4xLjQiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/622
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Co-authored-by: Renovate Bot <bot@kriese.eu>
Co-committed-by: Renovate Bot <bot@kriese.eu>
2025-06-29 07:35:20 +00:00
.forgejo fix: unify data.forgejo.org/forgejo/forgejo-build-publish (#613) 2025-06-14 15:48:35 +00:00
.github/workflows Add tests to Windows build (#585) 2025-05-30 08:12:41 +00:00
contrib Fix comments in systemd unit service file (#274) 2024-09-18 13:40:32 +00:00
examples chore: fix typos and add type checking to port/addr args (#576) 2025-06-01 15:03:22 +00:00
internal chore: fix typos and add type checking to port/addr args (#576) 2025-06-01 15:03:22 +00:00
scripts add instructions to run under systemd user services 2024-02-19 09:09:57 +01:00
.dockerignore [FORGEJO] build forgejo-runner 2023-08-23 14:44:47 +02:00
.editorconfig Add .editorconfig and .gitattributes (#186) 2023-05-13 23:51:22 +08:00
.gitattributes Add .editorconfig and .gitattributes (#186) 2023-05-13 23:51:22 +08:00
.gitignore Add support for windows build on GitHub (#312) 2024-11-07 07:30:12 +00:00
.golangci.yml ci(lint): refactor code for clarity and linting compliance (#289) 2023-07-13 01:10:54 +00:00
build.go Support cache (#25) 2023-02-28 23:39:30 +08:00
Dockerfile Update data.forgejo.org/oci/alpine Docker tag to v3.22 (#616) 2025-06-18 05:43:57 +00:00
go.mod Update github.com/go-viper/mapstructure/v2 (indirect) to v2.3.0 [SECURITY] (#622) 2025-06-29 07:35:20 +00:00
go.sum Update github.com/go-viper/mapstructure/v2 (indirect) to v2.3.0 [SECURITY] (#622) 2025-06-29 07:35:20 +00:00
LICENSE [FORGEJO] branding 2023-08-23 16:03:12 +02:00
main.go Refactor to new framework (#98) 2023-04-04 21:32:04 +08:00
Makefile chore: fix typos and add type checking to port/addr args (#576) 2025-06-01 15:03:22 +00:00
README.md chore: fix typos and add type checking to port/addr args (#576) 2025-06-01 15:03:22 +00:00
RELEASE-NOTES.md Release notes for v6.3.2 [skip cascade] [skip ci] (#573) 2025-05-26 05:01:50 +00:00
renovate.json chore(renovate): drop explicit config in favor of preset 2025-05-12 11:23:24 +02:00

Forgejo Runner

WARNING: this is alpha release quality code and should not be considered secure enough to deploy in production.

A daemon that connects to a Forgejo instance and runs jobs for continuous integration. The installation and usage instructions are part of the Forgejo documentation.

Reporting bugs

When filing a bug in the issue tracker, it is very helpful to propose a pull request in the end-to-end tests repository that adds a reproducer. It will fail the CI and unambiguously demonstrate that the problem exists. In most cases it is enough to add a workflow (see the echo example). For more complicated cases it is also possible to add a runner config file as well as shell scripts to setup and teardown the test case (see the service example).

Hacking

The Forgejo runner depends on a fork of ACT and is a dependency of the setup-forgejo action. See the full dependency graph for a global view.

Local debug

The repositories are checked out in the same directory:

Install dependencies

The dependencies are installed manually or with:

setup-forgejo/forgejo-dependencies.sh

Build the Forgejo runner with the local ACT

The Forgejo runner is rebuilt with the ACT directory by changing the runner/go.mod file to:

replace github.com/nektos/act => ../act

Running:

cd runner ; go mod tidy

Building:

cd runner ; rm -f forgejo-runner ; make forgejo-runner

Launch Forgejo and the runner

A Forgejo instance is launched with:

cd setup-forgejo
./forgejo.sh setup
firefox $(cat forgejo-url)

The user is root with password admin1234. The runner is registered with:

cd setup-forgejo
docker exec --user 1000 forgejo forgejo actions generate-runner-token > forgejo-runner-token
../runner/forgejo-runner register --no-interactive --instance "$(cat forgejo-url)" --name runner --token $(cat forgejo-runner-token) --labels docker:docker://node:20-bullseye,self-hosted:host://-self-hosted,lxc:lxc://debian:bullseye

And launched with:

cd setup-forgejo ; ../runner/forgejo-runner --config runner-config.yml daemon

Note that the runner-config.yml is required in that particular case to configure the network in bridge mode, otherwise the runner will create a network that cannot reach the forgejo instance.

Try a sample workflow

From the Forgejo web interface, create a repository and add the following to .forgejo/workflows/try.yaml. It will launch the job and the result can be observed from the actions tab.

on: [push]
jobs:
  ls:
    runs-on: docker
    steps:
      - uses: actions/checkout@v3
      - run: |
          ls ${{ github.workspace }}