Skip to content

Commit

Permalink
Allow PL/Java's class loader to make magic URLs
Browse files Browse the repository at this point in the history
PL/Java's class loader has historically handled resource lookups
by returning a URL that has a custom URLStreamHandler wired in.
Permission to do that wasn't included in the pljava.policy shipped
with 1.6.0. Fix that. Addresses #322.

Still does not get closer to fixing #266, but at least avoids
making it worse.
  • Loading branch information
jcflack committed Oct 26, 2020
1 parent 841bef5 commit bb88d82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pljava-packaging/src/main/resources/pljava.policy
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ grant codebase "${org.postgresql.pljava.codesource}" {
"charsetProvider";
permission java.lang.RuntimePermission
"createClassLoader";
permission java.net.NetPermission
"specifyStreamHandler";
permission java.util.logging.LoggingPermission
"control";
permission java.security.SecurityPermission
Expand Down
4 changes: 2 additions & 2 deletions pljava/src/main/java/org/postgresql/pljava/sqlj/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,12 @@ private static URL entryURL(int entryId)
{
try
{
return new URL(
return doPrivileged(() -> new URL(
"dbf",
"localhost",
-1,
"/" + entryId,
EntryStreamHandler.getInstance());
EntryStreamHandler.getInstance()));
}
catch(MalformedURLException e)
{
Expand Down

0 comments on commit bb88d82

Please sign in to comment.