Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
981cd66
release housekeeping
jotka Sep 29, 2026
c15b523
an expired licence holds non-admins instead of switching the instance…
jotka Sep 29, 2026
af0ef52
tighten permission checks and input handling across auth, updates and…
jotka Sep 29, 2026
4e27152
smaller fixes and internal cleanups across scheduling, env vars, haws…
jotka Sep 29, 2026
d35f870
mark a secret provider as default so new stacks start with it selected
jotka Sep 29, 2026
0ccba88
update a container straight from its details view when a newer image …
jotka Sep 29, 2026
1ae96fd
optionally skip the login form, and sign out at the identity provider
jotka Sep 29, 2026
d7c620c
cleaner image scan logs, and the real registry error
jotka Sep 29, 2026
c7ab114
mattermost notifications arrive as colour-coded cards, like the disco…
jotka Sep 29, 2026
ac5f379
dashboard disk usage segments link straight to images, volumes or con…
jotka Sep 29, 2026
b31745d
tag groups are ordered alphabetically by tag name
jotka Sep 29, 2026
eb308b6
the container file browser opens at the container's working directory
jotka Sep 29, 2026
1f77fa0
image prune no longer times out after 30s when filters are set
jotka Sep 29, 2026
4eabaa5
container icons fall back to the image namespace when the name has none
jotka Sep 29, 2026
b767cb7
percentage disk warnings are marked as unusable on hosts that report …
jotka Sep 29, 2026
d0702b2
duplicate a backup schedule to reuse its settings for another destina…
jotka Sep 29, 2026
b301c9c
exporting an image whose name contains a slash no longer fails
jotka Sep 29, 2026
83cb4ec
updating a container through the API keeps its secondary networks and…
jotka Sep 29, 2026
543aaa3
run one proton pass cli session at a time
jotka Sep 30, 2026
82e9bdb
pick the newest vulnerability scans in sql instead of loading every row
jotka Sep 30, 2026
077dc21
explain why container stats fan out to all running containers at once
jotka Sep 30, 2026
d67cc42
release housekeeping
jotka Sep 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0.49
v1.0.50
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"drizzle-orm": "0.45.2",
"fast-xml-parser": "5.7.3",
"isomorphic-dompurify": "3.22.0",
"jose": "6.2.12",
"js-yaml": "4.3.2",
"ldapts": "8.1.3",
"marked": "18.0.9",
Expand Down
3 changes: 2 additions & 1 deletion scripts/generate-openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ import { buildSpec } from './openapi/build-spec';
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
const ROOT_DIR = join(SCRIPT_DIR, '..');
const ROUTES_ROOT = join(ROOT_DIR, 'src', 'routes');
const HOOKS_FILE = join(ROOT_DIR, 'src', 'hooks.server.ts');
// The public-route lists live in public-paths-core.ts.
const HOOKS_FILE = join(ROOT_DIR, 'src', 'lib', 'server', 'public-paths-core.ts');
const PACKAGE_JSON = join(ROOT_DIR, 'package.json');
// Bundled as an importable module (src/lib) rather than read from disk at
// runtime — see src/routes/api/docs/+server.ts. The production Docker image
Expand Down
40 changes: 35 additions & 5 deletions scripts/openapi/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,17 @@ export function analyzeHandlerBody(body: string, pathParamNames: string[] = []):
const redirectRe = /\bredirect\(\s*(\d{3})/g;
let rm;
while ((rm = redirectRe.exec(body)) !== null) statusCodes.add(rm[1]);
// The authorize() guards return a ready-made 403 instead of building one inline, so
// a handler that uses them emits a status no literal in its body mentions. Without
// this the gate calls the documented 403 stale and argues against the shared guard.
// Comment lines are skipped: a handler that merely mentions the guard in its JSDoc
// would otherwise be credited with a 403 it never returns, and the drift gate would
// stop noticing when one goes missing.
const callsGuard = body
.split('\n')
.filter((line) => !/^\s*(\*|\/\/)/.test(line))
.some((line) => /\b(auth\.)?require(Permission|EnvAccess)\s*\(/.test(line));
if (callsGuard) statusCodes.add('403');

const bodyFields = new Set<string>();
// `const { a, b } = await request.json();` and `const { a, b } = body;`
Expand Down Expand Up @@ -586,9 +597,8 @@ export function analyzeHandlerBody(body: string, pathParamNames: string[] = []):
// PUBLIC_PATHS extraction (from hooks.server.ts) — auth-exemption discovery
// ---------------------------------------------------------------------------

export function extractPublicPaths(hooksFile: string): string[] {
const content = readFileSync(hooksFile, 'utf-8');
const m = content.match(/const PUBLIC_PATHS\s*=\s*\[([\s\S]*?)\];/);
function literalsIn(content: string, listName: string): string[] {
const m = content.match(new RegExp(`const ${listName}\\s*=\\s*\\[([\\s\\S]*?)\\];`));
if (!m) return [];
const paths: string[] = [];
const strRe = /'([^']+)'/g;
Expand All @@ -597,14 +607,34 @@ export function extractPublicPaths(hooksFile: string): string[] {
return paths;
}

/**
* The paths hooks.server.ts lets through unauthenticated.
*
* Kept as two lists because they match differently: an exact entry covers only itself,
* a prefix entry covers its subtree. Flattening them would mark a protected route
* beneath an exact entry as public in the spec.
*/
export function extractPublicPaths(hooksFile: string): { exact: string[]; prefixes: string[] } {
const content = readFileSync(hooksFile, 'utf-8');
return {
exact: literalsIn(content, 'PUBLIC_EXACT'),
prefixes: literalsIn(content, 'PUBLIC_PREFIXES')
};
}

// Two exceptions hardcoded directly in isPublicPath() as regexes (webhook
// signature/secret auth instead of session/token) — not expressible as a
// simple PUBLIC_PATHS prefix string. The one manual special-case this
// generator needs; documented in the research doc's coverage-gap section.
export const PUBLIC_PATH_REGEXES = [/^\/api\/git\/stacks\/\d+\/webhook$/, /^\/api\/git\/webhook\/\d+$/];

export function isPublic(openapiPath: string, publicPaths: string[]): boolean {
if (publicPaths.some((p) => openapiPath === p || openapiPath.startsWith(p + '/'))) return true;
export function isPublic(
openapiPath: string,
publicPaths: { exact: string[]; prefixes: string[] }
): boolean {
if (publicPaths.exact.includes(openapiPath)) return true;
if (publicPaths.prefixes.some((p) => openapiPath === p || openapiPath.startsWith(p + '/')))
return true;
const asConcretePath = openapiPath.replace(/\{[^}]+\}/g, '1');
return PUBLIC_PATH_REGEXES.some((re) => re.test(asConcretePath));
}
69 changes: 47 additions & 22 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,44 @@ if (useHttps) {
process.exit(1);
}

// Parse cert metadata so operators can confirm they mounted the right file.
// Keep in sync with src/lib/server/x509-display-core.ts (this file runs against
// ./build and cannot import from src). Node leaves subject/issuer undefined when
// the cert has an empty distinguished name, as newer Let's Encrypt profiles do.
const formatCertName = (name) => {
if (typeof name !== 'string') return '(none)';
const trimmed = name.trim();
return trimmed === '' ? '(none)' : trimmed.replace(/\n/g, ', ');
};
const daysUntilExpiry = (validTo, now) => {
if (typeof validTo !== 'string') return null;
const expiresAt = new Date(validTo).getTime();
if (Number.isNaN(expiresAt)) return null;
return Math.floor((expiresAt - now) / 86400000);
};
const expiryLine = (daysLeft) => {
if (daysLeft === null) return { text: 'cert expiry: (unknown)', warn: false };
if (daysLeft < 0) {
return { text: `WARNING: certificate expired ${-daysLeft} day(s) ago`, warn: true };
}
if (daysLeft < 30) {
return { text: `WARNING: certificate expires in ${daysLeft} day(s)`, warn: true };
}
return { text: `cert expires in ${daysLeft} day(s)`, warn: false };
};

// Cert metadata is logged so operators can confirm they mounted the right file.
// It is diagnostics only, so a cert TLS itself accepts must still start the
// server - hence the log failure is reported and swallowed, not fatal.
try {
const x509 = new X509Certificate(certPem);
console.log(`[HTTPS] cert subject: ${x509.subject.replace(/\n/g, ', ')}`);
console.log(`[HTTPS] cert issuer: ${x509.issuer.replace(/\n/g, ', ')}`);
console.log(`[HTTPS] cert subject: ${formatCertName(x509.subject)}`);
console.log(`[HTTPS] cert issuer: ${formatCertName(x509.issuer)}`);
console.log(`[HTTPS] cert SAN: ${x509.subjectAltName || '(none)'}`);
console.log(`[HTTPS] cert valid: ${x509.validFrom} → ${x509.validTo}`);
const expiresAt = new Date(x509.validTo).getTime();
const daysLeft = Math.floor((expiresAt - Date.now()) / 86400000);
if (daysLeft < 0) {
console.warn(`[HTTPS] WARNING: certificate expired ${-daysLeft} day(s) ago`);
} else if (daysLeft < 30) {
console.warn(`[HTTPS] WARNING: certificate expires in ${daysLeft} day(s)`);
} else {
console.log(`[HTTPS] cert expires in ${daysLeft} day(s)`);
}
console.log(`[HTTPS] cert valid: ${x509.validFrom} -> ${x509.validTo}`);
const expiry = expiryLine(daysUntilExpiry(x509.validTo, Date.now()));
(expiry.warn ? console.warn : console.log)(`[HTTPS] ${expiry.text}`);
} catch (e) {
console.error(`[HTTPS] Failed to parse certificate: ${e.message}`);
process.exit(1);
console.warn(`[HTTPS] Could not read certificate metadata: ${e.message}`);
}

const tlsOptions = { cert: certPem, key: keyPem };
Expand Down Expand Up @@ -182,6 +201,11 @@ globalThis.__terminalHandleExecMessage = (msg) => {

// Handle WebSocket upgrade
server.on('upgrade', async (req, socket, head) => {
// The socket is bare until ws adopts it in handleUpgrade below, and authentication
// awaits a database lookup first. A peer that resets during that window makes the
// write of our own 401/500 throw ECONNRESET with no listener, which is fatal.
socket.on('error', () => {});

const url = new URL(req.url || '/', `http://${req.headers.host}`);

// Only handle our specific WebSocket paths
Expand Down Expand Up @@ -379,6 +403,14 @@ function processDockerStreamChunk(data, state) {
}

async function handleTerminalConnection(ws, url, connId) {
// Registered before the first await: this runs unawaited, so every await below is a
// window in which a closed tab emits 'error' on a socket with no listener, which is
// fatal rather than a dropped connection.
ws.on('error', (err) => {
console.error('[Terminal WS] Connection error:', err.message);
wsConnections.delete(connId);
});

const pathParts = url.pathname.split('/');
const containerIdIndex = pathParts.indexOf('containers') + 1;
const containerId = pathParts[containerIdIndex];
Expand Down Expand Up @@ -597,13 +629,6 @@ async function handleTerminalConnection(ws, url, connId) {
ws.on('close', () => {
wsConnections.delete(connId);
});

// Without an 'error' listener, an emitted socket error (abrupt disconnect,
// ECONNRESET) is re-thrown as an uncaught exception and crashes the process.
ws.on('error', (err) => {
console.error('[Terminal WS] Connection error:', err.message);
wsConnections.delete(connId);
});
}

/**
Expand Down
27 changes: 1 addition & 26 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type { HandleServerError, Handle } from '@sveltejs/kit';
import { redirect } from '@sveltejs/kit';
import { startRssTracker, stopRssTracker, rssBeforeOp, rssAfterOp } from '$lib/server/rss-tracker';
import { getClientIp } from '$lib/server/client-ip';
import { isPublicPath } from '$lib/server/public-paths-core';
import { BACKUPS_ENABLED, API_DOCS_ENABLED } from '$lib/server/features';
// Side-effect import: installs globalThis.__authenticateWsUpgrade and
// globalThis.__canAccessEnvForUser used by the raw WS upgrade handlers in
Expand Down Expand Up @@ -258,32 +259,6 @@ function isBearerRateLimited(ip: string): boolean {
return true;
}

// Routes that don't require authentication
const PUBLIC_PATHS = [
'/login',
'/api/auth/login',
'/api/auth/logout',
'/api/auth/session',
'/api/auth/settings',
'/api/auth/providers',
'/api/auth/oidc',
'/api/license',
'/api/changelog',
'/api/dependencies',
'/api/health',
'/api/settings/theme',
'/api/docs'
];

// Check if path is public
function isPublicPath(pathname: string): boolean {
// Webhook endpoints have their own auth (signature/secret verification)
if (pathname.match(/^\/api\/git\/stacks\/\d+\/webhook$/)) return true;
if (pathname.match(/^\/api\/git\/webhook\/\d+$/)) return true;

return PUBLIC_PATHS.some(path => pathname === path || pathname.startsWith(path + '/'));
}

// True only for real static files. API routes are never static, even when a path
// ends in an asset-like extension (a route parameter can), so they always go through
// the normal request handling below.
Expand Down
8 changes: 3 additions & 5 deletions src/lib/components/ScanTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { onMount } from 'svelte';
import { appendEnvParam } from '$lib/stores/environment';
import { watchJob } from '$lib/utils/sse-fetch';
import { scanProgressLines } from '$lib/utils/scan-progress-lines';
import ScanResultsView from '../../routes/images/ScanResultsView.svelte';

export interface ScanResult {
Expand Down Expand Up @@ -176,13 +177,10 @@
function handleScanProgress(data: any) {
if (data.message) {
scanMessage = data.message;
const scanner = data.scanner || 'dockhand';
addOutputLine(`[${scanner}] ${data.message}`);
}

if (data.output) {
const scanner = data.scanner || 'dockhand';
addOutputLine(`[${scanner}] ${data.output}`);
for (const line of scanProgressLines(data)) {
addOutputLine(line);
}

if (data.stage === 'complete' || data.status === 'complete') {
Expand Down
Loading
Loading