Skip to content

chore(catalogue): sanitize user-supplied sortId before logging #421

Description

@JanSmrcka

Context

PR #416 added warn-level logging for unknown sort IDs in catalogue items query:

```go
log.Warn().Str("sortId", id).Msg("catalogue items sort: unknown id, skipping")
```

`id` comes from the URL query string (`sorting=[{"id":"..."}]`) — user-controlled. zerolog's JSON encoder escapes the string cleanly, so log-injection in the traditional sense (newline-spoofed log lines) is not possible.

Why this is still worth tracking

  • If logs are aggregated to a downstream system that does its own (looser) parsing — e.g. raw-text grep or a fragile dashboard — attacker-controlled strings could confuse it.
  • Log size: a malicious client could spam very long sortId values.

Proposed mitigation

  • Truncate `id` to a max length (say 128 chars) before logging.
  • Optionally rate-limit warn logs per source IP.

Priority

Low — would only matter under hostile traffic or fragile downstream tooling.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions