Patrick Schurig 693e01579f fix(optimiseur): un token recopié par l'optimiseur ne sort par aucun journal (brief 4 T7, correctif A)
Constat de T6 (question 2) : la trace masquait un token recopié dans reason ou planId, mais
les lignes [Optimiseur] (planId, texte, détail des refus, nom du handshake) et
GetOptimizerStatus.name le portaient en clair.

- OptimizerSecret : UNE fonction de masquage (texte brut et échappé JSON, objet JSON à toute
  profondeur, clés comprises ; ligne de trace sérialisée), partagée par le client et les traces.
- OptimizerClient masque chaque message reçu dès son analyse, avec le token envoyé sur cette
  connexion : rien en aval (journal, traces, app) ne voit le secret ; dit une fois.
- Test testAnEchoedTokenLeaksNowhere : secret avec " et \ recopié partout ; aucune ligne de
  journal (tous niveaux), aucune trace, aucune réponse RPC. 4 contre-épreuves mordent.

decisions sans endpoint : IDENTIQUE (23 792 lignes), 0 rejeu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 13:10:15 +02:00

25 lines
959 B
Prolog

QT += testlib network
QT -= gui
CONFIG += testcase c++17 link_pkgconfig
PKGCONFIG += nymea
TARGET = etm-powersync-optimizerclient
# Cible VOLONTAIREMENT légère, comme loadmodel : aucun serveur nymea, aucun EnergyTestBase, et
# du moteur le seul client de transport (brief 4 T2). Les faux optimiseurs sont des
# QLocalServer/QTcpServer du processus de test, et le temps est SIMULÉ : aucun des délais
# (5 s, 10 s, backoff 1 → 60 s) ne s'écoule réellement.
INCLUDEPATH += $$PWD/../../../energyplugin
HEADERS += $$PWD/../../../energyplugin/etm/scheduler/optimizerclient.h \
$$PWD/../../../energyplugin/etm/scheduler/optimizersecret.h \
$$PWD/../common/etm-powersync-fakeoptimizer.h
SOURCES += $$PWD/../../../energyplugin/etm/scheduler/optimizerclient.cpp \
$$PWD/../../../energyplugin/etm/scheduler/optimizersecret.cpp \
testoptimizerclient.cpp
target.path = $$[QT_INSTALL_PREFIX]/bin
INSTALLS += target