Repository navigation
NTNT v0.6.3 — Security fixes and verified TLS for PostgreSQL and Redis
NTNT v0.6.3 — Security fixes and verified TLS for PostgreSQL and Redis
NTNT 0.6.3 is a security release. It fixes the findings of a security scan of the
runtime, standard library and installers, adds verified TLS for runtime PostgreSQL
and Redis connections, and updates the SMTP client behind std/email for six
advisories. Several fixes change behaviour, so read the upgrade checklist before
deploying.
This announcement describes the changes since the last published release,
v0.6.2.
Authentication rules cover every handler they name
- Handlers under the auth prefix.
require_auth()and protected-path rules now
apply to application handlers registered under the auth route prefix (/authby
default). Before, everything under the prefix was public, so a custom
/auth/profileroute ran without a session. Only std/auth's own handlers there
stay public: the login page, provider start and callback, logout, health and
auth_me. - The path the router serves. Auth now matches requests the way the router
does, so//admin,/admin//settingsand/admin/hit the rules for/admin
instead of bypassing them. Protection patterns androute_prefixare stored in
the same canonical form, and redirects built from the request path use it too: a
request for//evil.example/xcan no longer produce a protocol-relative
Location. - Workers starting or reloading. Protection rules no longer disappear while
other workers start, restart or reload. Each worker re-runs the application's
setup, and itsenable_auth()used to clear the shared rules while worker 0 was
already serving, so a path protected only by a rule was briefly public. While a
server is serving,enable_auth()now adds rules instead of replacing them.
Application code cannot change the runtime's security policy
The process-execution policy (NTNT_PROCESS_ENABLE, NTNT_PROCESS_ALLOW) and the
fetch() network policy (NTNT_SSRF_PROTECTION, NTNT_ALLOW_LOCALHOST,
NTNT_ALLOW_PRIVATE_IPS, NTNT_BLOCKED_HOSTS) are read once, from the environment
that starts ntnt, before any application code runs. load_env skips those keys,
NTNT_NET_ALLOW_PRIVATE, NTNT_NETMON_ENABLE and every NTNT_SECRETS_* key,
printing one warning per key and loading the rest of the file. Loading
NTNT_ENV=development can no longer lift a production host's localhost block;
loading NTNT_ENV=production still adds it. Other production protections follow
the NTNT_ENV that load_env sets; see Deploying with .env files below.
Cloud metadata endpoints stay blocked
fetch(), download(), cache_fetch() and probe_fetch() compare hosts in
canonical form (case, trailing dots, and IP literals in any notation), so spellings
such as metadata.google.internal. or [::ffff:169.254.169.254] are blocked.
Metadata addresses returned by DNS are denied on every request and redirect hop,
even with NTNT_ALLOW_PRIVATE_IPS or NTNT_ALLOW_LOCALHOST set; only
NTNT_SSRF_PROTECTION=false in the host environment turns the check off.
NTNT_BLOCKED_HOSTS entries are canonicalized the same way, and an IP entry also
blocks names that resolve to it.
Safe Markdown drops unsafe links
to_html_safe() renders a link whose scheme is not http, https or mailto as
its plain text, omits an image with such a source (keeping its alt text), and no
longer renders heading attributes such as # Title {#id .class}. Scheme detection
follows browsers: it ignores case, leading control characters and embedded tabs or
newlines. Relative links, fragments and to_html() are unchanged.
Verified TLS for PostgreSQL and Redis
- PostgreSQL (
std/db/postgresand the std/auth store) honourssslmode:
verify-fullchecks the certificate chain and host name,verify-cathe chain
only (it needssslrootcert),requireencrypts without verifying, anddisable
stays plaintext.preferandalloware rejected because they can fall back to
plaintext. Withoutsslmode, a connection uses verified TLS (verify-full
against the host CA store) unless every host is local: a loopback address,
localhost, a Unix socket, or a single-label name such as a Docker service
(db), which stay plaintext as before.sslrootcert=/path/ca.pemadds a private
CA and always means verified TLS: withoutsslmodeit selectsverify-fullfor
local hosts too, it cannot be combined withrequireordisable, and over a
Unix socket, which PostgreSQL serves in plaintext only, it is an error. A TLS
connection never falls back to plaintext, and errors never include the
connection string. Each TLS policy has its own connection pool, and trust roots
are read once per pool: restart after rotating a CA. A server that accepts TLS
must finish the handshake within the connection string'sconnect_timeout, or
10 seconds when it sets none; otherwise the connection is closed with an error.
A target given only ashostaddr=is named by that address, soverify-full
needs a certificate for the IP address (libpq instead refusesverify-full
without a host name), and such targets now also work in plaintext through the
connection pool, where they used to fail on Unix. - Redis and Valkey (
std/kv,std/jobsstores and the std/auth session store):
rediss://andvalkeys://connect over TLS and verify the certificate chain and
host name against the host CA store.redis://andvalkey://stay plaintext.
Before,std/kvtreated arediss://URL as a SQLite file path, and jobs and auth
rejected it. Connecting now has a deadline on each wait:std/kvopen(), job
stores and the auth session store wait at most 10 seconds for each answer during
the TCP connect, the TLS handshake and the setup commands, so a server that stops
answering is an error instead of a hang. The bound is per wait, not for the whole
connection, so a reply that arrives very slowly can take longer (see the known
issues). One auth-store operation's slow connect no longer holds up the others.
SMTP fixes in std/email
std/email now uses lettre 0.11.24, which fixes six advisories in its SMTP
client:
- RUSTSEC-2026-0560: STARTTLS response injection let a
man-in-the-middle forge SMTP replies. Only STARTTLS connections are affected. - RUSTSEC-2026-0561: message content with a bare LF or CR
was not dot-stuffed, allowing SMTP command injection. - RUSTSEC-2026-0563: mail for an address with a quoted local
part could be sent to a different address. - RUSTSEC-2026-0565: a malicious server could exhaust memory
with an unbounded reply. - RUSTSEC-2026-0562 and
RUSTSEC-2026-0564: panics on anEHLOreply line of only
white space and on a display name containing CR or LF.
Other fixes
- The warning for JavaScript-style
${...}interpolation in string literals scans
each literal once and reports at most 64 candidates, shortening long snippets. A
crafted literal previously took quadratic time and memory. - Windows installer:
install.ps1verifies the archive against the release's
.sha256file before extracting it, and replaces an existingntnt.exeonly after
the new binary runs and reports the release's version; on any failure the previous
install stays. It no longer builds from source when the download fails, never
reuses or overwrites an existing.\ntntdirectory, and fetches the starter kit
from the release tag instead ofmain. ntnt testsends its requests once the app's server is listening, instead of
after a fixed short wait, so an app that is slow to start no longer fails its
first requests;--port 0now picks a free port.- Release checksums: the Windows archive's
.sha256file now ends its line with
LF like the others, soshasum -a 256 -con macOS accepts it. - Process tests keep their fixtures in private temporary directories.
Compatibility and upgrade checklist
- Policy keys belong in the host environment.
load_envnow skips
NTNT_PROCESS_ENABLE,NTNT_PROCESS_ALLOW, thefetch()policy keys,
NTNT_NET_ALLOW_PRIVATE,NTNT_NETMON_ENABLEand everyNTNT_SECRETS_*key,
printing a warning for each. If your app sets any of them in a.envfile, set
them in the environment that startsntntinstead; otherwise process execution,
fetch(),std/net,std/netmonandstd/secretsuse their defaults. - Handlers under the auth prefix. A custom handler under the auth prefix that
require_auth()or a protected-path rule covers now requires a session. With a
globalrequire_auth(), a custom page mounted at the prefix itself redirects to
the prefix; exclude it in your own middleware. - PostgreSQL TLS. A connection string whose host is not local (a name containing
a dot, or a non-loopback address) and that has nosslmodenow requires verified
TLS. Enable TLS on the server, addsslrootcert=for a private or managed CA, or
addsslmode=disableto keep plaintext on a trusted network.sslrootcert
always means verified TLS, local hosts included: remove it to usedisableor
require.sslmode=preferandsslmode=alloware rejected, and so are TLS
modes over a Unix socket. - Safe Markdown.
to_html_safe()renderstel:,ftp:,data:and other
links outside http, https and mailto as plain text. Useto_html()for trusted
content that needs them. - Development reload. A
require_auth(path)rule orprotected_pathsentry you
delete stays enforced until the server restarts; rules you add still apply at the
reload.
Deploying with .env files. Apart from the reserved policy keys, load_env
applies every value in the file, NTNT_ENV included, so a development .env
deployed with a production app turns off its production protections. Ship the
.env meant for that host, or none, and keep production secrets in
std/secrets. #409 tracks a warning when a .env changes NTNT_ENV from the
host's value.
Builds and dependencies. Release archives cover the same platforms as before:
Linux x64, Linux ARMv7 hard-float, macOS Apple Silicon and Windows x64. redis
moves to 0.28.2 and lettre to 0.11.24. The redis crate's rustls support adds
rustls-pemfile and webpki-roots (data only; NTNT verifies against the host CA
store), plus older versions of rustls-native-certs, openssl-probe
(certificate-path lookup, with no OpenSSL linkage) and security-framework (macOS
only) alongside the ones NTNT already uses. Contributors and builders use the
pinned Rust 1.99.1 toolchain.
Known issues not fixed in this release:
- A development reload that fails before
enable_auth()serves routes without
authentication (#394). ntntstops with a panic whenload_envreads a.envline with an empty key
(#406).- A
rediss://orvalkeys://host name that resolves to several addresses
fails to connect when its first address does not answer, even if a later one
would (#410). - Some connection waits still have no deadline of their own: PostgreSQL's wait for
the server's first answer and its login exchange, Redis/Valkey host name lookups
and replies that arrive very slowly, and Redis commands after the connection is
set up (#410).
The version-pinned references below become available with the v0.6.3 tag:
- Runtime TLS for PostgreSQL and Redis
- Environment configuration and
load_env - Authentication
- SSRF protection for
fetch() - Release builds and installation
Full changelog: v0.6.2...v0.6.3
What's Changed
- fix: security hardening for 0.6.3 (auth, runtime policy, SSRF, Markdown, installers) by @larimonious in #395
- fix: land runtime TLS (#396) on main; lettre 0.11.24 for six SMTP advisories by @larimonious in #405
- release: prepare 0.6.3; Windows checksum file ends with LF by @larimonious in #408
Full Changelog: v0.6.2...v0.6.3