Uses Byte Buddy to override the behavior of System.setSecurityManager
.
NOTE: This is a demo, not a real security implementation. For example, System.getSecurityManager
isn't intercepted!
mvn clean compile package
A little awkward. You can use the attached run.sh
script.
java -javaagent:agent/target/securityfixer-agent-2.0-SNAPSHOT.jar \
-jar example/target/securityfixer-example-2.0-SNAPSHOT.jar
I have this working with Byte Buddy 1.9.0 after some futzing with @Advice
using the generated bootstrap approach, but the static security manager must be public.
For the purposes of the demo I'm not worried about it.