T06 · System Persistence
- Location
shortcut.ts:44- Finding
Linux Shortcut Setup Creates Persistent Login Autostart Entries
- Content
View full analysis
{ return new Promise((resolve) => { const configDir = path.join(process.env.HOME!, '.config', 'autostart'); if (!fs.existsSync(configDir)) { fs.mkdirSync(configDir, { recursive: true }); } const shortcutApps = { [SHORTCUTS.today]: 'token-tracker today', [SHORTCUTS.week]: 'token-tracker week', [SHORTCUTS.total]: 'token-tracker total', [SHORTCUTS.history]: 'token-tracker history', [SHORTCUTS.save]: 'token-tracker save', [SHORTCUTS.interactive]: 'token-tracker i' }; for (const [shortcut, command] of Object.entries(shortcutApps)) { const desktopFile = path.join(configDir, `token-tracker-${shortcut.replace('ctrl-', '')}.desktop`); const desktopContent = `[Desktop Entry] Type=Application Name=Token Tracker - ${shortcut} Exec=sh -c "token-tracker ${command}" Icon=terminal Terminal=true `; fs.writeFileSync(desktopFile, desktopContent); } const bashrcPath = path.join(process.env.HOME!, '.bashrc'); const bashrcContent = fs.readFileSync(bashrcPath, 'utf8'); if (!bashrcContent.includes('token-tracker-shortcuts')) { const newContent = bashrcContent + ` # Token Tracker Shortcuts export PATH="$HOME/.openclaw/skills/token-tracker/bin:$PATH" `; fs.writeFileSync(bashrcPath, newContent); } ``` ### Technical Analysis The feature is described as configuring keyboard shortcuts, but it writes multiple `.desktop` files to `~/.config/autostart`. Files in this directory are executed automatically when the user starts a graphical desktop session. This is persistence rather than shortcut registration and exceeds the permissions necessary to display token statistics. The generated command also resolves `token-tra ...[truncated 1360 chars]- Remediation
View remediation
