Skip to content

[Security/Privacy] Keep invalid replica configuration values out of startup diagnostics #210

Description

@seonghobae

Buyer / acquisition gap

Protected develop@622e5e6c3d534f230c390f10e3832efadfc01825 includes replica-configuration validators that echo the complete rejected configuration value into thrown startup diagnostics:

throw new IllegalStateException("Invalid host for " + key + ": " + value);
throw new IllegalStateException("Invalid port for " + key + ": " + value);
throw new IllegalStateException("Invalid value for " + key + ": " + value);

ReplicaJdbcTemplateConfig also echoes an invalid REPLICA_HIKARI_INITIALIZATION_FAIL_TIMEOUT_MS value and attaches the NumberFormatException cause. The validated fields are deployment/network/database configuration. A malformed value can contain connection-string fragments, internal host/database names, query material, control characters, or operator-supplied secret-adjacent text even though the accepted grammar is intentionally narrow. Startup/configuration failure evidence needs the configuration key and a stable reason, not the rejected raw value or parser cause.

Status: known_gap. Current open-PR search found no active PR claiming ValidationUtils or ReplicaJdbcTemplateConfig; recheck exact changed paths immediately before any write.

RCA

  • Immediate cause: validation exceptions concatenate the rejected raw input and, for the timeout parser, retain the parse exception as the cause.
  • Technical root cause: validation classification and diagnostic transport are coupled; the value is used as error-display material after validation has already established that it is outside the accepted contract.
  • Control failure: ValidationUtilsTest verifies only that invalid values throw, while ReplicaJdbcTemplateConfigTest verifies only that the timeout key appears in the startup failure. No test asserts confidentiality, bounded output, or control-character exclusion.
  • Security/operability impact: startup errors commonly flow into application logs, container logs, CI diagnostics, deployment events, and support bundles. Echoing rejected configuration expands those channels without improving the remediation instruction.

Bounded remediation

Use strict RED → GREEN on the real validator/configuration boundary:

  1. Keep the configuration key and a stable finite classification such as Invalid host for REPLICA_PGHOST.
  2. Do not include the rejected raw value, query fragments, credential-like text, control characters, parser exception message, or stack-derived details in the ordinary exception message/cause merely for validation reporting.
  3. Preserve all accepted host/port/identifier grammars and trimmed return values.
  4. Preserve the documented -1 Hikari initialization-fail-timeout default and accepted numeric behavior; this slice is diagnostic confidentiality, not a timeout-policy redesign.
  5. Add beginner-readable Javadoc to the public utility methods while touching the class.
  6. Do not implement regex masking; simply do not transport invalid input that the caller does not need.

TDD acceptance

Fail-first tests must inject realistic invalid values containing a credential-bearing JDBC/query fragment and control characters and prove protected source republishes them today. Final acceptance must prove:

  • invalid host, port, and identifier errors name only the stable configuration key/classification and omit the raw input;
  • invalid Hikari timeout startup failure names the configuration key but omits the rejected value and parser diagnostic;
  • null/blank/malformed/range-invalid cases remain fail-closed;
  • all accepted values and trim behavior are unchanged;
  • no secret/host/database value is added to logs, metrics, traces, PR text, or documentation merely for debugging;
  • focused/full CDC tests pass with non-vacuous owned-production coverage under the accepted repository coverage authority;
  • current dependency/SBOM/SAST/security and exact-source/review gates pass before protected integration;
  • canonical Security/Threat Model/Test Strategy/Operability/Traceability reconcile the diagnostic boundary when docs: establish canonical commercial architecture baseline #149/[Documentation] Close canonical architecture coverage and live traceability gaps #159 is safe.

Standards evidence

OWASP's current Logging Cheat Sheet says database connection strings, authentication passwords, access tokens, keys, sensitive personal data, and other higher-classification data should usually not be recorded directly, and notes that internal network names/addresses and file paths can also require special handling. MITRE CWE-532 defines the weakness as inserting sensitive information into log files and recommends avoiding secrets/system details in logs.

References — APA 7

OWASP Foundation. (2026). Logging cheat sheet. OWASP Cheat Sheet Series. https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html

MITRE. (2026). CWE-532: Insertion of sensitive information into log file. Common Weakness Enumeration. https://cwe.mitre.org/data/definitions/532.html

Relationships: #159 canonical documentation; #182 production-safe observability defaults; #170#176 CDC/connector diagnostic-confidentiality controls; #196 security-evidence completeness.

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