Skip to content

v0.12.27

Choose a tag to compare

@github-actions github-actions released this 26 Oct 15:05
· 23 commits to main since this release
0cb15fd

v0.12.27 — a JSON-escaped connection string no longer sends its credentials

With --llm-anonymize, a URL or connection string whose slashes a JSON encoder had escaped was not recognised at all, and its username, password and host went to the model endpoint. PHP's json_encode writes slashes this way by default, and so does any JSON string nested inside another. {"dsn":"postgres:\/\/svcuser:hunter2@pgprimary\/app"} was sent as written. The same held for \u002f, \u002F, a doubly escaped \\/, and an encoder that also escapes : and @ (\u003a, \u0040). The values reached the model in the alerting line, its source, the context of every later escalation and, for plain-text and logfmt lines, the line's template. The fail-closed re-scan read every such line as clean. Present since v0.4.0, when --llm-anonymize was introduced: 52 releases. With a local Ollama nothing left the machine.

This fixes a credential leak. It was handled as a private security advisory: GHSA-p47p-xrhj-3x7p.

Found while working on #59.

What changed:

  • The anonymizer now also reads each line with its JSON escapes resolved and masks every value it finds there, in the line as written. The model still receives the original text, escapes included, apart from the placeholders.
  • Everything v0.12.26 masked is still masked: the result is the union of both readings.
  • A line without any escape is processed exactly as in v0.12.26.
  • No masking rule changed.

Measured:

  • A test runs the whole anonymizer against v0.12.26's and requires that every byte v0.12.26 masked is still masked. On 22,438 inputs: 0 less, none refused.
  • Wire check against a capturing endpoint: v0.12.26 and v0.4.0 send the username, password and host; v0.12.27 sends none, in any field.
  • 10 real journald boots (232,688 masked records): nothing changes.
  • An ordinary line costs the same as before (0.99×); a line with an escape takes about twice as long.

Costs, pinned in the tests:

  • Where an older rule had read an escape's letters as part of a value (u002fappuser@…), those letters stay masked, so a backslash can sit beside a placeholder.
  • \/ outside a JSON string, such as an escaped regex or C:\/Users\/…, is read as a path and may be masked.
  • A line that contains both an escape and one of logscry's own placeholders as literal text is refused rather than sent.
  • Where v0.12.26 had masked a credential's @ by accident, the escaped form is now one placeholder, and the host has no tag of its own.

Install: download the binary for your OS from the assets below, or go install github.com/maxie7/logscry/cmd/logscry@latest.

Known limitations:

  • On the template of a plain-text or logfmt line, a credential whose : or @ is written as a \u escape is not read.
  • Other \u escapes of URL characters, such as \u002e for a dot, are not read.
  • The full list is in the README's Known limitations.

Tracked as GHSA-p47p-xrhj-3x7p.