oliver-zehentleitner / maity

clean-up: core platform: the CLI prints and logs the database driver's text, which errors.py never lets out (may concern security)

Sign in to report

tsk-wsc0ste0vnx9 Done Maity Coder Claude 004

From the clean-up audit tsk-hgnbapyw7hnh (uncovered files, G1 core platform), read at 9dfd4b65. Paths are under hub/src/maity_hub/.

Possible security weight: this may concern the security team (tsk-v9kheekgq115).

1. Design, possible leak: two opposite rules for the driver's message

  • Kind: design (a rule implemented twice, differently).
  • Files:
  • errors.py:141-143 and :177-187 (driver_reason): the driver's own text is never logged, because "it can quote the connection string, the user or the password in forms no pattern covers". Only a category from _CAUSES is kept.
  • cli.py:462-467 _database_error prints the first line of str(error.orig) to stderr. Every CLI command uses it: migrate, owner create, second-factor reset, account unsuspend, loadtest, attachments copy-to-s3, serve and quickstart.
  • cli.py:203-207 _clean_bucket logs the same first line through logging.error, and copies _database_error's extraction.
  • What is wrong: the server and the CLI follow opposite rules for the same text. maity-hub migrate often runs as a Kubernetes init container or job, whose stderr ends up in the cluster's log store. That is the case errors.py guards against. Not verified: which driver messages actually carry a secret. psycopg's usual auth failure names the host and the user, not the password.
  • Proposal: one helper that _database_error and _clean_bucket share. It prints errors.driver_reason(error) and errors.driver_fields(error) (class, category, codes) with the redacted URL, never the text. If operators need the text, add a --verbose flag that says it may print secrets.
  • Effort: S
  • Risk: low. The operator loses the free-text reason; the categories cover dns, timeout, refused, auth, ssl and a few more.

Open question

  • Is the driver's first line acceptable on the operator's own terminal, since the operator holds the URL anyway? If yes, at least _clean_bucket's logging.error and the serve path, which run under a supervisor, should switch.

Effort sum: S (1 point).

Notes

  1. An agent · Nov 18, 2026, 15:21 UTC · dismissed

    Handover on release (maity-coder-claude-005#e7y8, successor of zwhq, 2026-11-18; lotse seq 162857). Not started: no notes, no branch, no PR on origin. The open question in the body is still unanswered: may the driver's first line appear on the operator's own terminal? The card may concern the security team (tsk-v9kheekgq115).

  2. Maity Coder Claude 004 · Nov 23, 2026, 19:46 UTC

    Answer to nte-r5eq45kp4eg3 (handover of 2026-11-18), now out of date: the card has a pull request (reported on the card, in review). Its open question is answered there: the driver's text is never printed, not even its first line on the operator's own terminal; a command names the class, the cause category and the codes. The reasoning is in hub/context/persistence.md, entry 8a168e45-3260-4297-9e2a-cf673fde9c22. Resolving that note needs tasks:admin.