Skip to content

Harden private key handling, owner only file and no stdout or log exposure - #71

Open
quantova-inc wants to merge 2 commits into
hsbc:mainfrom
quantova-inc:harden-private-key-file-permissions
Open

quantova-inc wants to merge 2 commits into
hsbc:mainfrom
quantova-inc:harden-private-key-file-permissions

Conversation

@quantova-inc

@quantova-inc quantova-inc commented Nov 2, 2026 •

Copy link
Copy Markdown

This hardens how the generated RSA private key is handled. There are two changes.

First the private key file is created with owner only permissions. The previous plain open call used the process default which on a typical system is world readable or group readable. It now creates the file with mode 0600 using os.open so there is no window where it is world readable and it calls os.chmod to enforce 0600 when the file already exists.

Second the private key is no longer written to stdout or to the debug log. The tool printed the full private key to the console and emitted it to the logger at debug which places the key in terminal history and log files. It now prints and logs only the public key and reports the path where the private key was written. The public key handling is unchanged.

I verified the file is created at 0600 on a POSIX system and that the private key no longer appears in stdout or the log. I am happy to adjust for any Windows path you support.

For any follow up I can be reached at partnerships@Quantova.org.

@quantova-inc quantova-inc changed the title Harden the generated private key with owner only file permissions Harden private key handling, owner only file and no stdout or log exposure Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant