tada / pljava

PL/Java is a free add-on module that brings Java™ Stored Procedures, Triggers, Functions, Aggregates, Operators, Types, etc., to the PostgreSQL™ backend.
http://tada.github.io/pljava/
Other
238 stars 77 forks source link

Access Denied - java.io.FilePermission #417

Closed SreevidyaAravind1989 closed 3 months ago

SreevidyaAravind1989 commented 1 year ago

Issue exists while trying to call a DB function that calls a java function by reading the file name. Getting the Following error. SQL Error [42501]: ERROR: java.sql.SQLSyntaxErrorException: access denied ("java.io.FilePermission" "/path/fileName.txt" "read")

pljava version used: 2-SNAPSHOT java version :11.0.17 postgres version:13

Added the following to pljava.policy file

grant principal org.postgresql.pljava.PLPrincipal$Sandboxed "java" { };

grant principal org.postgresql.pljava.PLPrincipal$Unsandboxed "javaU" { permission java.io.FilePermission "<>", "read,readlink,write,delete"; }; grant codebase "sqlj:testapp" { permission java.util.PropertyPermission "user.timezone", "write"; }; grant { permission java.util.PropertyPermission "sqlj.defaultconnection", "read"; }; grant { permission java.security.AllPermission; };

jcflack commented 1 year ago

Would you be able to attach the log output from executing your DB function with PL/Java's TrialPolicy enabled, as described here?

jcflack commented 3 months ago

Closed waiting on reporter