Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lgtm plugin should use trigger.TrustedUser #13740

Closed
nikhita opened this issue Aug 2, 2019 · 26 comments
Closed

lgtm plugin should use trigger.TrustedUser #13740

nikhita opened this issue Aug 2, 2019 · 26 comments
Labels
area/prow Issues or PRs related to prow kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience.

Comments

@nikhita
Copy link
Member

nikhita commented Aug 2, 2019

The lgtm plugin currently does a IsCollaborator() check to determine if a user can lgtm a PR or not. Which means that even if only_org_members: true is defined in the trigger config, outside collaborators are able to lgtm PRs.

To fix this, we should use trigger.TrustedUser() to determine whether a user is trusted or not.

Additionally, if skip_collaborators: true is configured, we can then skip the trigger.TrustedUser() check.

/sig contributor-experience
/cc @cblecker @spiffxp @alvaroaleman @stevekuznetsov
related: #13002

Happy to work on this if this makes sense.

@nikhita nikhita added the kind/bug Categorizes issue or PR as related to a bug. label Aug 2, 2019
@k8s-ci-robot k8s-ci-robot added the sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. label Aug 2, 2019
@nikhita
Copy link
Member Author

nikhita commented Aug 2, 2019

This is mainly concerning because doing a /lgtm can trigger tests.

@nikhita
Copy link
Member Author

nikhita commented Aug 2, 2019

related: #12785

@cblecker
Copy link
Member

cblecker commented Aug 2, 2019

I just.. I really dislike the whole "trusted org" logic set. That the "trust" is somehow tied to not the org the actual repo is in. If that logic wasn't there, I wouldn't even have a second thought on this.

@cblecker
Copy link
Member

cblecker commented Aug 2, 2019

ref:

// TrustedUser returns true if user is trusted in repo.
// Trusted users are either repo collaborators, org members or trusted org members.
func TrustedUser(ghc trustedUserClient, onlyOrgMembers bool, trustedOrg, user, org, repo string) (bool, error) {
// First check if user is a collaborator, assuming this is allowed
if !onlyOrgMembers {
if ok, err := ghc.IsCollaborator(org, repo, user); err != nil {
return false, fmt.Errorf("error in IsCollaborator: %v", err)
} else if ok {
return true, nil
}
}
// TODO(fejta): consider dropping support for org checks in the future.
// Next see if the user is an org member
if member, err := ghc.IsMember(org, user); err != nil {
return false, fmt.Errorf("error in IsMember(%s): %v", org, err)
} else if member {
return true, nil
}
// Determine if there is a second org to check
if trustedOrg == "" || trustedOrg == org {
return false, nil // No trusted org and/or it is the same
}
// Check the second trusted org.
member, err := ghc.IsMember(trustedOrg, user)
if err != nil {
return false, fmt.Errorf("error in IsMember(%s): %v", trustedOrg, err)
}
return member, nil
}

@alvaroaleman
Copy link
Member

I just.. I really dislike the whole "trusted org" logic set. That the "trust" is somehow tied to not the org the actual repo is in. If that logic wasn't there, I wouldn't even have a second thought on this.

Thats a fair point but IMHO an orthogonal issue. The issue we have here is that we have code to determine if a user is trusted and the LGTM plugin does something that requires trust (starting tests) without calling into that code but instead using a different check.

Independently of what TrustedUser actually does and if that always makes sense, IMHO everything that starts tests on a PullRequest should call into it to check if the user who triggered the event is trusted.

@spiffxp
Copy link
Member

spiffxp commented Aug 6, 2019

/area prow

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 4, 2019
@cblecker
Copy link
Member

cblecker commented Nov 4, 2019

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 4, 2019
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 2, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 3, 2020
@cblecker
Copy link
Member

cblecker commented Mar 7, 2020

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Mar 7, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 5, 2020
@alvaroaleman
Copy link
Member

I think this is somethings we still need to fix. There is no good reason to have different codepaths to determine "trust" in different places.

Using/Not using the "trusted org" concept is completely orthogonal to this.

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jul 5, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@alvaroaleman
Copy link
Member

/reopen

@k8s-ci-robot k8s-ci-robot reopened this Aug 5, 2020
@k8s-ci-robot
Copy link
Contributor

@alvaroaleman: Reopened this issue.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@cblecker
Copy link
Member

/remove-lifecycle rotten
/reopen

@k8s-ci-robot k8s-ci-robot reopened this Sep 20, 2020
@k8s-ci-robot
Copy link
Contributor

@cblecker: Reopened this issue.

In response to this:

/remove-lifecycle rotten
/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Sep 20, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 19, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 18, 2021
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/prow Issues or PRs related to prow kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants