fix: opening balance direction, safe return paths, backup failure detection, review fixes
- opening balance: "person 2 owes person 1" was stored the wrong way round - retour param: reject backslash/control chars (open redirect) - backup: pipefail + check dump completeness, failed dumps no longer logged OK - deleting a recurring occurrence marks it skipped so sync does not recreate it - editing a charge regenerates future occurrences of incomes allocated to it - settlements (incl. opening balance) listed in settings and deletable Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a0bcea4eb1
commit
5b402691f0
15 files changed
+222
-15
No files matched your search
@@ -0,0 +1,19 @@
|
||||
// Antislash et caractères de contrôle : les navigateurs les normalisent en « // » (sortie du site).
|
||||
const UNSAFE = /[\\\u0000-\u001f\u007f]/;
|
||||
|
||||
function decoded(value: string): string {
|
||||
try {
|
||||
return decodeURIComponent(value);
|
||||
} catch {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
/** Chemin de retour interne uniquement (anti-redirection ouverte), sinon `fallback`. */
|
||||
export function safeReturn(value: string | undefined | null, fallback: string): string {
|
||||
if (!value || !value.startsWith("/") || value.startsWith("//")) return fallback;
|
||||
if (UNSAFE.test(value) || UNSAFE.test(decoded(value))) return fallback;
|
||||
const url = new URL(value, "http://local.invalid");
|
||||
if (url.origin !== "http://local.invalid") return fallback;
|
||||
return url.pathname + url.search + url.hash;
|
||||
}
|
||||
Reference in new issue
Block a user