Skip to content

Isolate class-injection lookup module opening - #176

Merged
mcculls merged 1 commit into
mainfrom
mcculls/isolate-class-injection-lookup
Nov 25, 2026
Merged

mcculls merged 1 commit into
mainfrom
mcculls/isolate-class-injection-lookup

Conversation

@mcculls

@mcculls mcculls commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What Does This Do

Define the lookup helper in a dedicated class loader with the injector's protection domain, and open java.lang.invoke only to that helper's module. The helper constructs the full-privilege lookup used to define the hidden class-injection glue.

Motivation

Opening java.lang.invoke to the injector's module also grants deep reflection to application code sharing that module. Isolating the helper confines the module opening while preserving the existing transformation fallback.

Additional Notes

Tests cover module isolation, the helper's protection domain, generated bytecode verification and unpacking, and initialization during agent premain under a SecurityManager granting the four required permissions.

Java 24 permanently disabled SecurityManager, so that test is skipped for Java 24+

Contributor Checklist

Jira ticket: not provided.

Generate a narrow lookup helper in a dedicated class loader so opening
'java.lang.invoke' does not grant deep reflection to application code
sharing the injector's module. Define the helper with the injector's
protection domain.

Verify module isolation, generated bytecode, and premain initialization
under a SecurityManager with only the four required permission grants.
@mcculls
mcculls marked this pull request as ready for review November 25, 2026 16:31
@mcculls
mcculls requested a review from a team as a code owner November 25, 2026 16:31
@mcculls
mcculls requested review from amarziali and jandro996 and removed request for a team November 25, 2026 16:31
@mcculls
mcculls merged commit 5eb06e0 into main Nov 25, 2026
8 checks passed
@mcculls
mcculls deleted the mcculls/isolate-class-injection-lookup branch November 25, 2026 16:43
@github-actions github-actions Bot added this to the 0.1.0 milestone Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants