Every deployment platform eventually asks for something sensitive.
An SSH private key to reach a server. A database password. An S3 credential for backups. A Git token. An application secret that must become an environment variable inside a container.
The easy security claim would be:
“Everything is encrypted.”
That sentence sounds reassuring, but it leaves out the questions that actually matter:
- Which values can be hashed instead of encrypted?
- Which values must be recovered in plaintext to perform their job?
- Where does the encryption key live?
- Who is allowed to reveal a value?
- Does the reveal leave an audit record?
- Can a secret leak through build arguments or logs?
- What does encryption no longer protect after the panel is compromised?
These questions shaped how I approached secret handling in Nitrobase.
Nitrobase has only recently launched and is still in Beta. I do not consider its existence a substitute for a dedicated secrets manager, host hardening, or a security review. The goal is more practical: understand the different kinds of sensitive data a self-hosted PaaS handles and avoid treating all of them as interchangeable strings in a database.
Start with the operation the system needs
Before choosing between hashing and encryption, I ask what Nitrobase must do with the value later.
Does Nitrobase need the original value again?
│
┌───────┴───────┐
│ │
No Yes
│ │
▼ ▼
Hash Encrypt
Examples make the distinction clearer:
| Sensitive value | Must recover the original? | Storage approach |
|---|---|---|
| User password | No | Password hash |
| API token | No | Token hash; raw token shown once |
| 2FA recovery code | No | Hash; code is one-time |
| SSH private key | Yes | Encrypted |
| SSH passphrase | Yes | Encrypted |
| Backup destination secret | Yes | Encrypted |
| Application environment secret | Yes | Encrypted |
| TOTP seed | Yes | Encrypted |
If Nitrobase only needs to answer “does this submitted value match?”, storing the original would add unnecessary risk.
If Nitrobase must later authenticate to a VPS or generate an application's runtime environment, a one-way hash is not enough. The original value must be recoverable, so encryption is required.
Security begins with not storing what the system does not need.
Recoverable secrets have an unavoidable plaintext moment
Consider an SSH private key.
Nitrobase stores it encrypted in PostgreSQL. When a job connects to the server, the panel must decrypt it and give it to the SSH client in memory.
Encrypted database value
│
▼
Decrypt inside the running panel
│
▼
Use for one SSH operation
│
▼
Do not return it to the browser or job log
The same principle applies to application variables:
Encrypted app environment
│
▼
Render deployment files
│
▼
Transfer to the managed VPS
│
▼
Container receives plaintext at runtime
Encryption at rest protects the stored representation. It cannot keep a value encrypted while software actively uses that value as a password or API key.
This matters for the threat model:
Stolen database dump without ENCRYPTION_KEY → encrypted values protected
Backup archive without ENCRYPTION_KEY → archive unreadable
Read-only user without secret permission → values hidden
Compromised running panel with key access → secrets may be exposed
Root access to the managed application server → runtime secrets may be exposed
The last two lines are why “encrypted at rest” should never be presented as complete protection.
One installation key protects many categories of secret
Nitrobase derives encryption keys from the installation's ENCRYPTION_KEY and uses authenticated encryption for stored credentials.
The encrypted columns include values such as:
- SSH private keys, passwords, and passphrases;
- application and custom Compose environment values;
- database and link credentials;
- backup destination credentials;
- notification channel secrets;
- Git and cloud connection tokens;
- TOTP seeds;
- Cloudflare Tunnel connector tokens.
The operational consequence is simple:
Nitrobase database + ENCRYPTION_KEY = usable control-plane state
Nitrobase database − ENCRYPTION_KEY = encrypted fields cannot be recovered
The installer writes generated secrets to a file with restrictive permissions and tells the administrator to keep a copy outside the machine.
That external copy is not optional recovery documentation. It is part of the cryptographic system.
The key should not live inside the backup it unlocks
Nitrobase self-backups contain the panel database, including encrypted infrastructure credentials. The archive is also encrypted using the installation key.
Putting ENCRYPTION_KEY inside that archive would make the archive self-decrypting. Keeping the only copy beside the panel would create the opposite failure: the backup survives, but nobody can open it after the panel server disappears.
The recovery kit therefore has two separate pieces:
Off-site backup destination
└── nitrobase-backup.tar.gz.enc
Separate password manager / offline record
├── ENCRYPTION_KEY
├── backup destination access
└── recorded SHA-256 checksum
Separation creates inconvenience during recovery, but it prevents the backup from carrying its own decryption capability.
Secret reveal is an action, not a display preference
Masking a password field with dots is not access control. If every authenticated user can click an eye icon, the value is still broadly available.
Nitrobase separates ordinary read access from secret access through team permissions. A viewer can inspect infrastructure state without automatically receiving plaintext credentials.
When an authorized user explicitly reveals a stored secret:
- the UI asks for confirmation;
- the server checks the permission again;
- the plaintext value is returned for that action;
- the reveal is written to the audit log.
“Can view the application”
≠
“Can reveal its credentials”
The audit record does not make disclosure safe, but it changes disclosure from an invisible UI event into an accountable administrative action.
For some secrets, Nitrobase avoids reveal entirely. Build secrets can be added, replaced, or removed, but are not shown again after storage. API tokens and certain generated passwords are displayed once; only a hash or no reusable copy remains afterward.
Build arguments are not a place for secrets
Container builds introduce a different leak path.
A value passed as a normal build argument can become visible in build history, cache metadata, or an image layer depending on how the Dockerfile uses it.
# Poor secret boundary
ARG NPM_TOKEN
RUN npm config set //registry.npmjs.org/:_authToken "$NPM_TOKEN"
Nitrobase separates build arguments from build secrets. Build secrets are passed through BuildKit's secret mount mechanism:
RUN --mount=type=secret,id=NPM_TOKEN \
NPM_TOKEN="$(cat /run/secrets/NPM_TOKEN)" npm install
The intent is that the secret exists for the build step without becoming a build argument or being copied into the final image layer.
This still depends on the Dockerfile behaving correctly. A build step can deliberately print or copy the mounted secret. The platform can provide the safer transport, but it cannot make untrusted build instructions honest.
Logs need a separate defensive layer
Encrypting the database does nothing if the same credential appears in a job error.
Operational commands fail, and external tools often include their arguments, URLs, or response details in stderr. A backup client may print an endpoint containing credentials. An SSH error may contain connection details. A webhook failure may echo part of its request configuration.
Nitrobase treats likely secret-bearing fields as sensitive when creating audit metadata and error output. Services that execute commands also redact known destination and credential values before job errors are persisted or displayed.
But log redaction has an important limitation:
It is a last defensive layer, not proof that arbitrary output contains no secret.
An application can print its own environment. A custom script can echo a token. A malformed third-party error can expose a value in an unexpected format.
The safer pattern is:
Do not put the secret in command-line text when avoidable
↓
Use files, stdin, environment, or dedicated secret mounts
↓
Redact known values from captured output
↓
Restrict who can read job logs
Each layer assumes the previous one can fail.
Authentication protects the door to secret operations
Secret storage does not help if an attacker can simply sign in as an administrator.
Nitrobase includes:
- password authentication;
- optional TOTP two-factor authentication;
- one-time hashed recovery codes;
- persistent rate-limit state for sign-in and 2FA attempts;
- team roles and scoped permissions;
- expiring API tokens with explicit scopes;
- audit records for administrative actions.
These controls reduce common account-level risks, but they do not replace putting the panel behind HTTPS, restricting network exposure, maintaining the host, and protecting administrator email accounts.
The control plane is valuable precisely because it holds access to other systems. It should be treated as privileged infrastructure, not as an ordinary dashboard.
Key rotation is a migration, not a string replacement
Changing ENCRYPTION_KEY in an environment file without migrating existing ciphertext makes stored secrets unreadable.
A safe rotation needs to:
- stop operations that might write new secrets;
- decrypt every encrypted field using the current key;
- encrypt it again with the new key;
- update the installation configuration;
- retain access to previous keys while old backups still exist.
current database secrets K1 ── migrate ──► K2
old application backups K1 ──────────────► keep K1 available
new application backups K2
The database migration may be complete while the backup lifecycle is not. Deleting the old key too early can invalidate recovery points still inside their retention window.
Nitrobase supports previous keys for this reason. An old key should remain available until every archive created with it has expired or been replaced.
What this security model does not protect against
It is useful to state the boundaries plainly.
Encryption at rest does not protect secrets when:
- the running panel process is compromised and can access the key;
- an attacker obtains root on the panel host;
- an attacker obtains root on a managed VPS and reads runtime configuration;
- an application deliberately logs its own secret;
- an authorized administrator reveals and copies a credential;
- a malicious image misuses the environment provided to it.
Nitrobase is a system that must use infrastructure credentials. It is not a zero-knowledge service in which the server can operate without ever accessing plaintext.
The security objective is therefore layered:
Minimize what is stored
↓
Hash values that need only verification
↓
Encrypt values that must be recovered
↓
Restrict and audit plaintext access
↓
Reduce exposure during build and execution
↓
Make key loss and compromise part of recovery planning
My secret-handling checklist
- [ ] Does the system need to recover this value, or can it store only a hash?
- [ ] Is the secret encrypted before it reaches persistent storage?
- [ ] Is its encryption key stored outside the database and backups?
- [ ] Can read-only users see or reveal it?
- [ ] Is an explicit reveal recorded in the audit log?
- [ ] Can the value appear in a command line, build layer, or job log?
- [ ] Is the runtime destination trusted to receive the plaintext?
- [ ] Can the key be rotated without invalidating retained backups?
- [ ] Has recovery been tested with only the backup and external recovery kit?
The checklist is more useful to me than the statement “we encrypt secrets,” because it follows the value through its whole lifecycle.
The problem this work is trying to solve
A self-hosted PaaS sits between people and infrastructure. To reduce repetitive work, it receives credentials powerful enough to deploy applications, access servers, restore databases, and modify routing.
Pretending those values never become plaintext would be misleading. Leaving them unprotected because the panel needs them would be irresponsible.
Nitrobase tries to occupy the practical space between those extremes: hash what does not need recovery, encrypt what does, make plaintext access deliberate, reduce accidental exposure, and document where the protection ends.
It is still Beta, and security-sensitive behavior needs scrutiny from environments and threat models beyond my own. Feedback on the key hierarchy, secret-reveal model, log redaction, and recovery process is especially valuable.
The principle I want to preserve is simple:
A secret is not secure merely because its database column is encrypted. Its entire journey matters.
Nitrobase source code: https://github.com/AydenGroup/nitrobase
Top comments (0)