I'm writing a Java program that calls library code that is not mine; and so I am running the program in a SecurityManager with only the minimum required permissions.
There is one particular permission which I only need in the first couple lines of method main()... and then never again.
Is it possible in Java, to reduce the permissions at a certain point in execution?
My understanding (I hope this is right) is Apache httpd does this, first using its root privileges to bind to port 80/443 etc., and then using system call setuid()
(or similar) to assume lesser privileges for the remainder of the program. I would have thought the same would be possible, in principle, in the Java VM.