[DNM] fix(security): backport v0.48.0 fixes to v0.39.x#2762
Conversation
Validate GitHub App webhook payloads before minting tokens and avoid trusting a forged enterprise host header. Also include the upstream App token scoping and remote-resource deep-copy fixes needed for the same supported release stream. Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
Download the branch-compatible golangci-lint binary into tmp and use it from make lint-go. Pin GOTOOLCHAIN for local make targets and PAC Go steps so linting does not drift with the host Go installation. Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
Signed-off-by: Shubham Bhardwaj <shubbhar@redhat.com>
There was a problem hiding this comment.
Code Review
This pull request introduces several security and robustness enhancements, including validating GitHub App webhook signatures and enterprise hosts before minting tokens, scoping GitHub App tokens, and deep-copying cached remote pipelines and tasks to prevent shared cache mutation. It also updates dependencies, configures the Go toolchain, and refactors logging and string building. Feedback on these changes highlights a critical issue in the Makefile where a non-existent golangci-lint version (v2.12.2) is specified, which will break the build, and a potential nil pointer dereference panic in pkg/resolve/remote.go if the pipeline is not successfully resolved before calling .DeepCopy().
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| TARGET_NAMESPACE=pipelines-as-code | ||
| HUGO_VERSION=0.96.0 | ||
| GOLANGCI_LINT=golangci-lint | ||
| GOLANGCI_LINT_VERSION ?= v2.12.2 |
There was a problem hiding this comment.
The version v2.12.2 for golangci-lint does not exist (golangci-lint is currently on v1.x). Attempting to download this non-existent version will cause the curl command to fail with a 404 Not Found error, breaking both local development and CI linting. Since the Go toolchain is pinned to go1.24.13, please use a version of golangci-lint that supports Go 1.24, such as v1.64.5.
GOLANGCI_LINT_VERSION ?= v1.64.5
| // if PipelineRef is used then, first resolve pipeline and replace all taskRef{Finally/Task} of Pipeline, then put inlinePipeline in PipelineRun | ||
| if pipelinerun.Spec.PipelineRef != nil && pipelinerun.Spec.PipelineRef.Resolver == "" { | ||
| pipelineResolved := fetchedResourcesForPipelineRun.Pipeline | ||
| pipelineResolved := fetchedResourcesForPipelineRun.Pipeline.DeepCopy() |
There was a problem hiding this comment.
If fetchedResourcesForPipelineRun.Pipeline is nil (for example, if the pipeline could not be resolved or found), calling .DeepCopy() on it will trigger a nil pointer dereference panic. To ensure robustness and prevent panics, add a nil check before copying the pipeline.
| pipelineResolved := fetchedResourcesForPipelineRun.Pipeline.DeepCopy() | |
| if fetchedResourcesForPipelineRun.Pipeline == nil { return nil, fmt.Errorf("pipeline %s not found", pipelinerun.Spec.PipelineRef.Name) }; pipelineResolved := fetchedResourcesForPipelineRun.Pipeline.DeepCopy() |
📝 Description of the Change
[DNM] Backport of the security fixes released in v0.48.0 to release-v0.39.x.
This PR backports the public security hardening from v0.48.0:
?secret=values are not written to stdout.How this backport was done:
release-v0.39.xin a dedicated worktree.make lint-gouse the same known-good linter binary fromtmp/.go-jose/v4replacement tov4.1.4.go-jose/v3andtektoncd/pipelinewere already at fixed versions on this branch.👨🏻 Linked Jira
N/A
🔗 Linked GitHub Issue
N/A
🧪 Testing Strategy
Validation run locally:
make testmake lint-gogo test ./pkg/adapterafter the incoming webhook log redaction backportgit diff --checkFull pre-push hooks were not used for the final push because an earlier concurrent push hit golangci-lint's single-process lock. The same
make lint-gocheck passed locally when run sequentially.🤖 AI Assistance
If you have used AI assistance, please provide the following details:
Which LLM was used?
Extent of AI Assistance:
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.