fix: resolve SonarQube findings and high-severity npm audit vulnerability
CI / quality (push) Successful in 11m52s
CI / quality (pull_request) Successful in 11m45s

SonarQube dev scan (localhost:9000, project max-app) flagged 2 bugs,
6 vulnerabilities and 3 code smells; quality gate now passes.

- visionCapture.ts: .sort() without a compare function relied on locale-
  dependent default ordering — fixed with localeCompare.
- index.html: added missing lang="fr" on <html>; documented why style-src
  keeps 'unsafe-inline' (React/mermaid inline styles) while script-src stays
  strictly 'self'.
- drawingWindow.ts/exerciseWindow.ts/windowBridge.ts: replaced Math.random()
  with crypto.randomUUID() for IPC correlation ids (flagged as insecure PRNG,
  even though these ids are never security-sensitive).
- translate.ts/deleteFileOrFolder.ts: replaced two regexes flagged for
  superlinear backtracking with plain indexOf/loop-based equivalents.
- App.tsx: documented with NOSONAR why the whole-window drag surface isn't
  given fake keyboard interactivity (no keyboard gesture equivalent to
  "drag the window"; would also break tab order).
- drawingWindow.ts: extracted the near-identical request/ack/timeout
  boilerplate shared by revealShape() and playCaption() into waitForAck(),
  fixing a new-code duplication-density quality gate failure surfaced once
  these lines were touched.

Also fixes the Gitea CI "Security audit" step (npm audit --audit-level=high):
pptxgenjs@4.0.1 pinned image-size to ^1.2.1, within the high-severity DoS
range (GHSA-5p2g-fcmc-qvqq / GHSA-w3rx-r6r6-pgpr, affects <=2.0.2). Added an
npm "overrides" entry forcing image-size to ^2.0.4 under pptxgenjs. The
affected code path (image embedding) isn't even used by createPowerpoint.ts,
and existing tests still pass. Remaining audit findings are all moderate,
dev-tooling-only (eslint/electron-builder's minimatch/glob chain).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
william
2026-10-31 10:37:10 +01:00
co-authored by Claude Sonnet 5
parent a771883bf5
commit 09ae70cb36
11 changed files with 75 additions and 64 deletions
+7 -16
View File
@@ -58,6 +58,9 @@
"typescript": "^5.9.3",
"vite": "^8.3.4",
"vitest": "^5.0.5"
},
"engines": {
"node": ">=24.0.0"
}
},
"node_modules/@adobe/css-tools": {
@@ -7037,18 +7040,15 @@
}
},
"node_modules/image-size": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/image-size/-/image-size-1.2.1.tgz",
"integrity": "sha512-rH+46sQJ2dlwfjfhCyNx5thzrv+dtmBIhPHk0zgRUukHzZ/kRueTJXoYYsclBaKcSMBWuGbOFXtioLpzTb5euw==",
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/image-size/-/image-size-2.0.4.tgz",
"integrity": "sha512-QRUkFFsRV/6fuESxb9Vkq+a0LkSrgKXuc2NEqfikiXxxN/G3tjWt5EVUlMaImRBZRZK/jRBEbYvpPYZL8t08Zw==",
"license": "MIT",
"dependencies": {
"queue": "6.0.2"
},
"bin": {
"image-size": "bin/image-size.js"
},
"engines": {
"node": ">=16.x"
"node": ">=18"
}
},
"node_modules/immediate": {
@@ -9651,15 +9651,6 @@
"node": ">=16.0.0"
}
},
"node_modules/queue": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz",
"integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==",
"license": "MIT",
"dependencies": {
"inherits": "~2.0.3"
}
},
"node_modules/quick-lru": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",