Skip to content

Bug: Missing Access Log UAEX flag for ext-authz denied requests #18964

Closed

Description

@pims

Title: Missing Access Log UAEX flag for ext-authz denied requests

Description:

When upgrading from Envoy 1.14.X to newer versions, the UAEX Access Log flag is no longer present.

We would expect logs to show:

[2021-11-10T17:49:25.117Z] "GET / HTTP/1.1" 401 UAEX 0 46 2 - "-" "curl/7.78.0" "b8837414-03e2-44c2-985a-9ea679f57183" "example.com:8443" "-"

but instead we see -:

[2021-11-10 09:49:25.119][4652345][trace][ext_authz] [external/envoy/source/extensions/filters/common/ext_authz/ext_authz_grpc_impl.cc:52] Received CheckResponse: status {
  code: 16
}
denied_response {
  status {
    code: Unauthorized
  }
  body: "Authorization Header malformed or not provided"
}

[2021-11-10 09:49:25.119][4652345][trace][filter] [external/envoy/source/extensions/filters/http/ext_authz/ext_authz.cc:237] [C6][S1434089409734892564] ext_authz filter rejected the request. Response status code: '401
[2021-11-10 09:49:25.119][4652345][trace][filter] [external/envoy/source/extensions/filters/http/ext_authz/ext_authz.cc:261] [C6][S1434089409734892564] ext_authz filter added header(s) to the local response:
[2021-11-10T17:49:25.117Z] "GET / HTTP/1.1" 401 - 0 46 2 - "-" "curl/7.78.0" "b8837414-03e2-44c2-985a-9ea679f57183" "example.com:8443" "-"

Repro:

The bug was introduced in b0c3683

Config:

admin:
  access_log_path: /dev/null
  address:
    socket_address:
      address: 127.0.0.1
      port_value: 9001
node:
  cluster: foo
  id: test-id

static_resources:
  listeners:
  - listener_filters:
    - name: "envoy.filters.listener.tls_inspector"
      typed_config: {}
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 8443
    filter_chains:
    - filter_chain_match:
        server_names: ["example.com", "www.example.com"]
      transport_socket:
        name: envoy.transport_sockets.tls
        typed_config:
          "@type": type.googleapis.com/envoy.api.v2.auth.DownstreamTlsContext
          common_tls_context:
            validation_context:
              trusted_ca:
                filename: "/etc/envoy/certs/out/myCA.crt"
            tls_certificates:
            - certificate_chain: { filename: "/etc/envoy/certs/out/example.com.crt" }
              private_key: { filename: "/etc/envoy/certs/out/example.com.key" }
      filters:
      - name: envoy.http_connection_manager
        typed_config:  
          "@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
          stat_prefix: ingress_http
          codec_type: AUTO
          access_log: # configure logging
            name: envoy.file_access_log
            config:
              path: /dev/stdout
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains: ["*"]
              routes:
              - match:
                  prefix: "/"
                route:
                  cluster: service_backend
                per_filter_config:
                  envoy.ext_authz:
                    check_settings:
                      context_extensions:
                        foo: bar
          http_filters: 
          - name: envoy.ext_authz
            config:
              failure_mode_allow: false
              grpc_service:
                envoy_grpc:
                  cluster_name: ext-authz
                timeout: 0.5s
          - name: envoy.router

  clusters:
  - name: service_backend
    connect_timeout: 2s
    type: STRICT_DNS
    dns_lookup_family: V4_ONLY
    lb_policy: ROUND_ROBIN
    hosts:
    - socket_address:
        address: host.docker.internal
        port_value: 11000
  - name: ext-authz
    type: STRICT_DNS
    http2_protocol_options: {}
    load_assignment:
      cluster_name: ext-authz
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: host.docker.internal
                port_value: 50050
    connect_timeout: 0.25s

Logs:

[2021-11-10 09:49:25.117][4652345][trace][filter] [external/envoy/source/extensions/filters/http/ext_authz/ext_authz.cc:69] [C6][S1434089409734892564] ext_authz filter calling authorization server
[2021-11-10 09:49:25.118][4652345][trace][ext_authz] [external/envoy/source/extensions/filters/common/ext_authz/ext_authz_grpc_impl.cc:45] Sending CheckRequest: attributes {
  source {
    address {
      socket_address {
        address: "127.0.0.1"
        port_value: 65230
      }
    }
  }
  destination {
    address {
      socket_address {
        address: "127.0.0.1"
        port_value: 8443
      }
    }
    principal: "www.example.com"
  }
  request {
    time {
      seconds: 1636566565
      nanos: 117749000
    }
    http {
      id: "1434089409734892564"
      method: "GET"
      headers {
        key: ":authority"
        value: "example.com:8443"
      }
      headers {
        key: ":method"
        value: "GET"
      }
      headers {
        key: ":path"
        value: "/"
      }
      headers {
        key: "accept"
        value: "*/*"
      }
      headers {
        key: "user-agent"
        value: "curl/7.78.0"
      }
      headers {
        key: "x-forwarded-proto"
        value: "https"
      }
      headers {
        key: "x-request-id"
        value: "b8837414-03e2-44c2-985a-9ea679f57183"
      }
      path: "/"
      host: "example.com:8443"
      protocol: "HTTP/1.1"
    }
  }
  context_extensions {
    key: "foo"
    value: "bar"
  }
  metadata_context {
  }
}

[2021-11-10 09:49:25.119][4652345][trace][ext_authz] [external/envoy/source/extensions/filters/common/ext_authz/ext_authz_grpc_impl.cc:52] Received CheckResponse: status {
  code: 16
}
denied_response {
  status {
    code: Unauthorized
  }
  body: "Authorization Header malformed or not provided"
}

[2021-11-10 09:49:25.119][4652345][trace][filter] [external/envoy/source/extensions/filters/http/ext_authz/ext_authz.cc:237] [C6][S1434089409734892564] ext_authz filter rejected the request. Response status code: '401
[2021-11-10 09:49:25.119][4652345][trace][filter] [external/envoy/source/extensions/filters/http/ext_authz/ext_authz.cc:261] [C6][S1434089409734892564] ext_authz filter added header(s) to the local response:
[2021-11-10T17:49:25.117Z] "GET / HTTP/1.1" 401 - 0 46 2 - "-" "curl/7.78.0" "b8837414-03e2-44c2-985a-9ea679f57183" "example.com:8443" "-"

Activity

  1. added
    triage
    on Nov 10, 2021
  2. pims commented on Nov 10, 2021

    @pims
    ContributorAuthor

    PR with the bug fix here #18965

  3. added and removed
    triage
    on Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions