Skip to content

Environment-variable handling: debug config dump, retained secret values, and a whitelist listing that treats patterns as names #166

Closed

Description

@jrosskopf

What

Smaller findings from the security review of #164. None is exploitable by an unauthenticated caller and none is caused by that PR; they are grouped so they are not lost.

  1. ConfigManager::loadConfig dumps the whole configuration on a YAML::Exception (src/config_manager.cpp, printConfig() → printYamlNode), at DEBUG level. The node is the post-substitution one, so it prints every scalar verbatim — including any password that came from {{env.X}} — with no redaction. redaction.hpp (isCredentialKey) already exists for exactly this.
  2. ExtendedYamlParser::resolved_variables_ retains every substituted value and is never cleared (mutable, appended on each substitution, copied into every later ParseResult). Nothing outside the parser reads ParseResult::resolved_variables today, so it is latent — but any future logger of it would disclose every secret the parser has ever seen. Clear it per parse, or store names only.
  3. GET /api/v1/_config/environment treats whitelist patterns as variable names (src/config_service.cpp getEnvironmentVariables: getenv(var_name) where var_name is e.g. ^DB_.*). Regex entries just report "unavailable"; exact-name entries return their VALUE to the token holder. Iterate the actual environment keys that match the whitelist instead.
  4. Whitelist regexes are recompiled on every call in both isEnvironmentVariableAllowed implementations (std::regex per pattern per match), and parseTemplateConfig stores patterns without a compile check (only applyEnvironmentPolicy validates). Validate once at load and keep the compiled expressions.
  5. Two comment detectors disagree. Include filtering treats a line whose first non-blank character is # as a comment; the environment pass uses the block-scalar-aware CommentMask. Inside a block scalar they differ (both outcomes happen to be right today). Share one detector, and test ---, | in flow context, tab-indented # and CRLF.
  6. Only the exact form {{env.NAME}} is recognised. {{ env.NAME }}, {{env.NAME }} and ${NAME} stay literal, silently. Not changed in Enforce the environment whitelist for YAML files, failing closed (#157) #164 because {{ env.X }} also appears legitimately in SQL and prompt templates that are handled later; worth a deliberate decision (a warning for likely-intended near-misses in the main config).

Related: #163 (${VAR} docs), and the included-file gap filed alongside this.

Activity

  1. added 5 commits that reference this issue on Sep 29, 2026
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