I am a Java developer that is building an app where it needs to call a C# process from within. In my situation, the Java app is calling this C# program https://github.com/nddipiazza/SharepointOnlineCookieFetcher.

This C# program requires a password. It accepts a stdin password (masked using SecureInput) or it can take password as an environment variable.

I am wondering... in this situation... what is more secure and why?

1) Sending the password using the stdin?


2) Set the environment variable SPPWD=thepassword and call the program?


Neither. Both ways of providing the password can be bypassed (rather trivially) in the same way (replacing the target executable with your own or checking the child process state at runtime).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.