Skip to content

fix: set PipelineURL for cached pipelines to resolve relative task paths#2416

Merged
mathur07 merged 1 commit intotektoncd:mainfrom
mathur07:srvkp-10604
Feb 24, 2026
Merged

fix: set PipelineURL for cached pipelines to resolve relative task paths#2416
mathur07 merged 1 commit intotektoncd:mainfrom
mathur07:srvkp-10604

Conversation

@mathur07
Copy link
Copy Markdown
Contributor

@mathur07 mathur07 commented Jan 26, 2026

📝 Description of the Change

When multiple PipelineRuns reference the same remote pipeline with relative task paths, the second PipelineRun fails because the PipelineURL is not set when retrieving the pipeline from cache.

This causes assembleTaskFQDNs to receive an empty PipelineURL, which returns relative paths unchanged (e.g., '../../common/tasks/hello.yaml'). The go-github library then rejects these paths with 'path must not contain ..' error.

The fix sets PipelineURL when using cached pipelines, ensuring relative task paths are resolved correctly for all PipelineRuns.

Fixes: SRVKP-10604

👨🏻‍ Linked Jira

https://issues.redhat.com/browse/SRVKP-10604

🔗 Linked GitHub Issue

Fixes #

🚀 Type of Change

  • 🐛 Bug fix (fix:)
  • ✨ New feature (feat:)
  • 💥 Breaking change (feat!:, fix!:)
  • 📚 Documentation update (docs:)
  • ⚙️ Chore (chore:)
  • 💅 Refactor (refactor:)
  • 🔧 Enhancement (enhance:)
  • 📦 Dependency update (deps:)

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

If you have used AI assistance, please provide the following details:

Which LLM was used?

  • GitHub Copilot
  • ChatGPT (OpenAI)
  • Claude (Anthropic)
  • Cursor
  • Gemini (Google)
  • Other: ____________

Extent of AI Assistance:

  • Documentation and research only
  • Unit tests or E2E tests only
  • Code generation (parts of the code)
  • Full code generation (most of the PR)
  • PR description and comments
  • Commit message(s)

Important

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer to your commit message.
For example:

Co-authored-by: Gemini gemini@google.com
Co-authored-by: ChatGPT noreply@chatgpt.com
Co-authored-by: Claude noreply@anthropic.com
Co-authored-by: Cursor noreply@cursor.com
Co-authored-by: Copilot Copilot@users.noreply.github.com

**💡You can use the script ./hack/add-llm-coauthor.sh to automatically add
these co-author trailers to your commits.

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any
    issues. For an efficient workflow, I have considered installing
    pre-commit and running pre-commit install to
    automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness or provided a clear reason to bypass it.
  • If adding a provider feature, I have filled in the following and updated the provider documentation:
    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @mathur07, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug where PipelineRuns referencing a cached remote pipeline with relative task paths would fail after the initial run. The core problem stemmed from the PipelineURL not being propagated when a pipeline was retrieved from the cache, preventing the correct resolution of relative task paths. The fix ensures that the PipelineURL is always set for cached pipelines, thereby enabling proper path resolution for all subsequent PipelineRuns and improving the reliability of remote pipeline execution.

Highlights

  • Fixes Relative Task Path Resolution: Corrects an issue where relative task paths in remote pipelines were not resolved correctly for subsequent PipelineRuns when the pipeline was retrieved from cache.
  • Ensures PipelineURL is Set: The PipelineURL is now explicitly set for fetchedResourcesForPipelineRun when a pipeline is fetched from the cache, which is crucial for assembleTaskFQDNs to correctly resolve relative paths.
  • Adds Comprehensive Test Case: A new test case has been introduced to specifically validate the scenario where multiple PipelineRuns share the same remote pipeline with relative task paths, ensuring the fix works as expected.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to fix a bug where relative task paths failed to resolve for cached pipelines by correctly setting the PipelineURL. However, a security analysis revealed critical vulnerabilities: a task hijacking vulnerability due to improper PipelineURL handling when falling back to local pipelines, and a high-severity issue involving the corruption of shared cached pipeline objects. These could allow an attacker to influence PipelineRuns or hijack tasks via malicious annotations. Additionally, there's a suggestion to refactor a small piece of duplicated code to improve maintainability.

Copy link
Copy Markdown
Contributor

@martindbrv martindbrv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, that's a good catch. I left a suggestion that might be useful.

Copy link
Copy Markdown
Member

@aThorp96 aThorp96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

When multiple PipelineRuns reference the same remote pipeline with relative
task paths, the second PipelineRun fails because the PipelineURL is not set
when retrieving the pipeline from cache.

This causes assembleTaskFQDNs to receive an empty PipelineURL, which returns
relative paths unchanged (e.g., '../../common/tasks/hello.yaml'). The
go-github library then rejects these paths with 'path must not contain ..'
error.

The fix sets PipelineURL when using cached pipelines, ensuring relative task
paths are resolved correctly for all PipelineRuns.

Fixes: SRVKP-10604

Signed-off-by: Shubham Mathur <shumathu@redhat.com>
Copy link
Copy Markdown
Contributor

@martindbrv martindbrv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mathur07 mathur07 merged commit 1b043c5 into tektoncd:main Feb 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants