Stack qualité CI (MegaLinter, Trivy, ESLint) et purge du backlog lint web
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Successful in 1m9s
Build & Push Images / build (brain) (push) Successful in 1m10s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 2m36s
Build & Push Images / build (web) (push) Successful in 1m48s
Build & Push Images / build-switcher (push) Successful in 20s
Build & Push Images / build (core) (push) Successful in 3m9s
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 38s

CI (Gitea Actions) :
- Nouveau workflow quality.yml (séparé de ci.yml, non bloquant pour la release) :
  MegaLinter v9 (PMD, Ruff, Bandit, gitleaks, hadolint), ng lint (web) et
  Trivy (CVE des dépendances Maven/pip/npm), sur main + beta + PR
- Trivy : préchargement du cache Maven avant le scan — sans ça Maven Central
  rate-limite l'IP du runner (429) en résolvant les BOMs du parent Spring Boot
- upload-artifact v4 → v3 : l'API artifacts v4 n'est pas supportée par Gitea
  (corrige aussi l'upload du rapport Playwright de e2e.yml, cassé depuis toujours)
- Ruleset PMD projet (java-pmd-ruleset.xml, auto-détecté par MegaLinter) orienté
  bugs réels, sans le style Lombok-hostile du défaut : 11 337 → 65 findings ;
  PMD en mode rapport (JAVA_PMD_DISABLE_ERRORS) le temps de purger ce backlog

Web :
- angular-eslint 21 + eslint-plugin-sonarjs : les règles Sonar vivent désormais
  dans ESLint (config web/eslint.config.js, réglages justifiés en commentaire)
- tsconfig : skipLibCheck + types:[] + node_modules ré-exclu — répare les builds
  desktop Windows/Linux cassés par le conflit @types/eslint-scope vs ESLint 9
- Purge du backlog lint : 114 erreurs → 0 sur 66 fichiers (ngOnDestroy vides
  supprimés, any typés avec les vrais DTOs, outputs (close) → (closed), regex
  super-linéaires désamorcées, ternaires/fonctions imbriqués dépliés, intention
  documentée sur les catch/error volontairement vides)
- Bug latent corrigé au passage : license.service.disconnect() émettait
  undefined au lieu de true en cas de succès (masqué par un double cast)
This commit is contained in:
2026-07-07 01:05:00 +02:00
parent 3e9e828225
commit 42c4b53ced
71 changed files with 353 additions and 276 deletions
@@ -80,7 +80,7 @@
(keyup.enter)="submitRenameTitle()"
(keyup.escape)="cancelRenameTitle()"
(blur)="submitRenameTitle()"
autofocus />
/>
}
} @else {
<h2 class="header-title">{{ 'aiChatDrawer.title' | translate }}</h2>
@@ -88,7 +88,7 @@ export class AiChatDrawerComponent implements OnInit, OnChanges, OnDestroy {
/** Persistance activee ? false = mode wizard ephemere. */
@Input() persistent = true;
@Output() close = new EventEmitter<void>();
@Output() closed = new EventEmitter<void>();
@Output() primaryActionClick = new EventEmitter<void>();
@Output() assistantReply = new EventEmitter<string>();
@@ -180,7 +180,7 @@ export class AiChatDrawerComponent implements OnInit, OnChanges, OnDestroy {
this.isWide = !this.isWide;
try {
localStorage.setItem(this.LS_WIDE, this.isWide ? '1' : '0');
} catch {}
} catch { /* localStorage indisponible : ignoré */ }
}
/** Debut du drag : enregistre la position de depart + abonne listeners globaux. */
@@ -216,7 +216,7 @@ export class AiChatDrawerComponent implements OnInit, OnChanges, OnDestroy {
if (this.customWidth !== null) {
try {
localStorage.setItem(this.LS_WIDTH, String(this.customWidth));
} catch {}
} catch { /* localStorage indisponible : ignoré */ }
}
}
@@ -231,7 +231,7 @@ export class AiChatDrawerComponent implements OnInit, OnChanges, OnDestroy {
}
}
this.isWide = localStorage.getItem(this.LS_WIDE) === '1';
} catch {}
} catch { /* localStorage indisponible : ignoré */ }
}
ngOnChanges(changes: SimpleChanges): void {
@@ -374,7 +374,7 @@ export class AiChatDrawerComponent implements OnInit, OnChanges, OnDestroy {
onClose(): void {
this.abortStream();
this.close.emit();
this.closed.emit();
}
send(): void {
@@ -450,7 +450,7 @@ export class AiChatDrawerComponent implements OnInit, OnChanges, OnDestroy {
this.scrollToBottom();
if (convId) {
this.conversationService.appendMessage(convId, 'user', text).subscribe({ error: () => {} });
this.conversationService.appendMessage(convId, 'user', text).subscribe({ error: () => { /* best-effort : erreur ignorée volontairement */ } });
}
this.streamSub = this.buildStream().subscribe({
@@ -477,7 +477,7 @@ export class AiChatDrawerComponent implements OnInit, OnChanges, OnDestroy {
next: () => {
if (wasEmpty) this.triggerAutoTitle(convId);
},
error: () => {},
error: () => { /* best-effort : erreur ignorée volontairement */ },
});
}
}
@@ -505,7 +505,7 @@ export class AiChatDrawerComponent implements OnInit, OnChanges, OnDestroy {
c.id === convId ? { ...c, title } : c,
);
},
error: () => {},
error: () => { /* best-effort : erreur ignorée volontairement */ },
});
}
@@ -10,7 +10,7 @@ import { TranslatePipe } from '@ngx-translate/core';
*/
export interface BreadcrumbItem {
label: string;
route?: string | any[];
route?: string | unknown[];
}
/**
+3 -1
View File
@@ -26,7 +26,9 @@ export class DiceUtils {
/** Parse une formule simple `[N]dM`. Renvoie null si invalide. */
static parse(formula: string | null | undefined): ParsedDice | null {
const m = /^\s*(\d*)\s*[dD]\s*(\d+)\s*$/.exec(formula ?? '');
// trim() préalable au lieu de \s* aux extrémités : `\s*(\d*)\s*` était
// ambigu (quadratique) quand \d* est vide. Même langage accepté.
const m = /^(\d*)\s*[dD]\s*(\d+)$/.exec((formula ?? '').trim());
if (!m) return null;
const count = m[1] ? parseInt(m[1], 10) : 1;
const faces = parseInt(m[2], 10);
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { LucideAngularModule, ChevronDown, ChevronUp } from 'lucide-angular';
@@ -17,7 +17,7 @@ import { LucideAngularModule, ChevronDown, ChevronUp } from 'lucide-angular';
templateUrl: './expandable-section.component.html',
styleUrls: ['./expandable-section.component.scss']
})
export class ExpandableSectionComponent {
export class ExpandableSectionComponent implements OnInit {
readonly ChevronDown = ChevronDown;
readonly ChevronUp = ChevronUp;
@@ -12,24 +12,34 @@ import { PageService } from '../../services/page.service';
import { TemplateService } from '../../services/template.service';
import { CampaignService } from '../../services/campaign.service';
import { NpcService } from '../../services/npc.service';
import { CharacterService } from '../../services/character.service';
import { CharacterService, CharacterSearchResult } from '../../services/character.service';
import { RandomTableService } from '../../services/random-table.service';
import { ItemCatalogService } from '../../services/item-catalog.service';
import { EnemyService } from '../../services/enemy.service';
import { Lore, LoreNode } from '../../services/lore.model';
import { Template } from '../../services/template.model';
import { Page } from '../../services/page.model';
import { Campaign } from '../../services/campaign.model';
import { Npc } from '../../services/npc.model';
import { RandomTable } from '../../services/random-table.model';
import { ItemCatalog } from '../../services/item-catalog.model';
import { Enemy } from '../../services/enemy.model';
type ResultKind =
| 'lore' | 'node' | 'template' | 'page' | 'campaign'
| 'npc' | 'character' | 'random-table' | 'item-catalog' | 'enemy';
interface SearchResult {
id: string;
/** Optionnel dans les DTOs (objets pas encore persistés) mais toujours
* présent sur des résultats de recherche serveur. */
id: string | undefined;
kind: ResultKind;
title: string;
subtitle: string;
/** Tag affiché sous le titre (ex: "Lore", "Dossier", "Template", "Page"). */
tag: string;
/** Route Angular (array pour router.navigate). */
route: any[];
route: (string | undefined)[];
}
/**
@@ -140,8 +150,8 @@ export class GlobalSearchComponent implements OnInit, OnDestroy {
* noeuds/templates, et enfin les racines (campagnes, lores).
*/
private buildResults(r: {
lores: any[]; nodes: any[]; templates: any[]; pages: any[]; campaigns: any[];
npcs: any[]; characters: any[]; tables: any[]; catalogs: any[]; enemies: any[];
lores: Lore[]; nodes: LoreNode[]; templates: Template[]; pages: Page[]; campaigns: Campaign[];
npcs: Npc[]; characters: CharacterSearchResult[]; tables: RandomTable[]; catalogs: ItemCatalog[]; enemies: Enemy[];
}): SearchResult[] {
const { lores, nodes, templates, pages, campaigns, npcs, characters, tables, catalogs, enemies } = r;
const pageResults: SearchResult[] = pages.map(p => ({
@@ -130,7 +130,7 @@ export class ImageBlockComponent implements OnDestroy {
const id = this.currentId;
if (!id) return;
// Best-effort côté serveur (pas d'orpheline) ; on n'attend pas la réponse.
this.imageService.delete(id).subscribe({ error: () => {} });
this.imageService.delete(id).subscribe({ error: () => { /* best-effort : erreur ignorée volontairement */ } });
const ids = this.imageIds.filter(i => i !== id);
if (this.framing?.[id]) {
const next = { ...this.framing };
@@ -96,7 +96,7 @@ export class ImageGalleryComponent {
event.stopPropagation(); // Evite d'ouvrir le lightbox en cliquant sur X.
// On supprime aussi cote serveur pour ne pas laisser d'image orpheline.
// Best-effort : on n'attend pas le retour pour emettre la nouvelle liste.
this.imageService.delete(id).subscribe({ error: () => {} });
this.imageService.delete(id).subscribe({ error: () => { /* best-effort : erreur ignorée volontairement */ } });
this.imageIdsChange.emit(this.imageIds.filter(i => i !== id));
}
+4
View File
@@ -18,6 +18,10 @@ export class MarkdownPipe implements PipeTransform {
if (!value) return '';
const html = marked.parse(value, { async: false, gfm: true, breaks: true }) as string;
const clean = DOMPurify.sanitize(html);
// Revue sécurité : le bypass est sûr ICI car le HTML vient d'être passé
// par DOMPurify juste au-dessus (le sanitizer Angular, moins permissif,
// casserait le rendu markdown). Ne jamais bypasser sans DOMPurify amont.
// eslint-disable-next-line sonarjs/no-angular-bypass-sanitization
return this.sanitizer.bypassSecurityTrustHtml(clean);
}
}