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

8353642: Deprecate URL::getPermission method and networking permission classes for removal #24592

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dfuch
Copy link
Member

@dfuch dfuch commented Apr 11, 2025

Please find her a patch that deprecate networking permission classes for removal. The method URL::getPermission now serves little purpose and is also deprecated. That method was overridden in subclasses and specified to return some of the deprecated permissions.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8354406 to be approved

Issues

  • JDK-8353642: Deprecate URL::getPermission method and networking permission classes for removal (Enhancement - P3)
  • JDK-8354406: Deprecate URL::getPermission method and networking permission classes for removal (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24592/head:pull/24592
$ git checkout pull/24592

Update a local copy of the PR:
$ git checkout pull/24592
$ git pull https://git.openjdk.org/jdk.git pull/24592/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24592

View PR using the GUI difftool:
$ git pr show -t 24592

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24592.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 11, 2025

👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 11, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 11, 2025
@openjdk
Copy link

openjdk bot commented Apr 11, 2025

@dfuch The following labels will be automatically applied to this pull request:

  • net
  • nio
  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added security security-dev@openjdk.org nio nio-dev@openjdk.org net net-dev@openjdk.org labels Apr 11, 2025
@mlbridge
Copy link

mlbridge bot commented Apr 11, 2025

Webrevs

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Apr 11, 2025
@dfuch
Copy link
Member Author

dfuch commented Apr 11, 2025

The CSR is also ready to be reviewed at https://bugs.openjdk.org/browse/JDK-8354406

*/
@Deprecated(since = "25")
Copy link
Member

Choose a reason for hiding this comment

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

can this (and all other getPermission methods) be "forRemoval=true"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly. @AlanBateman may have some thoughts on this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should at least consider deprecating URLConnection.getPermission and HttpURLConnection.getPermission for removal, only because I don't immediately see the advantage of doing it in two steps for these two APIs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks - I will do that then

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

}
return this.sp.implies(that.sp);
@SuppressWarnings("removal")
var result = this.sp.implies(that.sp);
Copy link
Member

Choose a reason for hiding this comment

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

Will we need to rewrite this code without SocketPermissions? Can we remove it, maybe? It is only used by CodeSource.implies, which is not used by the JDK (but may be used elsewhere).

Copy link
Member

Choose a reason for hiding this comment

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

also the JavaDoc of the implies method references the SocketPermission. That will also need to be cleaned up at some point.

Copy link
Member Author

Choose a reason for hiding this comment

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

That will be left over for someone in security-libs to cleanup this code at their convenience before we remove SocketException.

Hmmm... If the public API references SocketException we might have to deprecate in this PR too. Not sure what the implications are. Maybe @seanjmullan can advise.

@@ -1305,6 +1307,8 @@ public static void main(String args[]) throws Exception {
* @serial include
*/

@SuppressWarnings("removal")
@Deprecated(since = "25", forRemoval = true)
Copy link
Member

Choose a reason for hiding this comment

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

this class is internal, no need to deprecate

Copy link
Member Author

@dfuch dfuch Apr 11, 2025

Choose a reason for hiding this comment

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

It helps getting warnings at the place where the class is used.

@djelinski
Copy link
Member

The GHA failure (Windows) appears to be related.

@dfuch
Copy link
Member Author

dfuch commented Apr 11, 2025

The GHA failure (Windows) appears to be related.

Yes - I missed one windows specific file in my original patch. I have a test running in the CI and I am waiting for it to pass before updating the PR.

@@ -456,12 +457,16 @@ private boolean matchLocation(CodeSource that) {
return false;
}
if (this.sp == null) {
this.sp = new SocketPermission(thisHost, "resolve");
@SuppressWarnings("removal")
var _ = this.sp = new SocketPermission(thisHost, "resolve");
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason for the var _ = bit ?

Copy link
Member Author

@dfuch dfuch Apr 11, 2025

Choose a reason for hiding this comment

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

@SuppressWarnings can not be applied to a an expression - it needs a (variable/method/class) declaration

@dfuch dfuch changed the title 8353642: Deprecate networking permission classes for removal 8353642: Deprecate URL::getPermission method and networking permission classes for removal Apr 11, 2025
@dfuch
Copy link
Member Author

dfuch commented Apr 11, 2025

The GHA failure (Windows) appears to be related.

Should be fixed now

Copy link
Member

@Michael-Mc-Mahon Michael-Mc-Mahon left a comment

Choose a reason for hiding this comment

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

Looks fine to me.

Copy link
Member

@djelinski djelinski left a comment

Choose a reason for hiding this comment

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

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csr Pull request needs approved CSR before integration net net-dev@openjdk.org nio nio-dev@openjdk.org rfr Pull request is ready for review security security-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

4 participants