feat: clean install (Gitea en dur, scan off) + durcissement sécurité entreprise
Gitea - lien « Code source » hardcodé (REPO_SOURCE_URL) vers le dépôt, toujours visible - retrait complet du réglage configurable (api.ts, route+store settings, SettingsView, i18n, help, tests) Découverte des dépôts - aucune racine de scan par défaut → pas de scan au premier démarrage (clean install) - corrige la découverte des dépôts à l'INTÉRIEUR d'une racine qui est elle-même un repo (depth 0 = conteneur de scan, on descend ; depth > 0 = feuille) Sécurité « enterprise-deployable » - en-têtes HTTP durcis (CSP, X-Frame-Options, nosniff, Referrer-Policy, HSTS conditionnel, no-store API), header Server retiré - permissions DB 0o600 / dossier de données 0o700 ; error handler sanitisé ; garde Content-Type sur les mutations - chiffrement au repos AES-256-GCM des secrets (server_secret, clé privée VAPID) via SecretBox - journal d'audit (migration #7) + endpoint /audit-logs + RGPD export/effacement + UI Réglages - SECURITY.md, docs/ENTERPRISE_DEPLOYMENT.md, sections README EN/FR, SBOM CycloneDX en CI CI - pack-smoke packe depuis le contexte du package (cd packages/server) au lieu de « npm pack -w » : corrige l'embarquement de @arboretum/shared dans le tarball Purge des données personnelles du dépôt public - suppression de spikes/s4-discovery/result.json, reformulation du VERDICT - chemin de test générique, anonymisation des 5 fixtures de dialogues Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,8 +3,8 @@ import { useRoute, type RouteLocationRaw } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Boxes, GitBranch, LifeBuoy, Settings, TerminalSquare } from '@lucide/vue';
|
||||
import { useSessionsStore } from '../stores/sessions';
|
||||
import { useSettingsStore } from '../stores/settings';
|
||||
import GiteaIcon from '../components/ui/GiteaIcon.vue';
|
||||
import { REPO_SOURCE_URL } from '../lib/constants';
|
||||
|
||||
export interface NavEntry {
|
||||
key: string;
|
||||
@@ -23,7 +23,6 @@ export function useNav() {
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const sessions = useSessionsStore();
|
||||
const settings = useSettingsStore();
|
||||
|
||||
// sessions vivantes bloquées sur un dialogue (le cœur de la supervision mobile).
|
||||
const waitingCount = computed(
|
||||
@@ -37,17 +36,12 @@ export function useNav() {
|
||||
{ key: 'groups', to: { name: 'groups' }, icon: Boxes, label: t('nav.groups'), match: ['groups', 'group'], badge: 0 },
|
||||
]);
|
||||
|
||||
// Onglets secondaires : réglages, aide, et lien externe Gitea (uniquement si l'URL est configurée).
|
||||
const secondary = computed<NavEntry[]>(() => {
|
||||
const items: NavEntry[] = [
|
||||
{ key: 'settings', to: { name: 'settings' }, icon: Settings, label: t('nav.settings'), match: ['settings'], badge: 0 },
|
||||
{ key: 'help', to: { name: 'help' }, icon: LifeBuoy, label: t('nav.help'), match: ['help'], badge: 0 },
|
||||
];
|
||||
if (settings.giteaUrl) {
|
||||
items.push({ key: 'gitea', href: settings.giteaUrl, icon: GiteaIcon, label: t('nav.gitea'), match: [], badge: 0 });
|
||||
}
|
||||
return items;
|
||||
});
|
||||
// Onglets secondaires : réglages, aide, et lien externe « Code source » (en dur, toujours présent).
|
||||
const secondary = computed<NavEntry[]>(() => [
|
||||
{ key: 'settings', to: { name: 'settings' }, icon: Settings, label: t('nav.settings'), match: ['settings'], badge: 0 },
|
||||
{ key: 'help', to: { name: 'help' }, icon: LifeBuoy, label: t('nav.help'), match: ['help'], badge: 0 },
|
||||
{ key: 'gitea', href: REPO_SOURCE_URL, icon: GiteaIcon, label: t('nav.gitea'), match: [], badge: 0 },
|
||||
]);
|
||||
|
||||
const isActive = (match: string[]): boolean => match.includes(String(route.name));
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ export default {
|
||||
settings: 'Settings',
|
||||
help: 'Help',
|
||||
more: 'More',
|
||||
gitea: 'Open Gitea',
|
||||
gitea: 'Source code',
|
||||
waiting: 'waiting',
|
||||
},
|
||||
controls: {
|
||||
@@ -333,14 +333,16 @@ export default {
|
||||
confirmRevoke: 'Confirm revoke',
|
||||
tokenRevoked: 'Token revoked',
|
||||
lastTokenError: 'You cannot revoke the last active token — create another one first.',
|
||||
// Intégrations
|
||||
integrations: 'Integrations',
|
||||
gitea: 'Gitea',
|
||||
giteaUrlLabel: 'Gitea instance URL',
|
||||
giteaUrlPlaceholder: 'https://git.example.com',
|
||||
giteaUrlHint: 'Adds a shortcut icon to the navigation. Leave empty to hide it.',
|
||||
save: 'Save',
|
||||
saved: 'Saved',
|
||||
// Sécurité & conformité
|
||||
compliance: 'Security & compliance',
|
||||
complianceHint: 'Export or erase the data tied to your token (GDPR), and review the audit log of sensitive operations.',
|
||||
exportData: 'Export my data',
|
||||
refreshAudit: 'Audit log',
|
||||
deleteData: 'Erase my data',
|
||||
deleteConfirm: 'Erase the data tied to your token (push subscriptions) and revoke this token? This cannot be undone.',
|
||||
deleteDone: 'Your data has been erased.',
|
||||
// Découverte des dépôts
|
||||
discovery: 'Repository discovery',
|
||||
discoveryHint: 'Arboretum scans these folders for git repositories and registers them automatically. Hidden repos are kept and never re-added.',
|
||||
|
||||
@@ -184,7 +184,7 @@ const fr: typeof en = {
|
||||
settings: 'Réglages',
|
||||
help: 'Aide',
|
||||
more: 'Plus',
|
||||
gitea: 'Ouvrir Gitea',
|
||||
gitea: 'Code source',
|
||||
waiting: 'en attente',
|
||||
},
|
||||
controls: {
|
||||
@@ -336,14 +336,16 @@ const fr: typeof en = {
|
||||
confirmRevoke: 'Confirmer la révocation',
|
||||
tokenRevoked: 'Jeton révoqué',
|
||||
lastTokenError: 'Impossible de révoquer le dernier jeton actif — créez-en un autre d’abord.',
|
||||
// Intégrations
|
||||
integrations: 'Intégrations',
|
||||
gitea: 'Gitea',
|
||||
giteaUrlLabel: 'URL de l’instance Gitea',
|
||||
giteaUrlPlaceholder: 'https://git.exemple.com',
|
||||
giteaUrlHint: 'Ajoute une icône de raccourci dans la navigation. Laissez vide pour la masquer.',
|
||||
save: 'Enregistrer',
|
||||
saved: 'Enregistré',
|
||||
// Sécurité & conformité
|
||||
compliance: 'Sécurité & conformité',
|
||||
complianceHint: 'Exportez ou effacez les données liées à votre jeton (RGPD), et consultez le journal d’audit des opérations sensibles.',
|
||||
exportData: 'Exporter mes données',
|
||||
refreshAudit: 'Journal d’audit',
|
||||
deleteData: 'Effacer mes données',
|
||||
deleteConfirm: 'Effacer les données liées à votre jeton (abonnements push) et révoquer ce jeton ? Action irréversible.',
|
||||
deleteDone: 'Vos données ont été effacées.',
|
||||
// Découverte des dépôts
|
||||
discovery: 'Découverte des dépôts',
|
||||
discoveryHint: 'Arboretum scanne ces dossiers à la recherche de dépôts git et les enregistre automatiquement. Les dépôts masqués sont conservés et jamais ré-ajoutés.',
|
||||
|
||||
8
packages/web/src/lib/constants.ts
Normal file
8
packages/web/src/lib/constants.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// Constantes globales du front.
|
||||
|
||||
/**
|
||||
* Lien « Code source » affiché en permanence dans la navigation secondaire.
|
||||
* En dur (pas un réglage) : pointe vers le dépôt source d'Arboretum, identique pour
|
||||
* tous les utilisateurs de la solution.
|
||||
*/
|
||||
export const REPO_SOURCE_URL = 'https://git.lidge.fr/johanleroy/arboretum';
|
||||
@@ -3,11 +3,10 @@ import { ref } from 'vue';
|
||||
import type { ServerInfo, SettingsResponse, UpdateSettingsRequest } from '@arboretum/shared';
|
||||
import { api } from '../lib/api';
|
||||
|
||||
// Réglages serveur + intégrations. `giteaUrl` alimente l'item de nav Gitea (affiché si défini).
|
||||
// Réglages serveur (découverte des dépôts, infos serveur).
|
||||
// Les préférences purement client (langue) restent gérées par l'i18n/localStorage.
|
||||
export const useSettingsStore = defineStore('settings', () => {
|
||||
const server = ref<ServerInfo | null>(null);
|
||||
const giteaUrl = ref<string | null>(null);
|
||||
const scanRoots = ref<string[]>([]);
|
||||
const scanIntervalMin = ref(0);
|
||||
const loaded = ref(false);
|
||||
@@ -15,7 +14,6 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
|
||||
function apply(res: SettingsResponse): void {
|
||||
server.value = res.server;
|
||||
giteaUrl.value = res.settings.giteaUrl;
|
||||
scanRoots.value = res.settings.scanRoots;
|
||||
scanIntervalMin.value = res.settings.scanIntervalMin;
|
||||
loaded.value = true;
|
||||
@@ -34,5 +32,5 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
}
|
||||
}
|
||||
|
||||
return { server, giteaUrl, scanRoots, scanIntervalMin, loaded, saving, fetch, save };
|
||||
return { server, scanRoots, scanIntervalMin, loaded, saving, fetch, save };
|
||||
});
|
||||
|
||||
@@ -102,25 +102,6 @@
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- Intégrations : Gitea -->
|
||||
<section class="card flex flex-col gap-3">
|
||||
<h2 class="flex items-center gap-2 text-sm font-semibold text-zinc-100">
|
||||
<Puzzle :size="16" /> {{ t('settings.integrations') }}
|
||||
</h2>
|
||||
<form class="flex flex-col gap-2" @submit.prevent="saveGitea">
|
||||
<label class="flex flex-col gap-1">
|
||||
<span class="text-xs text-zinc-400">{{ t('settings.giteaUrlLabel') }}</span>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<input v-model="giteaInput" type="url" class="input min-w-48 flex-1" :placeholder="t('settings.giteaUrlPlaceholder')" />
|
||||
<BaseButton type="submit" variant="primary" :loading="settings.saving" :disabled="!giteaDirty">
|
||||
{{ t('settings.save') }}
|
||||
</BaseButton>
|
||||
</div>
|
||||
</label>
|
||||
<p class="text-xs text-zinc-500">{{ t('settings.giteaUrlHint') }}</p>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<!-- Découverte des dépôts -->
|
||||
<section class="card flex flex-col gap-3">
|
||||
<h2 class="flex items-center gap-2 text-sm font-semibold text-zinc-100">
|
||||
@@ -156,6 +137,26 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Sécurité & conformité -->
|
||||
<section class="card flex flex-col gap-3">
|
||||
<h2 class="flex items-center gap-2 text-sm font-semibold text-zinc-100">
|
||||
<Shield :size="16" /> {{ t('settings.compliance') }}
|
||||
</h2>
|
||||
<p class="text-xs text-zinc-500">{{ t('settings.complianceHint') }}</p>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<BaseButton size="sm" :icon="Download" :loading="exporting" @click="exportData">{{ t('settings.exportData') }}</BaseButton>
|
||||
<BaseButton variant="ghost" size="sm" :icon="RefreshCw" :loading="auditing" @click="loadAudit">{{ t('settings.refreshAudit') }}</BaseButton>
|
||||
<BaseButton variant="ghost" size="sm" :icon="Trash2" @click="deleteMyData">{{ t('settings.deleteData') }}</BaseButton>
|
||||
</div>
|
||||
<ul v-if="audit.length" class="flex flex-col divide-y divide-zinc-800/80 text-xs">
|
||||
<li v-for="e in audit" :key="e.id" class="flex items-center justify-between gap-3 py-1.5">
|
||||
<span class="font-mono text-zinc-300">{{ e.action }}</span>
|
||||
<span class="truncate text-zinc-500">{{ e.actor }}</span>
|
||||
<span class="shrink-0 text-zinc-600">{{ new Date(e.ts).toLocaleString() }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- Serveur (lecture seule) -->
|
||||
<section class="card flex flex-col gap-3">
|
||||
<h2 class="flex items-center gap-2 text-sm font-semibold text-zinc-100">
|
||||
@@ -183,8 +184,16 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Bell, BellOff, Check, Copy, FolderOpen, KeyRound, Plus, Puzzle, ScanSearch, Send, Server, Shield, SlidersHorizontal, Trash2, X } from '@lucide/vue';
|
||||
import type { CreateTokenResponse, TokenInfo, TokensListResponse } from '@arboretum/shared';
|
||||
import { Bell, BellOff, Check, Copy, Download, FolderOpen, KeyRound, Plus, RefreshCw, ScanSearch, Send, Server, Shield, SlidersHorizontal, Trash2, X } from '@lucide/vue';
|
||||
import type {
|
||||
AuditLogEntry,
|
||||
AuditLogsResponse,
|
||||
CreateTokenResponse,
|
||||
DataExportResponse,
|
||||
DeleteMyDataResponse,
|
||||
TokenInfo,
|
||||
TokensListResponse,
|
||||
} from '@arboretum/shared';
|
||||
import { api, ApiError } from '../lib/api';
|
||||
import { useSettingsStore } from '../stores/settings';
|
||||
import { usePushStore } from '../stores/push';
|
||||
@@ -272,19 +281,6 @@ async function copy(text: string, target?: 'new'): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Gitea ----
|
||||
const giteaInput = ref('');
|
||||
const giteaDirty = computed(() => giteaInput.value.trim() !== (settings.giteaUrl ?? ''));
|
||||
async function saveGitea(): Promise<void> {
|
||||
try {
|
||||
await settings.save({ giteaUrl: giteaInput.value.trim() || null });
|
||||
giteaInput.value = settings.giteaUrl ?? '';
|
||||
toasts.success(t('settings.saved'));
|
||||
} catch (e) {
|
||||
toasts.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Découverte des dépôts ----
|
||||
const rootsDraft = ref<string[]>([]);
|
||||
const intervalDraft = ref(0);
|
||||
@@ -313,9 +309,55 @@ async function saveDiscovery(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Sécurité & conformité (audit / RGPD) ----
|
||||
const audit = ref<AuditLogEntry[]>([]);
|
||||
const auditing = ref(false);
|
||||
const exporting = ref(false);
|
||||
|
||||
async function loadAudit(): Promise<void> {
|
||||
auditing.value = true;
|
||||
try {
|
||||
audit.value = (await api.get<AuditLogsResponse>('/api/v1/audit-logs?limit=20')).entries;
|
||||
} catch (e) {
|
||||
toasts.error(e);
|
||||
} finally {
|
||||
auditing.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function exportData(): Promise<void> {
|
||||
exporting.value = true;
|
||||
try {
|
||||
const data = await api.get<DataExportResponse>('/api/v1/data/export');
|
||||
const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = 'arboretum-data-export.json';
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
} catch (e) {
|
||||
toasts.error(e);
|
||||
} finally {
|
||||
exporting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteMyData(): Promise<void> {
|
||||
if (!window.confirm(t('settings.deleteConfirm'))) return;
|
||||
try {
|
||||
const pending = await api.post<DeleteMyDataResponse>('/api/v1/data/delete-my-data', {});
|
||||
if (pending.status !== 'pending' || !pending.confirm) return;
|
||||
const done = await api.post<DeleteMyDataResponse>('/api/v1/data/delete-my-data', { confirm: pending.confirm });
|
||||
toasts.success(t('settings.deleteDone'));
|
||||
if (done.summary.tokenRevoked) window.location.reload(); // token courant révoqué → re-login
|
||||
} catch (e) {
|
||||
toasts.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([loadTokens(), settings.loaded ? Promise.resolve() : settings.fetch()]);
|
||||
giteaInput.value = settings.giteaUrl ?? '';
|
||||
syncDiscoveryDraft();
|
||||
void push.refresh();
|
||||
});
|
||||
|
||||
@@ -174,8 +174,8 @@ const en: HelpSection[] = [
|
||||
blurb: 'Shortcuts to the tools around your repos.',
|
||||
items: [
|
||||
{
|
||||
title: 'Gitea',
|
||||
body: 'Set your Gitea instance URL in Settings → Integrations to add a one-click Gitea icon to the navigation. Leave it empty to hide the icon.',
|
||||
title: 'Source code',
|
||||
body: 'The “Source code” icon in the navigation always links to the Arboretum source repository on Gitea.',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -342,8 +342,8 @@ const fr: HelpSection[] = [
|
||||
blurb: 'Des raccourcis vers les outils autour de vos dépôts.',
|
||||
items: [
|
||||
{
|
||||
title: 'Gitea',
|
||||
body: 'Renseignez l’URL de votre instance Gitea dans Réglages → Intégrations pour ajouter une icône Gitea en un clic dans la navigation. Laissez vide pour masquer l’icône.',
|
||||
title: 'Code source',
|
||||
body: 'L’icône « Code source » de la navigation pointe toujours vers le dépôt source d’Arboretum sur Gitea.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user