{"record":{"id":"98b55a4837f5ea41","repo":"Konloch/bytecode-viewer","slug":"bcv-is-awesome-blocking-port","errorCode":null,"errorMessage":"BCV is awesome, blocking port ","messagePattern":"BCV is awesome, blocking port ","errorType":"exception","errorClass":"SecurityException","httpStatus":null,"severity":"error","filePath":"src/main/java/the/bytecode/club/bytecodeviewer/util/SecurityMan.java","lineNumber":198,"sourceCode":"        return fullyQualifiedClassName.equals(KrakatauDecompiler.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(KrakatauDisassembler.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(CFRDecompiler.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(ProcyonDecompiler.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(FernFlowerDecompiler.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(JDGUIDecompiler.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(KrakatauAssembler.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(ExternalResources.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(Enjarify.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(APKTool.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(BytecodeViewer.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(Constants.class.getCanonicalName())\n            || fullyQualifiedClassName.equals(JavaCompiler.class.getCanonicalName());\n    }\n\n    @Override\n    public void checkListen(int port)\n    {\n        throw new SecurityException(\"BCV is awesome, blocking port \" + port + \" from listening\");\n    }\n\n    @Override\n    public void checkPermission(Permission perm)\n    { //expand eventually\n    }\n\n    @Override\n    public void checkPermission(Permission perm, Object context)\n    {//expand eventually\n    }\n\n    @Override\n    public void checkAccess(Thread t)\n    {\n    }\n\n    @Override","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/Konloch/bytecode-viewer/blob/31430e0033fa220db566b5ef461256727ff6793b/src/main/java/the/bytecode/club/bytecodeviewer/util/SecurityMan.java#L180-L216","documentation":"SecurityMan.checkListen unconditionally throws SecurityException for any port binding attempt while BCV's SecurityManager is installed. BCV intentionally forbids analyzed or plugin code from opening listening sockets on the host. Any ServerSocket/socket listen call under the sandbox therefore fails immediately.","triggerScenarios":"Plugin or analyzed/decompiled code constructs a ServerSocket or otherwise calls listen on a port while BCV's SecurityManager is active.","commonSituations":"Plugins starting embedded servers (HTTP, debug agents); analyzed libraries that open server sockets during static analysis execution; test harnesses attempting local port binds inside the sandbox.","solutions":["Refactor the plugin/library so it does not open listening sockets during analysis","Run the server outside BCV's sandboxed execution path","If legitimately needed, modify BCV's SecurityMan (canClassExecute-style whitelist) in a local build — stock BCV blocks all listens","Use client-side (connect) communication where policy allows instead of listening sockets"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// no portable pre-check exists; assume all listens are blocked under BCV\nboolean listenBlockedUnderBCV = true;","typeGuard":null,"tryCatchPattern":"try (ServerSocket ss = new ServerSocket(port)) {\n    // serve\n} catch (SecurityException e) {\n    if (e.getMessage().startsWith(\"BCV is awesome, blocking port\")) {\n        // run server outside BCV or disable network feature\n    } else throw e;\n}","preventionTips":["Avoid server sockets in plugins/analyzed code entirely","Use BCV-approved IPC instead of listening ports","Defer network servers to standalone execution outside the sandbox","Expect unconditional blocking: stock SecurityMan allows no listens"],"tags":["java","security","securitymanager","network","socket"],"backgroundTag":"listen-blocked-by-securitymanager","analyzedSha":"31430e0033fa220db566b5ef461256727ff6793b","analyzedAt":"2026-09-05T18:22:22.725Z","contentChangedAt":"2026-09-05T18:22:22.725Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}