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

Fixes #6184 - JEP-411 will deprecate/remove the SecurityManager from … #9616

Merged
merged 4 commits into from Apr 6, 2023

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Apr 3, 2023

…the JVM.

Removed usages of SecurityManager and AccessControlller.doPrivileged(). In places where they are still necessary, now using reflection.

…the JVM.

Removed usages of `SecurityManager` and `AccessControlller.doPrivileged()`.
In places where they are still necessary, now using reflection.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>

// TODO: maybe we should re-construct providers created from classname.
}

private static void checkPermission(String permission)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we have a util class or method that does this as this is used in a few places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about this and there are only 2 places, which are quite unrelated: here and ContextHandler.
Given that JASPI is not the most common specification, I thought that the less dependencies the better, so a utility class was not worth the effort.
Note also that all JASPI permissions are AuthPermissions, while a generic utility class would need a more generic signature, making this class a little more verbose.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure this is no more complex than changing the method signature to checkPermission(Permission). So my preference is still for a utility class/method.

{
Properties properties = new Properties();
properties.putAll(System.getProperties());
Properties properties = new Properties();
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're running in < jdk18, why don't we continue to do the privileged action?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the usage of privileged actions was done in very few places, leaving without many other places that would have required it.
Given that the few ones we had were definitely not enough, I think it's better to have none.

return System.getProperty("org.eclipse.jetty.util.cacheLineBytes", String.valueOf(defaultValue));
}
}));
value = Integer.parseInt(System.getProperty("org.eclipse.jetty.util.cacheLineBytes", String.valueOf(defaultValue)));
Copy link
Contributor

Choose a reason for hiding this comment

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

If running in < jdk 18 don't we still want to do the privileged action?

@sbordet sbordet requested a review from janbartel April 3, 2023 13:39
gregw
gregw previously approved these changes Apr 4, 2023
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

I kind of would like to see a util class for at least getSecurityManager()... but then I'm ok with it as is as well. 60:40

janbartel
janbartel previously approved these changes Apr 5, 2023
Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

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

Still prefer a utility/class method as the cleanest solution. But I guess we can always refactor that after you commit this.


// TODO: maybe we should re-construct providers created from classname.
}

private static void checkPermission(String permission)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure this is no more complex than changing the method signature to checkPermission(Permission). So my preference is still for a utility class/method.

@joakime
Copy link
Contributor

joakime commented Apr 5, 2023

I kind of would like to see a util class for at least getSecurityManager()... but then I'm ok with it as is as well. 60:40

What would this getter return?
The java.lang.SecurityManager class is being removed from the JVM.

… JEP 411 changes.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet dismissed stale reviews from janbartel and gregw via 97fb457 April 5, 2023 16:43
@sbordet sbordet requested review from janbartel and gregw April 5, 2023 16:48
joakime
joakime previously approved these changes Apr 5, 2023
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

Much better

@sbordet sbordet merged commit 2c61011 into jetty-10.0.x Apr 6, 2023
4 checks passed
@sbordet sbordet deleted the fix/jetty-10-6184-remove-securitymanager branch April 6, 2023 08:59
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.

None yet

4 participants