{"id":2147,"date":"2026-06-18T15:48:57","date_gmt":"2026-06-18T13:48:57","guid":{"rendered":"https:\/\/www.loicmathieu.fr\/wordpress\/fr\/?p=2147"},"modified":"2026-06-18T17:11:40","modified_gmt":"2026-06-18T15:11:40","slug":"replacing-javas-securitymanager-with-an-agent-using-byte-buddy","status":"publish","type":"post","link":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/","title":{"rendered":"Replacing Java&#8217;s SecurityManager with an agent using Byte Buddy"},"content":{"rendered":"<p>Java&#8217;s <code>SecurityManager<\/code> was an essential component of the Java security model. It allowed developers to enforce security rules by implementing <code>check*()<\/code> methods, such as <code>checkExec(String cmd)<\/code> for executing a command on the host machine or <code>checkRead(String file)<\/code> for reading a file. For more details, see the <a href=\"https:\/\/docs.oracle.com\/en\/java\/javase\/21\/docs\/api\/java.base\/java\/lang\/SecurityManager.html\">JavaDoc<\/a>.<\/p>\n<p>It was deprecated in Java 17 (<a href=\"https:\/\/openjdk.org\/jeps\/411\">JEP 411<\/a>) and removed in Java 24 (<a href=\"https:\/\/openjdk.org\/jeps\/486\">JEP 486<\/a>).<\/p>\n<p>Within <a href=\"https:\/\/kestra.io\">Kestra<\/a>, the universal orchestration platform, we used it to:<\/p>\n<ul>\n<li>Restrict access to the host machine&#8217;s file system (allow\/deny list).<\/li>\n<li>Prevent a command from being executed on the host machine.<\/li>\n<li>Prevent a thread from starting.<\/li>\n<li>Prevent for exiting the JVM.<\/li>\n<\/ul>\n<p>Kestra has an extensible plugin system; since each plugin can execute untrusted code, providing advanced security is essential in critical runtime environments.<\/p>\n<p>Following the removal of the <code>SecurityManager<\/code>, we replaced it with a <a href=\"https:\/\/bytebuddy.net\">Byte Buddy<\/a> agent: the same rules, implemented differently.<\/p>\n<p>Here, I&#8217;ll use file access restrictions as the sole example, but the same technique has been used for other security rules.<\/p>\n<p>Byte Buddy is an open-source library that allows you to create or modify classes at runtime. It offers a high-level, declarative API that does not require knowledge of Java bytecode. It is used by many popular frameworks, such as Hibernate, Mockito, OpenTelemetry, &#8230;<\/p>\n<p>Here is a <em>by-the-book<\/em> example of a Byte Buddy agent for intercepting file access via a <code>RandomAccessFile<\/code>.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\nstatic void main() {\n    Instrumentation instrumentation = ByteBuddyAgent.install(); \/\/ &lt;1&gt;\n\n    new AgentBuilder.Default() \/\/ &lt;2&gt;\n        .with(new AgentBuilder.Listener.WithErrorsOnly(AgentBuilder.Listener.StreamWriting.toSystemError())) \/\/ &lt;3&gt;\n        .type(ElementMatchers.is(RandomAccessFile.class)) \/\/ &lt;4&gt;\n        .transform((builder, _, _, _, _) -&gt;\n                builder.method(\n                    ElementMatchers.isMethod().and(ElementMatchers.named(&quot;open&quot;)) \/\/ &lt;5&gt;\n                        .and(ElementMatchers.takesArguments(String.class, int.class))\n                        .and(ElementMatchers.returns(void.class))\n                        .and(ElementMatchers.isPrivate())\n                    )\n                    .intercept(MethodDelegation.to(FileInterceptor.class)) \/\/ &lt;6&gt;\n            )\n            .installOn(instrumentation); \/\/ &lt;7&gt;\n}\n\npublic static class FileInterceptor { \/\/ &lt;8&gt;\n    public static void open(String path, int mode) {\n        throw new RuntimeException(&quot;You shall not pass&quot;);\n    }\n}\n<\/pre>\n<ol><li>Install the Byte Buddy agent , it\u2019s a kind of <em>meta agent<\/em> (my term) that makes it easy to install your own agent. It returns an instance of <code>Instrumentation<\/code>.<\/li>\n<li>To create our agent, we\u2019ll use Byte Buddy\u2019s <code>AgentBuilder<\/code>, which offers a fluid API that allows you to chain transformations.<\/li>\n<li>Log errors to stderr.<\/li>\n<li>Target the <code>RandomAccessFile<\/code> class. <code>ElementMatchers<\/code> is one of Byte Buddy\u2019s core classes, allowing you to target elements of your application code such as a class, a method, a field, etc.<\/li>\n<li>Target the method named <code>open<\/code>, which takes a <code>String<\/code> and an <code>int<\/code> as arguments, returns nothing, and is private. This is the method in the <code>RandomAccessFile<\/code> class that is called every time a file is opened.<\/li>\n<li>Delegates the implementation of this method to the <code>FileInterceptor<\/code> class: this is one form of transformation, where the transformed method is replaced by another.<\/li>\n<li>Installs the agent in the application.<\/li>\n<li>A static class containing a static method whose signature matches the intercepted method: this method will be called instead of the corresponding method in the <code>RandomAccessFile<\/code> class.<\/li>\n<\/ol>\n<p>Unfortunately, this <em>by-the-book<\/em> example does not work for internal JDK classes loaded when the application starts, that is, via the <strong>Bootstrap<\/strong> class loader. For these classes, you must specifically configure the agent and use an <code>Advice<\/code> rather than method delegation.<\/p>\n<p>Byte Buddy <code>Advice<\/code>, although not mentioned in the documentation, is more powerful and flexible than method delegation; it incorporates the principles of aspect-oriented programming (AOP) by allowing you to define a method that is called before or after the target method is called.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\nstatic void main() {\n    Instrumentation instrumentation = ByteBuddyAgent.install();\n\n    new AgentBuilder.Default()\n        .ignore(ElementMatchers.none()) \/\/ &lt;1&gt;\n        .with(AgentBuilder.RedefinitionStrategy.REDEFINITION) \/\/ &lt;2&gt;\n        .with(new AgentBuilder.Listener.WithErrorsOnly(AgentBuilder.Listener.StreamWriting.toSystemError()))\n        .type(ElementMatchers.is(RandomAccessFile.class))\n        .transform((builder, _, _, _, _) -&gt;\n                builder.visit( \/\/ &lt;3&gt;\n                    Advice.to(FileInterceptor.class).on(\n                    ElementMatchers.isMethod().and(ElementMatchers.named(&quot;open&quot;))\n                            .and(ElementMatchers.takesArguments(String.class, int.class))\n                            .and(ElementMatchers.returns(void.class))\n                            .and(ElementMatchers.isPrivate())\n                    ))\n            )\n            .installOn(instrumentation);\n}\n\npublic static class FileInterceptor { \/\/ &lt;4&gt;\n    @Advice.OnMethodEnter\n    public static void openEnter(String path, int mode) {\n        IO.println(&quot;Try to access file: &quot; + path);\n    }\n\n     @Advice.OnMethodExit\n    public static void openExit(String path, int mode) {\n        throw new RuntimeException(&quot;You shall not pass&quot;);\n    }\n}\n<\/pre>\n<ol><li>By default, JDK classes are ignored; you must configure the agent to ignore no classes.<\/li>\n<li>By default, classes that have already been loaded are not re-transformed; you must configure the agent to re-transform already-loaded classes via redefinition.<\/li>\n<li>Instead of transforming a method, the method is visited with an advice.<\/li>\n<li>An advice is defined using methods annotated with <code>@Advice.OnMethodEnter<\/code>, which is executed before entering the target method, and\/or <code>@Advice.OnMethodExit<\/code>, which is executed after exiting the method.<\/li>\n<\/ol>\n<p>There you have it, now you know all the secrets of transforming the JVM\u2019s internal classes!<\/p>","protected":false},"excerpt":{"rendered":"<p>Java&#8217;s SecurityManager was an essential component of the Java security model. It allowed developers to enforce security rules by implementing check*() methods, such as checkExec(String cmd) for executing a command on the host machine or checkRead(String file) for reading a file. For more details, see the JavaDoc. It was deprecated in Java 17 (JEP 411) and removed in Java 24 (JEP 486). Within Kestra, the universal orchestration platform, we used it to: Restrict access to the host machine&#8217;s file system&#8230;<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p><\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"federated","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[9],"tags":[235,234,11,214],"class_list":["post-2147","post","type-post","status-publish","format-standard","hentry","category-informatique","tag-agent","tag-bytebuddy","tag-java","tag-security"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"Java&#039;s SecurityManager was an essential component of the Java security model. It allowed developers to enforce security rules by implementing check*() methods, such as checkExec(String cmd) for executing a command on the host machine or checkRead(String file) for reading a file. For more details, see the JavaDoc. It was deprecated in Java 17 (JEP 411)\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"admin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Loic&#039;s Blog | Blog about IT developement, and some more stuff (travel, ecology, ...)\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Replacing Java\u2019s SecurityManager with an agent using Byte Buddy | Loic&#039;s Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Java&#039;s SecurityManager was an essential component of the Java security model. It allowed developers to enforce security rules by implementing check*() methods, such as checkExec(String cmd) for executing a command on the host machine or checkRead(String file) for reading a file. For more details, see the JavaDoc. It was deprecated in Java 17 (JEP 411)\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-06-18T13:48:57+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-06-18T15:11:40+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Replacing Java\u2019s SecurityManager with an agent using Byte Buddy | Loic&#039;s Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Java&#039;s SecurityManager was an essential component of the Java security model. It allowed developers to enforce security rules by implementing check*() methods, such as checkExec(String cmd) for executing a command on the host machine or checkRead(String file) for reading a file. For more details, see the JavaDoc. It was deprecated in Java 17 (JEP 411)\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/informatique\\\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\\\/#article\",\"name\":\"Replacing Java\\u2019s SecurityManager with an agent using Byte Buddy | Loic's Blog\",\"headline\":\"Replacing Java&#8217;s SecurityManager with an agent using Byte Buddy\",\"author\":{\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/#organization\"},\"datePublished\":\"2026-06-18T15:48:57+02:00\",\"dateModified\":\"2026-06-18T17:11:40+02:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/informatique\\\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/informatique\\\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\\\/#webpage\"},\"articleSection\":\"informatique, agent, bytebuddy, java, security\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/informatique\\\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/category\\\/informatique\\\/#listItem\",\"name\":\"informatique\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/category\\\/informatique\\\/#listItem\",\"position\":2,\"name\":\"informatique\",\"item\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/category\\\/informatique\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/informatique\\\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\\\/#listItem\",\"name\":\"Replacing Java&#8217;s SecurityManager with an agent using Byte Buddy\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/informatique\\\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\\\/#listItem\",\"position\":3,\"name\":\"Replacing Java&#8217;s SecurityManager with an agent using Byte Buddy\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/category\\\/informatique\\\/#listItem\",\"name\":\"informatique\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/#organization\",\"name\":\"Loic's Blog\",\"description\":\"Blog about IT developement, and some more stuff (travel, ecology, ...)\",\"url\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/author\\\/admin\\\/\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/informatique\\\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2b39eb909797d1241a4191e41489c1fbe0b3d68daf31e77779b61ce2f4422b52?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"admin\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/informatique\\\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\\\/#webpage\",\"url\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/informatique\\\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\\\/\",\"name\":\"Replacing Java\\u2019s SecurityManager with an agent using Byte Buddy | Loic's Blog\",\"description\":\"Java's SecurityManager was an essential component of the Java security model. It allowed developers to enforce security rules by implementing check*() methods, such as checkExec(String cmd) for executing a command on the host machine or checkRead(String file) for reading a file. For more details, see the JavaDoc. It was deprecated in Java 17 (JEP 411)\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/informatique\\\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/author\\\/admin\\\/#author\"},\"datePublished\":\"2026-06-18T15:48:57+02:00\",\"dateModified\":\"2026-06-18T17:11:40+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/\",\"name\":\"Loic's Blog\",\"description\":\"Blog about IT developement, and some more stuff (travel, ecology, ...)\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.loicmathieu.fr\\\/wordpress\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Replacing Java\u2019s SecurityManager with an agent using Byte Buddy | Loic's Blog","description":"Java's SecurityManager was an essential component of the Java security model. It allowed developers to enforce security rules by implementing check*() methods, such as checkExec(String cmd) for executing a command on the host machine or checkRead(String file) for reading a file. For more details, see the JavaDoc. It was deprecated in Java 17 (JEP 411)","canonical_url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/#article","name":"Replacing Java\u2019s SecurityManager with an agent using Byte Buddy | Loic's Blog","headline":"Replacing Java&#8217;s SecurityManager with an agent using Byte Buddy","author":{"@id":"https:\/\/www.loicmathieu.fr\/wordpress\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/www.loicmathieu.fr\/wordpress\/#organization"},"datePublished":"2026-06-18T15:48:57+02:00","dateModified":"2026-06-18T17:11:40+02:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/#webpage"},"isPartOf":{"@id":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/#webpage"},"articleSection":"informatique, agent, bytebuddy, java, security"},{"@type":"BreadcrumbList","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.loicmathieu.fr\/wordpress#listItem","position":1,"name":"Home","item":"https:\/\/www.loicmathieu.fr\/wordpress","nextItem":{"@type":"ListItem","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/#listItem","name":"informatique"}},{"@type":"ListItem","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/#listItem","position":2,"name":"informatique","item":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/#listItem","name":"Replacing Java&#8217;s SecurityManager with an agent using Byte Buddy"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.loicmathieu.fr\/wordpress#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/#listItem","position":3,"name":"Replacing Java&#8217;s SecurityManager with an agent using Byte Buddy","previousItem":{"@type":"ListItem","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/#listItem","name":"informatique"}}]},{"@type":"Organization","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/#organization","name":"Loic's Blog","description":"Blog about IT developement, and some more stuff (travel, ecology, ...)","url":"https:\/\/www.loicmathieu.fr\/wordpress\/"},{"@type":"Person","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/author\/admin\/#author","url":"https:\/\/www.loicmathieu.fr\/wordpress\/author\/admin\/","name":"admin","image":{"@type":"ImageObject","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/2b39eb909797d1241a4191e41489c1fbe0b3d68daf31e77779b61ce2f4422b52?s=96&d=mm&r=g","width":96,"height":96,"caption":"admin"}},{"@type":"WebPage","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/#webpage","url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/","name":"Replacing Java\u2019s SecurityManager with an agent using Byte Buddy | Loic's Blog","description":"Java's SecurityManager was an essential component of the Java security model. It allowed developers to enforce security rules by implementing check*() methods, such as checkExec(String cmd) for executing a command on the host machine or checkRead(String file) for reading a file. For more details, see the JavaDoc. It was deprecated in Java 17 (JEP 411)","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.loicmathieu.fr\/wordpress\/#website"},"breadcrumb":{"@id":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/#breadcrumblist"},"author":{"@id":"https:\/\/www.loicmathieu.fr\/wordpress\/author\/admin\/#author"},"creator":{"@id":"https:\/\/www.loicmathieu.fr\/wordpress\/author\/admin\/#author"},"datePublished":"2026-06-18T15:48:57+02:00","dateModified":"2026-06-18T17:11:40+02:00"},{"@type":"WebSite","@id":"https:\/\/www.loicmathieu.fr\/wordpress\/#website","url":"https:\/\/www.loicmathieu.fr\/wordpress\/","name":"Loic's Blog","description":"Blog about IT developement, and some more stuff (travel, ecology, ...)","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.loicmathieu.fr\/wordpress\/#organization"}}]},"og:locale":"en_US","og:site_name":"Loic's Blog | Blog about IT developement, and some more stuff (travel, ecology, ...)","og:type":"article","og:title":"Replacing Java\u2019s SecurityManager with an agent using Byte Buddy | Loic's Blog","og:description":"Java's SecurityManager was an essential component of the Java security model. It allowed developers to enforce security rules by implementing check*() methods, such as checkExec(String cmd) for executing a command on the host machine or checkRead(String file) for reading a file. For more details, see the JavaDoc. It was deprecated in Java 17 (JEP 411)","og:url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/","article:published_time":"2026-06-18T13:48:57+00:00","article:modified_time":"2026-06-18T15:11:40+00:00","twitter:card":"summary","twitter:title":"Replacing Java\u2019s SecurityManager with an agent using Byte Buddy | Loic's Blog","twitter:description":"Java's SecurityManager was an essential component of the Java security model. It allowed developers to enforce security rules by implementing check*() methods, such as checkExec(String cmd) for executing a command on the host machine or checkRead(String file) for reading a file. For more details, see the JavaDoc. It was deprecated in Java 17 (JEP 411)"},"aioseo_meta_data":{"post_id":"2147","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":[],"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"created":"2026-06-17 10:15:38","updated":"2026-06-18 16:02:28","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.loicmathieu.fr\/wordpress\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/\" title=\"informatique\">informatique<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tReplacing Java\u2019s SecurityManager with an agent using Byte Buddy\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.loicmathieu.fr\/wordpress"},{"label":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},{"label":"Replacing Java&#8217;s SecurityManager with an agent using Byte Buddy","link":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/replacing-javas-securitymanager-with-an-agent-using-byte-buddy\/"}],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1839,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/java-vers-une-integrite-par-defaut-de-la-jvm\/","url_meta":{"origin":2147,"position":0},"title":"Java: towards JVM integrity by default","author":"admin","date":"Tuesday February  4th, 2025","format":false,"excerpt":"This article first appeared in Programmez! Hors s\u00e9rie #16 (in french only). The Java Virtual Machine (JVM) is an execution environment that enables programs written in Java (or other languages compiled into Java bytecode) to run on different operating systems and hardware architectures. From the begining, the JVM was designed\u2026","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":739,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/les-optimisations-de-performances-de-java-9\/","url_meta":{"origin":2147,"position":1},"title":"Java 9 performance optimizations","author":"admin","date":"Friday January 26th, 2018","format":false,"excerpt":"In a previous article on Java 9, I listed all the main new features for the developers : http:\/\/www.loicmathieu.fr\/wordpress\/en\/informatique\/les-nouveautes-de-java-9-pour-les-developeurs. Here, I will list all the main performance optimizations of Java 9. I will again go through the main JEP : JEP 143: Improve Contended Locking Optimization of Java monitors (lock\u2026","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1877,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/java-24-whats-new\/","url_meta":{"origin":2147,"position":2},"title":"Java 24 : what&#8217;s new?","author":"admin","date":"Friday January 10th, 2025","format":false,"excerpt":"Now that Java 24 is features complete (Rampdown Phase One at the day of writing), it\u2019s time to walk through all the functionalities that bring to us, developers, this new version. This article is part of a series on what\u2019s new on the last versions of Java, for those who\u2026","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1284,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/java-17-quoi-de-neuf\/","url_meta":{"origin":2147,"position":3},"title":"Java 17 : what&#8217;s new ?","author":"admin","date":"Thursday August  5th, 2021","format":false,"excerpt":"Now that Java 17 is features complete (Rampdown Phase Two at the day of writing), it\u2019s time to walk throught all the functionalities that brings to us, developers, this new version. This article is part of a series on what\u2019s new on the last versions of Java, for those who\u2026","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1375,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/java-18-quoi-de-neuf\/","url_meta":{"origin":2147,"position":4},"title":"Java 18 : what&#8217;s new ?","author":"admin","date":"Tuesday January  4th, 2022","format":false,"excerpt":"Now that Java 18 is features complete (Rampdown Phase One at the day of writing), it\u2019s time to walk throught all the functionalities that brings to us, developers, this new version. This article is part of a series on what\u2019s new on the last versions of Java, for those who\u2026","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1572,"url":"https:\/\/www.loicmathieu.fr\/wordpress\/informatique\/java-20-quoi-de-neuf\/","url_meta":{"origin":2147,"position":5},"title":"Java 20: what&#8217;s new ?","author":"admin","date":"Wednesday December 14th, 2022","format":false,"excerpt":"Now that Java 20 is features complete (Rampdown Phase One at the day of writing), it\u2019s time to walk through all the functionalities that bring to us, developers, this new version. This article is part of a series on what\u2019s new on the last versions of Java, for those who\u2026","rel":"","context":"In &quot;informatique&quot;","block_context":{"text":"informatique","link":"https:\/\/www.loicmathieu.fr\/wordpress\/category\/informatique\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/posts\/2147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/comments?post=2147"}],"version-history":[{"count":9,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/posts\/2147\/revisions"}],"predecessor-version":[{"id":2158,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/posts\/2147\/revisions\/2158"}],"wp:attachment":[{"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/media?parent=2147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/categories?post=2147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.loicmathieu.fr\/wordpress\/wp-json\/wp\/v2\/tags?post=2147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}