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

JEP-224 - Add a Overall/SystemRead permission enabler controlled by the jenkins.security.SystemReadPermission system property for Jenkins 2.222+ + Add a Beta hudson.plugins.extendedread.SystemReadPermission#SYSTEM_READ permission entity for plugin developers who want to use the permission without updating the Jenkins core dependency #7

Merged
merged 5 commits into from
Feb 24, 2020

Conversation

timja
Copy link
Member

@timja timja commented Oct 13, 2019

Downstream of: jenkinsci/jenkins#4149

@batmat what do you think of this living here?

cc @oleg-nenashev

(haven't added a test here as it wouldn't show anything without bumping the jenkins core version)

@oleg-nenashev oleg-nenashev self-assigned this Nov 21, 2019
@oleg-nenashev
Copy link
Member

@timja @MarkEWaite Changelog in jenkins-infra/jenkins.io#2899 makes users to assume that this change is released while it is not. Let's spend some time today to get it over the line

@timja timja closed this Feb 24, 2020
@timja timja reopened this Feb 24, 2020
@oleg-nenashev
Copy link
Member

I will retrigger CI manually

@timja
Copy link
Member Author

timja commented Feb 24, 2020

bet you to it

@Initializer(after = InitMilestone.PLUGINS_STARTED)
public static void enableSystemReadPermission() {
if (System.getProperty("jenkins.security.SystemReadPermission") == null) {
SystemReadPermission.SYSTEM_READ.setEnabled(true);
Copy link
Member

Choose a reason for hiding this comment

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

NIT: In the current implementation it will be enabling ADMINISTER on older Jenkins core versions. I am not that concerned about that, but maybe it is an overkill

@oleg-nenashev oleg-nenashev changed the title Add system read permission enabler JEP-224 - Add a Overall/SystemRead permission enabler controlled by the jenkins.security.SystemReadPermission system property for Jenkins 2.222+ + Add a Beta hudson.plugins.extendedread.SystemReadPermission#SYSTEM_READ permission entity for plugin developers who want to use the permission without updating the Jenkins core dependency Feb 24, 2020
@oleg-nenashev
Copy link
Member

I'd guess my Release Drafter approach was a bad idea :)

Copy link

@res0nance res0nance left a comment

Choose a reason for hiding this comment

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

LGTM is there anyway to test this?

@timja
Copy link
Member Author

timja commented Feb 24, 2020

LGTM is there anyway to test this?

not without bumping the core version, but it can be tested interactively

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

I agree with @res0nance's question about testing. Since the feature is already in the weekly, I suggest to do a YOLO merge and to work on test automation as a follow-up.

@oleg-nenashev
Copy link
Member

FTR I have tested it manually. It works as expected though it does not do much without follow-up PRs like jenkinsci/jenkins#4520

@oleg-nenashev oleg-nenashev merged commit 2964999 into jenkinsci:master Feb 24, 2020
@timja timja deleted the system-read branch February 24, 2020 10:32
@oleg-nenashev
Copy link
Member

Tests I have done:

  • Startup and smoke test on a 2.204 instance without SystemRead. Even when a system property is enabled, it works fine
  • 2.222 with enabled system property. I can discover and manage the permission in the Role Strategy plugin when it is enabled.

Will cut the release


@Initializer(after = InitMilestone.PLUGINS_STARTED)
public static void enableSystemReadPermission() {
if (System.getProperty("jenkins.security.SystemReadPermission") == null) {
Copy link
Member

Choose a reason for hiding this comment

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

🤔 Seems like the current condition enables the feature if the property is not set. I think meant to enable the feature if the property was set.

Copy link
Member Author

Choose a reason for hiding this comment

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

no this is the expected behaviour, if unset then this plugin will enable it, if set then the administrator has taken control and wants to disable it even though the plugin is installed

Copy link
Member

Choose a reason for hiding this comment

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

Great sorry for the confusion 🌮

static {
Permission systemRead;
try { // System Read is available starting from Jenkins 2.222 (https://jenkins.io/changelog/#v2.222). See JEP-224 for more info
systemRead = (Permission) ReflectionUtils.getPublicProperty(Jenkins.get(), "SYSTEM_READ");
Copy link
Member

Choose a reason for hiding this comment

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

Is this ever not just a field? Why go through ReflectionUtils?

Copy link
Member Author

Choose a reason for hiding this comment

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

always a field, not sure, this can probably be removed in a follow up PR now and bump to 2.235.x LTS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants