Security checklist
Check each item before the server handles its first request. Each line links to the page that explains it.
The configuration
Section titled “The configuration”[mode] defaultis"production". Development mode serves static files and every.nvsfile by its path. Configurationnvs config checkreports no error. Configuration- You know what server work may do with no
nvs.toml. It reads its app folder and connects to any public host. Configuration readandconnectlist only the folders and hosts the program uses. Configuration- Secrets are outside the app folder, or in files whose names start with
.. Server work cannot read those files by default. Configuration - A package gets only the capabilities in its own line. Each line lists only what that package uses. Configuration
- No password is in
nvs.toml. Each one is read withpassword_file. Reference: secrets from files [limits]setsmemoryandwall_time, and[limits.hard]sets a maximum. Limits and logs- You know what closes a WebSocket or an event stream.
wall_timedoes not close it.[server.connection] max_lifetimedoes, after one day by default. Limits and logs
The files
Section titled “The files”- Only an administrator can change the configuration files. The server does not start when another account can write to them. Install on a server
- The account that runs the server cannot change your code.
[log] targetis a file orsyslog, and somebody reads it. Limits and logs
The network
Section titled “The network”nvs servelistens on127.0.0.1or a Unix socket. A reverse proxy handles TLS. Behind a reverse proxytrusted_proxieshas the address of your proxy, and nothing more. Behind a reverse proxy- The proxy limits the requests and connections of each client address, and the login attempts. It closes the requests for unknown host names. Behind a reverse proxy
- The service runs as its own account, not as root or the system account. Run as a service
The code
Section titled “The code”- Text from a request stays
tainteduntil a check removes it. Tainted input - HTML is built with
htmltemplates, so every value is escaped. - An error response does not show the message of an unexpected error. Errors
nvs testpasses in your build before each deploy. Testing your app
