Skip to content

fix: handle missing generic L7 metadata entries#1964

Open
immanuwell wants to merge 1 commit into
cilium:mainfrom
immanuwell:fix-missing-generic-l7-metadata
Open

fix: handle missing generic L7 metadata entries#1964
immanuwell wants to merge 1 commit into
cilium:mainfrom
immanuwell:fix-missing-generic-l7-metadata

Conversation

@immanuwell

Copy link
Copy Markdown
Contributor

generic l7_proto enforcement in cilium.network assumes dynamicMetadata().filter_metadata()[l7proto] is always there.
when that namespace is missing, onData() hits .at(l7proto_) and throws. not great.

this treats the missing namespace as empty metadata and keeps the policy path running. also adds a small regression test.

repro

  1. configure a generic l7_proto policy with metadata_rule
  2. hit cilium.network::onData() before any filter writes dynamicMetadata().filter_metadata()[l7proto]
  3. current code throws on .at(l7proto_)

note: i couldnt run bazel test //tests:network_filter_test here, local bazel gets stuck earlier on a rules_foreign_cc toolchain bootstrap failure.

@immanuwell immanuwell requested a review from a team as a code owner July 1, 2026 18:44
@immanuwell immanuwell requested a review from nezdolik July 1, 2026 18:44
Comment thread tests/network_filter_test.cc Outdated
@@ -0,0 +1,54 @@
#include <gtest/gtest.h>

#define private public

@nezdolik nezdolik Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed? if you need access to private member fields to validate in test, consider declaring friend peer class, e.g. https://github.com/cilium/proxy/blob/main/cilium/grpc_subscription.h#L67 and then define accessor methods in test file (network_filter_test.cc) like so

class CiliumTestPeer {

Signed-off-by: immanuwell <pchpr.00@list.ru>
@immanuwell immanuwell force-pushed the fix-missing-generic-l7-metadata branch from 403df0e to 228927a Compare July 2, 2026 17:26
@nezdolik

nezdolik commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@immanuwell please fix ci checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants