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

[FIXED JENKINS-18884] Access check to jobs in People pages. #1102

Conversation

ikedam
Copy link
Member

@ikedam ikedam commented Jan 26, 2014

People page displays users extracted from change logs of jobs belonging to that view.
And People page of All view also displays all users registered in Jenkins.

They do no permission check.

This patch does followings:

  • Adds permission check to jobs to extract users (now requires Read permission).
  • People page of All view no longer display all users registered in Jenkins. It works same as those of other views:
    • There is no reason for People page of All page to work different from those of other views.
    • Displaying all users in Jenkins should be handled by security realms (like HudsonPrivateSecurityRealm.ManageUserLinks). If needed, I would implement a default user listing page for administrators.

This is another approach of #1094 .
First I planned to add a new permission to restrict access to People page in All view, but I get to think that the root problem is the difference of behaviors of People pages between All view and other views.

…e page. People page of AllView no longer lists all users. That feature should be provided by security realms.
@cloudbees-pull-request-builder

core » jenkins-core #86 SUCCESS
This pull request looks good

}
}

// for testing purpose
/*package*/ Set<User> getModified() {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe use @Restricted(NoExternalUse.class) here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know much about access-modifier. Is it right to understand like this?:

  • NoExternalUse stands for "do not use from packages other than core"
  • That is put to prevent access to AsynchPeople#getModified from plugins.
  • Though test package accesses to AsynchPeople#getModified, that doesn't matter for access-modifier-checker is not configured for test package.

@cloudbees-pull-request-builder

core » jenkins-core #88 SUCCESS
This pull request looks good

/*package*/ Set<User> getModified() {
return modified;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Added @Restricted(NoExternalUse.class) to prevent access from other packages (especially plugins).

  • Functions#printLogRecordHtml and Run#previousBuild are also annotated with @Restricted(NoExternalUse.class) and accessed from test package.
  • test package does not fail even access-modifier-checker is added to pom.xml. It seems that access-modifier-checker does not check accesses from src/test directories.

Copy link
Member

Choose a reason for hiding this comment

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

to prevent access from other packages

Doesn't work that way – there's already the default visibility for that. AFAIK it works like this: @Restricted(NoExternalUse.class) prevents use by e.g. plugins (that need to consider this annotation by using the access modifier checker that is part of the same component), even if they have classes in the same package. Nobody would really care about its visibility, as it can always be changed, including code that uses it – except, due to plugins, once it's accessible and released, someone might use it and removal will break that plugin. See Javadoc here, and the general documentation for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, so it prevents access not from other packages, but from other modules. Is it right?

@cloudbees-pull-request-builder

core » jenkins-core #117 SUCCESS
This pull request looks good

@uhafner
Copy link
Member

uhafner commented Feb 2, 2014

In this approach the mapping of the user ID to the user name is still visible (for all the jobs a user has read permission). This should be actually prevented in JENKINS-18884. Can we additionally bind the visibility of the user ID property to the ADMINISTRATOR permission? Then in the people view only the user names of the "friend" projects are shown but not the IDs.

@ikedam
Copy link
Member Author

ikedam commented Feb 2, 2014

How about introducing a new permission to access http://JENKINS/user/XXXX ?
Users without that permission can access only his or her own page.

@uhafner
Copy link
Member

uhafner commented Feb 2, 2014

Yes, that would be a another good (and simple?) approach. Didn't you already implement that in your other pull request?

(I'm still wondering though why it is required to see a user ID on any UI page, the user name should be sufficient.)

@ikedam
Copy link
Member Author

ikedam commented Feb 3, 2014

No, I didn't.

I also wonder those features are really required (including People page itself).
But at the same time, I'm not sure they are never required by anyone.
I think it would be better to preserve existing features or provide alternate way for existing users.

@uhafner
Copy link
Member

uhafner commented Feb 3, 2014

You are right, it might be to risky to remove the user ID.

@daniel-beck
Copy link
Member

People page could alternatively be extracted into a plugin, then users could disable it or (more easily) customize. And IMO it's easier to justify new permissions introduced in plugins. I see no reason to keep this in core.

@jglick
Copy link
Member

jglick commented May 15, 2014

I filed a card for that idea. It is true that in a lot of installations the People view is undesirable; and I have had to do major work on it to make it perform acceptably.

@President
Copy link

Why isn't it still merged?

@jglick
Copy link
Member

jglick commented Oct 22, 2014

Still recommend this be pulled out into an optional plugin, which could then additionally define a new permission if there is a need for some users but not others to view the list of all users.

@jglick
Copy link
Member

jglick commented Jan 30, 2015

My alternate recommendation now filed as JENKINS-26469.

@oleg-nenashev
Copy link
Member

I'd rather agree with @jglick , but IMO it makes sense even in the current state
So 👍 if the merge conflict gets fixed

@oleg-nenashev oleg-nenashev added needs-more-reviews Complex change, which would benefit from more eyes needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging labels Oct 20, 2015
@dasJ
Copy link

dasJ commented Jan 5, 2016

What about the conflict @ikedam

@ikedam
Copy link
Member Author

ikedam commented Jan 5, 2016

I don't plan to work for this issue anymore.
I'll abondon this request.
Thanks for the reviews.

@ikedam ikedam closed this Jan 5, 2016
@hypery2k hypery2k mentioned this pull request Sep 16, 2018
4 tasks
@hypery2k hypery2k mentioned this pull request Jan 28, 2019
4 tasks
@hypery2k
Copy link

Give new PR a try: #9052

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging needs-more-reviews Complex change, which would benefit from more eyes
Projects
None yet
10 participants