Skip to content

fix(core): configuration errors log the failing keys, never the values - #465

Merged
fupelaqu merged 1 commit into
mainfrom
fix/config-error-log
Nov 15, 2026
Merged

fupelaqu merged 1 commit into
mainfrom
fix/config-error-log

Conversation

@fupelaqu

@fupelaqu fupelaqu commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When the client or SQL configuration cannot be read, ElasticConfig.apply and ElasticSqlConfig.apply logged the whole error. Typesafe's "bad value" messages quote the value they could not read. For example, a password pasted into elastic.connection-timeout was logged as No number in duration value '<the password>'. Both now log only the keys that failed and the kind of each failure:

Invalid elastic configuration: elastic.connection-timeout (com.typesafe.config.ConfigException$BadValue)

What changes

  • ConfigErrorKeys (sql module, private[elastic]) builds that line from each entry's key path and the throwable's class name, never from a message. It is in sql because core depends on sql, so both configurations share one implementation.
  • ElasticConfig.apply (core, Scala 2.12 and 2.13) and ElasticSqlConfig.apply (sql, Scala 2.12 and 2.13) log through it.
  • The exception thrown to the caller is unchanged. It keeps the library's message, which says what is wrong to the caller who supplied the configuration, for example elastic.schema-cache.ttl must be positive. Only the log line changes.

Verification

  • ElasticConfigErrorLogSpec (new): it sets an all-letters sentinel value in a duration key. It first checks the premise, that the error text quotes the value. Then it captures the real log line and checks that it names the key and not the value. The old log line printed each entry's message, which quotes the value, so it would fail this test (checked by reading, not run).
  • core/testOnly *ElasticConfigErrorLogSpec *SchemaCacheTtlApiSpec *ScrollSettingsSpec *ClientKeySpec: 40 / 0. SchemaCacheTtlApiSpec still sees its … must be positive message, so the exception text is unchanged.
  • sbt "+ core/compile" (2.12.20 and 2.13.16; it compiles sql too): green.
  • headerCheck scalafmtSbtCheck scalafmtCheck test:scalafmtCheck: green.
  • An independent review checked the key format against both configs versions (0.4.4 and 0.6.1). It confirmed that the key path is always present at these call sites, and that no other code depends on the old log wording.

CI run of this PR (head 480366a6, run 43695653050): lint pass (1 min 42 s), sbt compile test pass (41 min), CodeQL pass.

Release note

  • Security: configuration errors no longer write configuration values to the log. The exception message is unchanged.

Recorded, not fixed

  • None.

🤖 Generated with Claude Code

ElasticConfig.apply and ElasticSqlConfig.apply logged the whole configs
ConfigError, and a Typesafe "bad value" message quotes the value it could
not read (`No number in duration value '<value>'`), so a secret set under
the wrong key reached the log. Both now log each failing key and the kind
of failure through one helper (sql ConfigErrorKeys); the exception thrown
to the caller is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fupelaqu
fupelaqu marked this pull request as ready for review November 15, 2026 16:06
@fupelaqu
fupelaqu merged commit f663614 into main Nov 15, 2026
4 checks passed
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