Skip to content

Substition Formatter won't accept %DOWNSTREAM_PEER_FINGERPRINT_256% or %DOWNSTREAM_PEER_FINGERPRINT_1% #15255

@derekargueta

Description

@derekargueta

Title: Substition Formatter won't accept %DOWNSTREAM_PEER_FINGERPRINT_256% or %DOWNSTREAM_PEER_FINGERPRINT_1%

Description:
Envoy rejects valid commands because the regular expression that it uses to parse the command out doesn't recognize that commands can have integers in them.

Repro steps:
Use the following access_log config:

          access_log:
            - name: envoy.access_loggers.file
              typed_config:
                "@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
                path: /dev/stdout
                log_format:
                  json_format:
                    downstream_peer_fingerprint: '%DOWNSTREAM_PEER_FINGERPRINT_256%'

And envoy will reject it despite being a valid command

./envoy -c config/local.yaml --mode validate
[2021-03-02 00:30:54.087][1180738][info][main] [external/envoy/source/server/server.cc:652] runtime: layers:
  - name: base
    static_layer:
      {}
  - name: admin
    admin_layer:
      {}
[2021-03-02 00:30:54.088][1180738][info][config] [external/envoy/source/server/configuration_impl.cc:125] loading tracing configuration
[2021-03-02 00:30:54.088][1180738][info][config] [external/envoy/source/server/configuration_impl.cc:85] loading 0 static secret(s)
[2021-03-02 00:30:54.088][1180738][info][config] [external/envoy/source/server/configuration_impl.cc:91] loading 1 cluster(s)
[2021-03-02 00:30:54.094][1180738][info][config] [external/envoy/source/server/configuration_impl.cc:95] loading 1 listener(s)
[2021-03-02 00:30:54.115][1180738][critical][main] [external/envoy/source/server/config_validation/server.cc:60] error initializing configuration 'config/local.yaml': Incorrect configuration: %DOWNSTREAM_PEER_FINGERPRINT_256%. Couldn't find valid command at position 0

defined here:

} else if (field_name == "DOWNSTREAM_PEER_FINGERPRINT_256") {

The error comes from here:

if (!std::regex_search(search_space, m, command_w_args_regex)) {
throw EnvoyException(fmt::format(
"Incorrect configuration: {}. Couldn't find valid command at position {}", format, pos));
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions