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

Avoid storing the class bytes in MemoryClassPathElement ProtectionDomain #41419

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading