It is possible to add a file to a 7z archive from data read on stdin (standard input) using the -si option.
However if the 7z archive is password protected the user has to provide the password on the command-line such as -pPassword which is visible to procfs. This can be demonstrated:
$ 7z -pfoo -sibar a test.7z
# Then, in a new terminal:
$ pgrep -af 7z
2101381 /usr/lib/7zip/7z -pfoo -sibar a hmm.7z
# ^~~ visible password.
See also: #33
If 7z could read the password from a different fd (file descriptor) with a theoretical flag like -pfd[N] it would be possible to avoid this problem, e.g.:
data-from-stdin | 7z -pfd9 9< <(printf %s "$passphrase") -sinew/file a test.7z