fix restrict same repo ACL perm to trusted context#2665
fix restrict same repo ACL perm to trusted context#2665chmouel merged 1 commit intotektoncd:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the GitHub ACL logic by introducing a canUseSameRepoPullRequestShortcut helper function. This change ensures that the same-repo shortcut—which allows CI to run for non-members when the branch is within the same repository—is only applied to specific event types like pull requests and check runs, while excluding issue comments for better security. Corresponding unit tests were added to verify the behavior across different event types. I have no feedback to provide as there were no review comments to evaluate.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2665 +/- ##
==========================================
+ Coverage 58.82% 58.85% +0.03%
==========================================
Files 204 204
Lines 20134 20149 +15
==========================================
+ Hits 11844 11859 +15
Misses 7525 7525
Partials 765 765 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fa3a5fe to
fd77c9e
Compare
🤖 AI Analysis - pr-complexity-rating📊 PR Review Complexity
Overall difficulty: Moderate SummaryThis PR addresses a security concern where Suggested reviewers focus
Generated by Pipelines-as-Code LLM Analysis |
🤖 AI Analysis - pr-complexity-rating📊 PR Review Complexity
Overall difficulty: Moderate SummaryThis PR addresses a security-sensitive bug (Fixes #2664) where Suggested reviewers focus
Generated by Pipelines-as-Code LLM Analysis |
fd77c9e to
a84715e
Compare
🤖 AI Analysis - pr-complexity-rating📊 PR Review Complexity
Overall difficulty: Moderate SummaryThis PR fixes a security loophole where Suggested reviewers focus
Generated by Pipelines-as-Code LLM Analysis |
🤖 AI Analysis - pr-complexity-rating📊 PR Review Complexity
Overall difficulty: Hard SummaryThis PR fixes a security/ACL vulnerability where Suggested reviewers focus
Generated by Pipelines-as-Code LLM Analysis |
|
The AI Analysis should update the comment, there is something buggy here... and it runs too many times. |
yeah, was thinking same and I think it is running on every iteration. |
|
caputred the issue in this jira https://redhat.atlassian.net/browse/SRVKP-11549 |
🤖 AI Analysis - pr-complexity-rating📊 PR Review Complexity
Generated by Pipelines-as-Code LLM Analysis |
🤖 AI Analysis - pr-complexity-rating📊 PR Review Complexity
Generated by Pipelines-as-Code LLM Analysis |
3f47fbd to
097221f
Compare
Avoid granting issue_comment senders trust based solely on same-repo PR shape. Keep the same-repo fast path for pull_request events and PR rerequest flows, while forcing comment senders through collaborator, org-membership, or OWNERS checks. Add regression coverage to ensure issue_comment events do not bypass ACL and same-repo check_run/check_suite rerequests continue to work. Adjust the GitHub ok-to-test e2e to assert the untrusted comment path without waiting for MinNumberStatus=1. That wait only revalidated the original pull request status and did not prove that the issue_comment event triggered anything. The updated test now verifies that an untrusted same-repo issue_comment does not create a new PipelineRun or Repository status and emits the expected debug log. Fixes tektoncd#2664 Co-authored-by: Cursor <cursor@users.noreply.github.com> Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
097221f to
7b9b4b0
Compare
|
FYI, this doesn't address any real security bug, it just tight things down a bit more |
|
This should be good to merge i believe... added a further e2e and a logging, |
📝 Description of the Change
Avoid granting issue_comment senders trust based solely on same-repo PR shape.
Keep the same-repo fast path for pull_request events and PR rerequest flows, while forcing comment senders through collaborator, org-membership, or OWNERS checks.
Add regression coverage to ensure issue_comment events do not bypass ACL, add debug-log coverage for the skipped shortcut path, and keep same-repo check_run/check_suite rerequests covered.
The GitHub ok-to-test e2e is intentionally limited to the untrusted comment path. It verifies that an untrusted same-repo issue_comment does not create a new PipelineRun or Repository status and emits the expected debug log. It does not expect a trusted /ok-to-test to create a second run on an already successful PR, because the matcher filters out already successful templates for ok-to-test/retest flows.
🔗 Linked GitHub Issue
Fixes #2664
🧪 Testing Strategy
🤖 AI Assistance
AI assistance can be used for various tasks, such as code generation,
documentation, or testing.
Please indicate whether you have used AI assistance
for this PR and provide details if applicable.
Important
Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Claude noreply@anthropic.com
✅ 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.