Skip to content

l7policy: guard null upstream socket addresses when encoding local replies #2063

Open

Description

@veshant

Summary

In Cilium::AccessFilter::encodeHeaders, the connection-close handling checks that stream_info.upstreamInfo() exists, then dereferences upstreamRemoteAddress() and upstreamLocalAddress() without checking those address pointers. Upstream information can exist before an upstream socket has been established, leaving its socket addresses null.

The affected address comparison is present on current main.

Synthetic filter-level reproduction

  1. Construct a downstream AccessFilter with a valid downstream connection and HTTP/1.1 stream.
  2. Set upstream info to a default-constructed StreamInfo::UpstreamInfoImpl, leaving its local and remote socket addresses null.
  3. Call encodeHeaders with :status: 503 and connection: close.

The current code enters the same-tuple comparison and dereferences a null upstream address. The same problem exists when only one of the upstream addresses is missing.

Expected behavior

The filter should continue encoding the local response without performing the socket-tuple comparison when addresses are unavailable. When all addresses are present and the tuples match, it should retain the existing downstream connection-drain behavior.

I am preparing a PR with the address guard and synthetic unit cases. Local C++ validation remains pending because the available Docker builder failed before compilation.

Activity

  1. veshant commented on Oct 5, 2026

    @veshant
    Author

    Update: #2064 is ready for review. It adds guards for absent upstream socket addresses and regression cases covering missing, matching, and nonmatching addresses. The upstream unit and integration workflows are awaiting maintainer approval.

  2. self-assigned this
    on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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