The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix: remove RCE vector from admin update endpoint.
jubnlc9341eda3fe1
diff --git a/client/src/api/client.ts b/client/src/api/client.tsindex 9c414d001..f42b0c30b 100644--- a/client/src/api/client.ts+++ b/client/src/api/client.ts@@ -163,7 +163,6 @@ export const adminApi = {addons: () => apiClient.get('/admin/addons').then(r => r.data),updateAddon: (id: number | string, data: Record<string, unknown>) => apiClient.put(`/admin/addons/${id}`, data).then(r => r.data),checkVersion: () => apiClient.get('/admin/version-check').then(r => r.data),- installUpdate: () => apiClient.post('/admin/update', {}, { timeout: 300000 }).then(r => r.data),getBagTracking: () => apiClient.get('/admin/bag-tracking').then(r => r.data),updateBagTracking: (enabled: boolean) => apiClient.put('/admin/bag-tracking', { enabled }).then(r => r.data),packingTemplates: () => apiClient.get('/admin/packing-templates').then(r => r.data),diff --git a/client/src/pages/AdminPage.tsx b/client/src/pages/AdminPage.tsxindex b1c44dbaf..3c5e928d8 100644--- a/client/src/pages/AdminPage.tsx+++ b/client/src/pages/AdminPage.tsx@@ -16,7 +16,7 @@ import PackingTemplateManager from '../components/Admin/PackingTemplateManager'import AuditLogPanel from '../components/Admin/AuditLogPanel'import AdminMcpTokensPanel from '../components/Admin/AdminMcpTokensPanel'import PermissionsPanel from '../components/Admin/PermissionsPanel'-import { Users, Map, Briefcase, Shield, Trash2, Edit2, Camera, FileText, Eye, EyeOff, Save, CheckCircle, XCircle, Loader2, UserPlus, ArrowUpCircle, ExternalLink, Download, AlertTriangle, RefreshCw, GitBranch, Sun, Link2, Copy, Plus } from 'lucide-react'+import { Users, Map, Briefcase, Shield, Trash2, Edit2, Camera, FileText, Eye, EyeOff, Save, CheckCircle, XCircle, Loader2, UserPlus, ArrowUpCircle, ExternalLink, Download, GitBranch, Sun, Link2, Copy, Plus } from 'lucide-react'import CustomSelect from '../components/shared/CustomSelect'interface AdminUser {@@ -121,8 +121,6 @@ export default function AdminPage(): React.ReactElement {// Version check & updateconst [updateInfo, setUpdateInfo] = useState<UpdateInfo | null>(null)const [showUpdateModal, setShowUpdateModal] = useState<boolean>(false)- const [updating, setUpdating] = useState<boolean>(false)- const [updateResult, setUpdateResult] = useState<'success' | 'error' | null>(null)const { user: currentUser, updateApiKeys, setAppRequireMfa, setTripRemindersEnabled } = useAuthStore()const navigate = useNavigate()@@ -177,26 +175,6 @@ export default function AdminPage(): React.ReactElement {}}- const handleInstallUpdate = async () => {- setUpdating(true)- setUpdateResult(null)- try {- await adminApi.installUpdate()- setUpdateResult('success')- // Server is restarting — poll until it comes back, then reload- const poll = setInterval(async () => {- try {- await authApi.getAppConfig()- clearInterval(poll)- window.location.reload()- } catch { /* still restarting */ }- }, 2000)- } catch {- setUpdateResult('error')- setUpdating(false)- }- }-const handleToggleRegistration = async (value) => {setAllowRegistration(value)try {@@ -394,23 +372,13 @@ export default function AdminPage(): React.ReactElement {{t('admin.update.button')}</a>)}- {updateInfo.is_docker ? (- <button- onClick={() => setShowUpdateModal(true)}- className="flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-semibold transition-colors bg-slate-900 dark:bg-white text-white dark:text-slate-900 hover:bg-slate-700 dark:hover:bg-gray-200"- >- <Download className="w-4 h-4" />- {t('admin.update.howTo')}- </button>- ) : (- <button- onClick={() => setShowUpdateModal(true)}- className="flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-semibold transition-colors bg-slate-900 dark:bg-white text-white dark:text-slate-900 hover:bg-slate-700 dark:hover:bg-gray-200"- >- <Download className="w-4 h-4" />- {t('admin.update.install')}- </button>- )}+ <button+ onClick={() => setShowUpdateModal(true)}+ className="flex items-center gap-1.5 px-4 py-2 rounded-lg text-sm font-semibold transition-colors bg-slate-900 dark:bg-white text-white dark:text-slate-900 hover:bg-slate-700 dark:hover:bg-gray-200"+ >+ <Download className="w-4 h-4" />+ {t('admin.update.howTo')}+ </button></div></div>)}@@ -1303,78 +1271,37 @@ export default function AdminPage(): React.ReactElement {)}</Modal>- {/* Update confirmation popup — matches backup restore style */}+ {/* Update instructions popup */}{showUpdateModal && (<divstyle={{ position: 'fixed', inset: 0, zIndex: 9999, background: 'rgba(0,0,0,0.5)', backdropFilter: 'blur(4px)', display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 16 }}- onClick={() => { if (!updating) setShowUpdateModal(false) }}+ onClick={() => setShowUpdateModal(false)}><divonClick={e => e.stopPropagation()}style={{ width: '100%', maxWidth: 440, borderRadius: 16, overflow: 'hidden' }}className="bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700">- {updateResult === 'success' ? (- <>- <div style={{ background: 'linear-gradient(135deg, #16a34a, #15803d)', padding: '20px 24px', display: 'flex', alignItems: 'center', gap: 12 }}>- <div style={{ width: 40, height: 40, borderRadius: 10, background: 'rgba(255,255,255,0.2)', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>- <CheckCircle size={20} style={{ color: 'white' }} />- </div>- <div>- <h3 style={{ margin: 0, fontSize: 16, fontWeight: 700, color: 'white' }}>{t('admin.update.success')}</h3>- </div>- </div>- <div style={{ padding: '20px 24px', textAlign: 'center' }}>- <RefreshCw className="w-5 h-5 animate-spin mx-auto mb-2" style={{ color: 'var(--text-muted)' }} />- <p style={{ fontSize: 13, color: 'var(--text-muted)' }}>{t('admin.update.reloadHint')}</p>- </div>- </>- ) : updateResult === 'error' ? (- <>- <div style={{ background: 'linear-gradient(135deg, #dc2626, #b91c1c)', padding: '20px 24px', display: 'flex', alignItems: 'center', gap: 12 }}>- <div style={{ width: 40, height: 40, borderRadius: 10, background: 'rgba(255,255,255,0.2)', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>- <XCircle size={20} style={{ color: 'white' }} />- </div>- <div>- <h3 style={{ margin: 0, fontSize: 16, fontWeight: 700, color: 'white' }}>{t('admin.update.failed')}</h3>- </div>- </div>- <div style={{ padding: '0 24px 20px', display: 'flex', justifyContent: 'flex-end', marginTop: 16 }}>- <button- onClick={() => { setShowUpdateModal(false); setUpdateResult(null) }}- className="bg-slate-900 dark:bg-white text-white dark:text-slate-900 hover:bg-slate-700 dark:hover:bg-gray-200"- style={{ padding: '9px 20px', borderRadius: 10, fontSize: 13, fontWeight: 600, border: 'none', cursor: 'pointer', fontFamily: 'inherit' }}- >- {t('common.cancel')}- </button>- </div>- </>- ) : (- <>- {/* Red header */}- <div style={{ background: 'linear-gradient(135deg, #dc2626, #b91c1c)', padding: '20px 24px', display: 'flex', alignItems: 'center', gap: 12 }}>- <div style={{ width: 40, height: 40, borderRadius: 10, background: 'rgba(255,255,255,0.2)', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>- <AlertTriangle size={20} style={{ color: 'white' }} />- </div>- <div>- <h3 style={{ margin: 0, fontSize: 16, fontWeight: 700, color: 'white' }}>{t('admin.update.confirmTitle')}</h3>- <p style={{ margin: '2px 0 0', fontSize: 12, color: 'rgba(255,255,255,0.8)' }}>- v{updateInfo?.current} → v{updateInfo?.latest}- </p>- </div>- </div>+ <div style={{ background: 'linear-gradient(135deg, #0f172a, #1e293b)', padding: '20px 24px', display: 'flex', alignItems: 'center', gap: 12 }}>+ <div style={{ width: 40, height: 40, borderRadius: 10, background: 'rgba(255,255,255,0.2)', display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>+ <ArrowUpCircle size={20} style={{ color: 'white' }} />+ </div>+ <div>+ <h3 style={{ margin: 0, fontSize: 16, fontWeight: 700, color: 'white' }}>{t('admin.update.howTo')}</h3>+ <p style={{ margin: '2px 0 0', fontSize: 12, color: 'rgba(255,255,255,0.8)' }}>+ v{updateInfo?.current} → v{updateInfo?.latest}+ </p>+ </div>+ </div>- {/* Body */}- <div style={{ padding: '20px 24px' }}>- {updateInfo?.is_docker ? (- <>- <p className="text-gray-700 dark:text-gray-300" style={{ fontSize: 13, lineHeight: 1.6, margin: 0 }}>- {t('admin.update.dockerText').replace('{version}', `v${updateInfo.latest}`)}- </p>+ <div style={{ padding: '20px 24px' }}>+ <p className="text-gray-700 dark:text-gray-300" style={{ fontSize: 13, lineHeight: 1.6, margin: 0 }}>+ {t('admin.update.dockerText').replace('{version}', `v${updateInfo?.latest ?? ''}`)}+ </p>- <div style={{ marginTop: 14, padding: '12px 14px', borderRadius: 10, fontSize: 12, lineHeight: 1.8, fontFamily: 'monospace', whiteSpace: 'pre-wrap', wordBreak: 'break-all' }}- className="bg-gray-900 dark:bg-gray-950 text-gray-100 border border-gray-700"- >+ <div style={{ marginTop: 14, padding: '12px 14px', borderRadius: 10, fontSize: 12, lineHeight: 1.8, fontFamily: 'monospace', whiteSpace: 'pre-wrap', wordBreak: 'break-all' }}+ className="bg-gray-900 dark:bg-gray-950 text-gray-100 border border-gray-700"+ >{`docker pull mauriceboe/nomad:latestdocker stop nomad && docker rm nomaddocker run -d --name nomad \\@@ -1383,87 +1310,42 @@ docker run -d --name nomad \\-v /opt/nomad/uploads:/app/uploads \\--restart unless-stopped \\mauriceboe/nomad:latest`}- </div>-- <div style={{ marginTop: 10, padding: '10px 12px', borderRadius: 10, fontSize: 12, lineHeight: 1.5 }}- className="bg-emerald-50 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300 border border-emerald-200 dark:border-emerald-800"- >- <div className="flex items-start gap-2">- <CheckCircle className="w-3.5 h-3.5 mt-0.5 flex-shrink-0" />- <span>{t('admin.update.dataInfo')}</span>- </div>- </div>- </>- ) : (- <>- <p className="text-gray-700 dark:text-gray-300" style={{ fontSize: 13, lineHeight: 1.6, margin: 0 }}>- {updateInfo && t('admin.update.confirmText').replace('{current}', `v${updateInfo.current}`).replace('{version}', `v${updateInfo.latest}`)}- </p>-- <div style={{ marginTop: 14, padding: '10px 12px', borderRadius: 10, fontSize: 12, lineHeight: 1.5 }}- className="bg-emerald-50 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300 border border-emerald-200 dark:border-emerald-800"- >- <div className="flex items-start gap-2">- <CheckCircle className="w-3.5 h-3.5 mt-0.5 flex-shrink-0" />- <span>{t('admin.update.dataInfo')}</span>- </div>- </div>-- <div style={{ marginTop: 10, padding: '10px 12px', borderRadius: 10, fontSize: 12, lineHeight: 1.5 }}- className="bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 border border-blue-200 dark:border-blue-800"- >- <div className="flex items-start gap-2">- <Download className="w-3.5 h-3.5 mt-0.5 flex-shrink-0" />- <span>- {t('admin.update.backupHint')}{' '}- <button- onClick={() => { setShowUpdateModal(false); setActiveTab('backup') }}- className="underline font-semibold hover:text-blue-950 dark:hover:text-blue-100"- >{t('admin.update.backupLink')}</button>- </span>- </div>- </div>+ </div>- <div style={{ marginTop: 10, padding: '10px 12px', borderRadius: 10, fontSize: 12, lineHeight: 1.5 }}- className="bg-red-50 dark:bg-red-900/30 text-red-700 dark:text-red-300 border border-red-200 dark:border-red-800"- >- <div className="flex items-start gap-2">- <AlertTriangle className="w-3.5 h-3.5 mt-0.5 flex-shrink-0" />- <span>{t('admin.update.warning')}</span>- </div>- </div>- </>- )}+ <div style={{ marginTop: 10, padding: '10px 12px', borderRadius: 10, fontSize: 12, lineHeight: 1.5 }}+ className="bg-emerald-50 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300 border border-emerald-200 dark:border-emerald-800"+ >+ <div className="flex items-start gap-2">+ <CheckCircle className="w-3.5 h-3.5 mt-0.5 flex-shrink-0" />+ <span>{t('admin.update.dataInfo')}</span></div>+ </div>- {/* Footer */}- <div style={{ padding: '0 24px 20px', display: 'flex', gap: 10, justifyContent: 'flex-end' }}>- <button- onClick={() => setShowUpdateModal(false)}- disabled={updating}- className="text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 disabled:opacity-40"- style={{ padding: '9px 20px', borderRadius: 10, fontSize: 13, fontWeight: 600, border: 'none', cursor: 'pointer', fontFamily: 'inherit' }}- >- {t('common.cancel')}- </button>- {!updateInfo?.is_docker && (- <button- onClick={handleInstallUpdate}- disabled={updating}- className="bg-slate-900 dark:bg-white text-white dark:text-slate-900 hover:bg-slate-700 dark:hover:bg-gray-200 disabled:opacity-60 flex items-center gap-2"- style={{ padding: '9px 20px', borderRadius: 10, fontSize: 13, fontWeight: 600, border: 'none', cursor: 'pointer', fontFamily: 'inherit' }}- >- {updating ? (- <Loader2 size={14} className="animate-spin" />- ) : (- <Download size={14} />- )}- {updating ? t('admin.update.installing') : t('admin.update.confirm')}- </button>- )}+ {updateInfo?.release_url && (+ <div style={{ marginTop: 10, padding: '10px 12px', borderRadius: 10, fontSize: 12, lineHeight: 1.5 }}+ className="bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 border border-blue-200 dark:border-blue-800"+ >+ <div className="flex items-start gap-2">+ <ExternalLink className="w-3.5 h-3.5 mt-0.5 flex-shrink-0" />+ <span>+ <a href={updateInfo.release_url} target="_blank" rel="noopener noreferrer" className="underline font-semibold">+ {t('admin.update.button')}+ </a>+ </span>+ </div></div>- </>- )}+ )}+ </div>++ <div style={{ padding: '0 24px 20px', display: 'flex', justifyContent: 'flex-end' }}>+ <button+ onClick={() => setShowUpdateModal(false)}+ className="bg-slate-900 dark:bg-white text-white dark:text-slate-900 hover:bg-slate-700 dark:hover:bg-gray-200"+ style={{ padding: '9px 20px', borderRadius: 10, fontSize: 13, fontWeight: 600, border: 'none', cursor: 'pointer', fontFamily: 'inherit' }}+ >+ {t('common.close')}+ </button>+ </div></div></div>)}diff --git a/server/src/routes/admin.ts b/server/src/routes/admin.tsindex 674aa31a0..eac08ddf8 100644--- a/server/src/routes/admin.ts+++ b/server/src/routes/admin.ts@@ -1,7 +1,6 @@import express, { Request, Response } from 'express';import bcrypt from 'bcryptjs';import crypto from 'crypto';-import { execSync } from 'child_process';import path from 'path';import fs from 'fs';import { db } from '../db/database';@@ -326,49 +325,6 @@ router.get('/version-check', async (_req: Request, res: Response) => {}});-router.post('/update', async (req: Request, res: Response) => {- const rootDir = path.resolve(__dirname, '../../..');- const serverDir = path.resolve(__dirname, '../..');- const clientDir = path.join(rootDir, 'client');- const steps: { step: string; success?: boolean; output?: string; version?: string }[] = [];-- try {- const pullOutput = execSync('git pull origin main', { cwd: rootDir, timeout: 60000, encoding: 'utf8' });- steps.push({ step: 'git pull', success: true, output: pullOutput.trim() });-- execSync('npm install --production --ignore-scripts', { cwd: serverDir, timeout: 120000, encoding: 'utf8' });- steps.push({ step: 'npm install (server)', success: true });-- if (process.env.NODE_ENV === 'production') {- execSync('npm install --ignore-scripts', { cwd: clientDir, timeout: 120000, encoding: 'utf8' });- execSync('npm run build', { cwd: clientDir, timeout: 120000, encoding: 'utf8' });- steps.push({ step: 'npm install + build (client)', success: true });- }-- delete require.cache[require.resolve('../../package.json')];- const { version: newVersion } = require('../../package.json');- steps.push({ step: 'version', version: newVersion });-- const authReq = req as AuthRequest;- writeAudit({- userId: authReq.user.id,- action: 'admin.system_update',- resource: newVersion,- ip: getClientIp(req),- });- res.json({ success: true, steps, restarting: true });-- setTimeout(() => {- console.log('[Update] Restarting after update...');- process.exit(0);- }, 1000);- } catch (err: unknown) {- console.error(err);- steps.push({ step: 'error', success: false, output: 'Internal error' });- res.status(500).json({ success: false, steps });- }-});-// ── Invite Tokens ───────────────────────────────────────────────────────────router.get('/invites', (_req: Request, res: Response) => {