feat: private hostname guard for authenticated/private mode

Reject requests from unrecognised Host headers when running
authenticated/private. Adds server middleware, CLI `allowed-hostname`
command, config-schema field, and prompt support for configuring
allowed hostnames during onboard/configure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Forgotten
2026-02-23 19:43:52 -06:00
parent 076092685e
commit 85c0b9a3dc
15 changed files with 385 additions and 8 deletions

View File

@@ -48,6 +48,7 @@ function defaultConfig(): PaperclipConfig {
exposure: "private",
host: "127.0.0.1",
port: 3100,
allowedHostnames: [],
serveUi: true,
},
auth: {
@@ -131,7 +132,10 @@ export async function configure(opts: {
break;
case "server":
{
const { server, auth } = await promptServer();
const { server, auth } = await promptServer({
currentServer: config.server,
currentAuth: config.auth,
});
config.server = server;
config.auth = auth;
}