Skip to content

Commit

Permalink
Avoid storing the class bytes in MemoryClassPathElement ProtectionDomain
Browse files Browse the repository at this point in the history
Related to quarkusio#41417
  • Loading branch information
gsmet committed Jun 25, 2024
1 parent f5bc656 commit 9d8fbdd
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

public class MemoryClassPathElement extends AbstractClassPathElement {

private static final ProtectionDomain NULL_PROTECTION_DOMAIN = new ProtectionDomain(
new CodeSource(null, (Certificate[]) null), null);

private volatile Map<String, byte[]> resources;
private volatile long lastModified = System.currentTimeMillis();
private final boolean runtime;
Expand Down Expand Up @@ -112,14 +115,10 @@ public Set<String> getProvidedResources() {

@Override
public ProtectionDomain getProtectionDomain() {
URL url = null;
try {
url = new URL(null, "quarkus:/", new MemoryUrlStreamHandler("quarkus:/"));
} catch (MalformedURLException e) {
throw new RuntimeException("Unable to create protection domain for memory element", e);
}
CodeSource codesource = new CodeSource(url, (Certificate[]) null);
return new ProtectionDomain(codesource, null);
// we used to include the class bytes in the ProtectionDomain
// but it is not a good idea
// see https://github.com/quarkusio/quarkus/issues/41417 for more details about the problem
return NULL_PROTECTION_DOMAIN;
}

@Override
Expand Down

0 comments on commit 9d8fbdd

Please sign in to comment.