fix(cli,server): fix trusted flags copy-paste bug and server nil pointer panic#6501
Merged
6543 merged 2 commits intoApr 25, 2026
Merged
Conversation
CLI: `--trusted-network` and `--trusted-volumes` were both incorrectly setting `patch.Trusted.Security` due to a copy-paste error. This caused the server to receive a payload with nil Network/Volumes fields. Server: `PatchRepo` unconditionally dereferenced `in.Trusted.Network`, `in.Trusted.Volumes`, and `in.Trusted.Security` without nil checks, causing a panic when only a subset of trusted flags was provided. Fixes: panic at server/api/repo.go when using `repo update --trusted-volumes` or `repo update --trusted-network`.
6543
reviewed
Apr 25, 2026
Contributor
|
Surge PR preview deployment succeeded. View it at https://woodpecker-ci-woodpecker-pr-6501.surge.sh |
6543
approved these changes
Apr 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related bugs in
repo update --trusted-*flags:Bug 1 — CLI copy-paste error (
cli/repo/repo_update.go)--trusted-networkand--trusted-volumesboth setpatch.Trusted.Securityinstead of their respective fields:This means the CLI always sends
{Security: <value>, Network: nil, Volumes: nil}regardless of which flag was passed.Bug 2 — Server nil pointer panic (
server/api/repo.go)PatchRepounconditionally dereferences all three fields ofin.Trustedbefore checking for nil:When the CLI sends a partial payload (only some fields set), this panics with
nil pointer dereference.Fix
--trusted-network→.Networkand--trusted-volumes→.VolumesHow to reproduce
Test plan
repo update --trusted-volumes owner/repono longer panicsrepo update --trusted-network owner/repono longer panicsrepo update --trusted-security owner/repostill worksrepo update --trusted-volumes --trusted-network --trusted-security owner/reposets all three correctly🤖 Generated with Claude Code