Skip to content

Keep PIN/TAN out of debug output and errors; throw on statement parse failures - #49

Open
fl034 wants to merge 2 commits into
robocode13:mainfrom
fl034:fix/no-credentials-no-silent-statement-failures
Open

fl034 wants to merge 2 commits into
robocode13:mainfrom
fl034:fix/no-credentials-no-silent-statement-failures

Conversation

@fl034

@fl034 fl034 commented Nov 17, 2026

Copy link
Copy Markdown

Two fixes that came up while using lib-fints for a daily, unattended statement fetch.

PIN and TAN stay out of debug output and request errors

  • With debugEnabled, HttpClient printed every request. The signature end segment (HNSHA) carries the PIN and, after approval, the TAN, so both landed in the log in both modes. segmentToString now masks the custom signature, and the raw dump (debugRaw) replaces the HNSHA segment. The new redactSignature follows FinTS escaping (?', ?+), so a PIN with special characters is masked completely.
  • A non-2xx response threw Request failed with status code …: <body>. Errors tend to end up in application logs, and a gateway's error page may echo parts of the request. The message is now just the status code; with debug on, the body is still printed.

A statement that cannot be parsed is an error

StatementInteractionCAMT and StatementInteractionMT940 caught parse failures, logged them with console.warn and returned statements: []. A caller cannot tell that apart from an account without transactions, so for bookkeeping a parse failure silently becomes "nothing happened". The error now propagates from getAccountStatements(). This changes behaviour for callers who relied on the empty list, so it may deserve a note in the changelog.

Related open PRs, not duplicated here: #44 / #48 (raw statement documents), #45 (request timeout), #46 (no account data in decode-error logs).

Tests: src/tests/credentialRedaction.test.ts, src/tests/statementParseFailure.test.ts (all five fail without the change). vitest run (182 tests), tsc --noEmit and biome ci src pass.

Frank Lehmann added 2 commits November 17, 2026 22:58
The signature end (HNSHA) is masked in both debug modes: segmentToString
replaces the custom signature, and the raw dump replaces the whole
segment. A failed HTTP request no longer puts the response body into the
error message, which tends to end up in application logs; with debug on,
the body is still printed.
A CAMT or MT940 parse failure was logged with console.warn and turned into
an empty statement list, which callers cannot tell apart from an account
without transactions. The error now propagates from getAccountStatements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant