Skip to content

fix: use TextFormat for message-valued CEL attributes (restore pre-1.37 behavior under Protobuf 30+)#43508

Merged
wbpcode merged 7 commits into
envoyproxy:mainfrom
zhaohuabing:fix-43466
Mar 2, 2026
Merged

fix: use TextFormat for message-valued CEL attributes (restore pre-1.37 behavior under Protobuf 30+)#43508
wbpcode merged 7 commits into
envoyproxy:mainfrom
zhaohuabing:fix-43466

Conversation

@zhaohuabing
Copy link
Copy Markdown
Member

@zhaohuabing zhaohuabing commented Feb 16, 2026

Commit Message:

Envoy 1.37.0 updated protobuf from 29.3 to 33.2. That dependency change altered debug-string output semantics and broke behavior that worked in 1.36.x for ext_proc consumers parsing xds.virtual_host_metadata.

This behavior change was introduced in #42435 and #42827.

This PR switches message serialization from debug-string APIs to protobuf text-format APIs so message-valued CEL attributes are machine-parseable again, as recommended by protobuf programming guides. https://protobuf.dev/programming-guides/deserialize-debug

What broke in 1.37.0

  • In both 1.36.x and 1.37.0, message-valued CEL results were stringified via ShortDebugString().
  • In 1.36.x (protobuf 29.3), that output was parseable.
  • In 1.37.0 (protobuf 33.2), debug strings are now prefixed with goo.gle/debugonly / goo.gle/debugstr, which is intentionally non-parseable as textproto.
  • Result: ext_proc implementations that parse xds.virtual_host_metadata as textproto started failing after upgrading to 1.37.0.

Note: xds metadata attributes in ext_proc requests are not diagnostic log fields; they are machine-to-machine payload data consumed by external processors. External processors parse these values to make policy and routing decisions, so serialization must be stable and machine-readable by standard protobuf tooling. DebugString is a diagnostic format with no compatibility contract, and in protobuf 30+ it may include goo.gle/debug... prefixes that intentionally break parsing. For this path, protobuf TextFormat is the correct format, not debug serialization.

Example

Given virtual host metadata:

  {
    "metadata": {
      "filterMetadata": {
        "envoy-gateway": {
          "resources": [
            {
              "kind": "Gateway",
              "name": "eg",
              "namespace": "default",
              "sectionName": "http"
            }
          ]
        }
      }
    }
  }

Before (1.37.0 + protobuf 30+ path), ext_proc may receive:

goo.gle/debugonly filter_metadata { key: "envoy-gateway" value { ... } }

Parsing fails at token 1.

After this PR:

filter_metadata { key: "envoy-gateway" value { ... } }

This is protobuf text format and parses via TextFormat::ParseFromString(...).

Compatibility notes

  • This restores 1.36.x-like effective behavior for ext_proc users (parseable metadata strings), while using the correct serialization API.
  • Minor formatting differences vs 1.36.x debug output are possible (whitespace/order), but output is now stable machine-readable textproto.
  • Scope includes other call sites using Expr::print(...) for message-valued CEL results (for example rate-limit descriptor CEL stringification).

Additional Description:
Risk Level: low
Testing: unit and integration test
Docs Changes:
Release Notes: yes
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #43466]
[Optional Deprecated:]
[Optional API Considerations:]

@zhaohuabing zhaohuabing marked this pull request as draft February 16, 2026 06:32
@zhaohuabing zhaohuabing force-pushed the fix-43466 branch 4 times, most recently from 9a10b0b to 651180a Compare February 16, 2026 07:54
@zhaohuabing zhaohuabing marked this pull request as ready for review February 16, 2026 07:54
@zhaohuabing
Copy link
Copy Markdown
Member Author

zhaohuabing commented Feb 16, 2026

Could we cherry-pick this into v1.37.1?
It breaks existing ext proc filters for Envoy Gateway users.

@zhaohuabing zhaohuabing changed the title fix: message-valued CEL attributes have a goo.gle/debugonly prefix fix: use TextFormat for message-valued CEL attributes (restore pre-1.37 behavior under Protobuf 30+) Feb 16, 2026
@zhaohuabing zhaohuabing marked this pull request as draft February 16, 2026 08:11
@zhaohuabing zhaohuabing marked this pull request as ready for review February 16, 2026 09:45
@wbpcode
Copy link
Copy Markdown
Member

wbpcode commented Feb 18, 2026

Could we add a runtime guard with default value to true?
Although ideally this is unnecessary because the behavior has been broken by the deps upgrading. But anyway the broken behavior is part of released 1.37, it would be better add a guard, and it's simple and harmless

@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #43508 was synchronize by zhaohuabing.

see: more, trace.

@zhaohuabing zhaohuabing force-pushed the fix-43466 branch 3 times, most recently from 3e06f0f to 86b71dd Compare February 19, 2026 13:08
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
wbpcode
wbpcode previously approved these changes Feb 22, 2026
Copy link
Copy Markdown
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for this contribution.

@yanjunxiang-google
Copy link
Copy Markdown
Contributor

yanjunxiang-google commented Feb 23, 2026

Please fix CI errors. Otherwise LGTM

}
std::string textproto;
Protobuf::TextFormat::Printer printer;
printer.SetSingleLineMode(true);
Copy link
Copy Markdown
Contributor

@yanjunxiang-google yanjunxiang-google Feb 23, 2026

Choose a reason for hiding this comment

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

Is SingleLineMode preferred here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, prefer SignleLineMode here because:

  • It keeps one line, avoids embedding \n into the values.
  • It also stays closer to previous behavior from ShortDebugString().

@zhaohuabing
Copy link
Copy Markdown
Member Author

Hi @wbpcode @yanjunxiang-google The CI errors seem not related to this PR, and merging with main didn't fix it.

@yanjunxiang-google
Copy link
Copy Markdown
Contributor

@zhaohuabing Please merge main again and see whether the CI error disappear!

@zhaohuabing
Copy link
Copy Markdown
Member Author

/retest

1 similar comment
@zhaohuabing
Copy link
Copy Markdown
Member Author

/retest

@zhaohuabing
Copy link
Copy Markdown
Member Author

/retest

@yanjunxiang-google
Copy link
Copy Markdown
Contributor

LGTM

Copy link
Copy Markdown
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@wbpcode wbpcode merged commit 697e419 into envoyproxy:main Mar 2, 2026
28 checks passed
@zhaohuabing zhaohuabing deleted the fix-43466 branch March 2, 2026 04:41
zhaohuabing added a commit to zhaohuabing/envoy that referenced this pull request Mar 2, 2026
…37 behavior under Protobuf 30+) (envoyproxy#43508)

Commit Message:

Envoy 1.37.0 updated protobuf from 29.3 to 33.2. That dependency change
altered debug-string output semantics and broke behavior that worked in
1.36.x for ext_proc consumers parsing `xds.virtual_host_metadata`.

This behavior change was introduced in envoyproxy#42435 and envoyproxy#42827.

This PR switches message serialization from debug-string APIs to
protobuf text-format APIs so message-valued CEL attributes are
machine-parseable again, as recommended by protobuf programming guides.
https://protobuf.dev/programming-guides/deserialize-debug

 **What broke in 1.37.0**

- In both 1.36.x and 1.37.0, message-valued CEL results were stringified
via ShortDebugString().
  - In 1.36.x (protobuf 29.3), that output was parseable.
- In 1.37.0 (protobuf 33.2), debug strings are now prefixed with
`goo.gle/debugonly` / `goo.gle/debugstr`, which is intentionally
non-parseable as textproto.
- Result: ext_proc implementations that parse
`xds.virtual_host_metadata` as textproto started failing after upgrading
to 1.37.0.

**Note**: xds metadata attributes in ext_proc requests are **not
diagnostic log fields**; they are machine-to-machine payload data
consumed by external processors. External processors parse these values
to make policy and routing decisions, so serialization must be stable
and machine-readable by standard protobuf tooling. `DebugString` is a
diagnostic format with no compatibility contract, and in protobuf 30+ it
may include `goo.gle/debug...` prefixes that intentionally break
parsing. For this path, protobuf `TextFormat` is the correct format, not
debug serialization.

**Example**

  Given virtual host metadata:

```yaml
  {
    "metadata": {
      "filterMetadata": {
        "envoy-gateway": {
          "resources": [
            {
              "kind": "Gateway",
              "name": "eg",
              "namespace": "default",
              "sectionName": "http"
            }
          ]
        }
      }
    }
  }
 ```

  Before (1.37.0 + protobuf 30+ path), ext_proc may receive:

`goo.gle/debugonly  filter_metadata { key: "envoy-gateway" value { ... } }`

  Parsing fails at token 1.

  After this PR:

`filter_metadata { key: "envoy-gateway" value { ... } }`

This is protobuf text format and parses via TextFormat::ParseFromString(...).

**Compatibility notes**

  - This restores 1.36.x-like effective behavior for ext_proc users (parseable metadata strings), while using the correct serialization API.
  - Minor formatting differences vs 1.36.x debug output are possible (whitespace/order), but output is now stable machine-readable textproto.
  - Scope includes other call sites using Expr::print(...) for message-valued CEL results (for example rate-limit descriptor CEL stringification).

Additional Description:
Risk Level: low
Testing: unit and integration test
Docs Changes:
Release Notes: yes
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit envoyproxy#43466]
[Optional Deprecated:]
[Optional [API Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

---------

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
(cherry picked from commit 697e419)
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
phlax pushed a commit that referenced this pull request Mar 2, 2026
…37 behavior under Protobuf 30+) (#43508)

Commit Message:

Envoy 1.37.0 updated protobuf from 29.3 to 33.2. That dependency change
altered debug-string output semantics and broke behavior that worked in
1.36.x for ext_proc consumers parsing `xds.virtual_host_metadata`.

This behavior change was introduced in #42435 and #42827.

This PR switches message serialization from debug-string APIs to
protobuf text-format APIs so message-valued CEL attributes are
machine-parseable again, as recommended by protobuf programming guides.
https://protobuf.dev/programming-guides/deserialize-debug

 **What broke in 1.37.0**

- In both 1.36.x and 1.37.0, message-valued CEL results were stringified
via ShortDebugString().
  - In 1.36.x (protobuf 29.3), that output was parseable.
- In 1.37.0 (protobuf 33.2), debug strings are now prefixed with
`goo.gle/debugonly` / `goo.gle/debugstr`, which is intentionally
non-parseable as textproto.
- Result: ext_proc implementations that parse
`xds.virtual_host_metadata` as textproto started failing after upgrading
to 1.37.0.

**Note**: xds metadata attributes in ext_proc requests are **not
diagnostic log fields**; they are machine-to-machine payload data
consumed by external processors. External processors parse these values
to make policy and routing decisions, so serialization must be stable
and machine-readable by standard protobuf tooling. `DebugString` is a
diagnostic format with no compatibility contract, and in protobuf 30+ it
may include `goo.gle/debug...` prefixes that intentionally break
parsing. For this path, protobuf `TextFormat` is the correct format, not
debug serialization.

**Example**

  Given virtual host metadata:

```yaml
  {
    "metadata": {
      "filterMetadata": {
        "envoy-gateway": {
          "resources": [
            {
              "kind": "Gateway",
              "name": "eg",
              "namespace": "default",
              "sectionName": "http"
            }
          ]
        }
      }
    }
  }
 ```

  Before (1.37.0 + protobuf 30+ path), ext_proc may receive:

`goo.gle/debugonly  filter_metadata { key: "envoy-gateway" value { ... } }`

  Parsing fails at token 1.

  After this PR:

`filter_metadata { key: "envoy-gateway" value { ... } }`

This is protobuf text format and parses via TextFormat::ParseFromString(...).

**Compatibility notes**

  - This restores 1.36.x-like effective behavior for ext_proc users (parseable metadata strings), while using the correct serialization API.
  - Minor formatting differences vs 1.36.x debug output are possible (whitespace/order), but output is now stable machine-readable textproto.
  - Scope includes other call sites using Expr::print(...) for message-valued CEL results (for example rate-limit descriptor CEL stringification).

Additional Description:
Risk Level: low
Testing: unit and integration test
Docs Changes:
Release Notes: yes
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #43466]
[Optional Deprecated:]
[Optional [API Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

---------

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
(cherry picked from commit 697e419)
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
bmjask pushed a commit to bmjask/envoy that referenced this pull request Mar 14, 2026
…37 behavior under Protobuf 30+) (envoyproxy#43508)

Commit Message:

Envoy 1.37.0 updated protobuf from 29.3 to 33.2. That dependency change
altered debug-string output semantics and broke behavior that worked in
1.36.x for ext_proc consumers parsing `xds.virtual_host_metadata`.

This behavior change was introduced in envoyproxy#42435 and envoyproxy#42827.

This PR switches message serialization from debug-string APIs to
protobuf text-format APIs so message-valued CEL attributes are
machine-parseable again, as recommended by protobuf programming guides.
https://protobuf.dev/programming-guides/deserialize-debug

 **What broke in 1.37.0**

- In both 1.36.x and 1.37.0, message-valued CEL results were stringified
via ShortDebugString().
  - In 1.36.x (protobuf 29.3), that output was parseable.
- In 1.37.0 (protobuf 33.2), debug strings are now prefixed with
`goo.gle/debugonly` / `goo.gle/debugstr`, which is intentionally
non-parseable as textproto.
- Result: ext_proc implementations that parse
`xds.virtual_host_metadata` as textproto started failing after upgrading
to 1.37.0.

**Note**: xds metadata attributes in ext_proc requests are **not
diagnostic log fields**; they are machine-to-machine payload data
consumed by external processors. External processors parse these values
to make policy and routing decisions, so serialization must be stable
and machine-readable by standard protobuf tooling. `DebugString` is a
diagnostic format with no compatibility contract, and in protobuf 30+ it
may include `goo.gle/debug...` prefixes that intentionally break
parsing. For this path, protobuf `TextFormat` is the correct format, not
debug serialization.

**Example**

  Given virtual host metadata:

```yaml
  {
    "metadata": {
      "filterMetadata": {
        "envoy-gateway": {
          "resources": [
            {
              "kind": "Gateway",
              "name": "eg",
              "namespace": "default",
              "sectionName": "http"
            }
          ]
        }
      }
    }
  }
 ```

  Before (1.37.0 + protobuf 30+ path), ext_proc may receive:

`goo.gle/debugonly  filter_metadata { key: "envoy-gateway" value { ... } }`

  Parsing fails at token 1.

  After this PR:

`filter_metadata { key: "envoy-gateway" value { ... } }`

This is protobuf text format and parses via TextFormat::ParseFromString(...).

**Compatibility notes**

  - This restores 1.36.x-like effective behavior for ext_proc users (parseable metadata strings), while using the correct serialization API.
  - Minor formatting differences vs 1.36.x debug output are possible (whitespace/order), but output is now stable machine-readable textproto.
  - Scope includes other call sites using Expr::print(...) for message-valued CEL results (for example rate-limit descriptor CEL stringification).

Additional Description:
Risk Level: low
Testing: unit and integration test
Docs Changes:
Release Notes: yes
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit envoyproxy#43466]
[Optional Deprecated:]
[Optional [API Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

---------

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: bjmask <11672696+bjmask@users.noreply.github.com>
bvandewalle pushed a commit to bvandewalle/envoy that referenced this pull request Mar 17, 2026
…37 behavior under Protobuf 30+) (envoyproxy#43508)

Commit Message:

Envoy 1.37.0 updated protobuf from 29.3 to 33.2. That dependency change
altered debug-string output semantics and broke behavior that worked in
1.36.x for ext_proc consumers parsing `xds.virtual_host_metadata`.

This behavior change was introduced in envoyproxy#42435 and envoyproxy#42827.

This PR switches message serialization from debug-string APIs to
protobuf text-format APIs so message-valued CEL attributes are
machine-parseable again, as recommended by protobuf programming guides.
https://protobuf.dev/programming-guides/deserialize-debug

 **What broke in 1.37.0**

- In both 1.36.x and 1.37.0, message-valued CEL results were stringified
via ShortDebugString().
  - In 1.36.x (protobuf 29.3), that output was parseable.
- In 1.37.0 (protobuf 33.2), debug strings are now prefixed with
`goo.gle/debugonly` / `goo.gle/debugstr`, which is intentionally
non-parseable as textproto.
- Result: ext_proc implementations that parse
`xds.virtual_host_metadata` as textproto started failing after upgrading
to 1.37.0.
  
**Note**: xds metadata attributes in ext_proc requests are **not
diagnostic log fields**; they are machine-to-machine payload data
consumed by external processors. External processors parse these values
to make policy and routing decisions, so serialization must be stable
and machine-readable by standard protobuf tooling. `DebugString` is a
diagnostic format with no compatibility contract, and in protobuf 30+ it
may include `goo.gle/debug...` prefixes that intentionally break
parsing. For this path, protobuf `TextFormat` is the correct format, not
debug serialization.


**Example**

  Given virtual host metadata:

```yaml
  {
    "metadata": {
      "filterMetadata": {
        "envoy-gateway": {
          "resources": [
            {
              "kind": "Gateway",
              "name": "eg",
              "namespace": "default",
              "sectionName": "http"
            }
          ]
        }
      }
    }
  }
 ```

  Before (1.37.0 + protobuf 30+ path), ext_proc may receive:

`goo.gle/debugonly  filter_metadata { key: "envoy-gateway" value { ... } }`

  Parsing fails at token 1.

  After this PR:

`filter_metadata { key: "envoy-gateway" value { ... } }`

This is protobuf text format and parses via TextFormat::ParseFromString(...).

**Compatibility notes**

  - This restores 1.36.x-like effective behavior for ext_proc users (parseable metadata strings), while using the correct serialization API.
  - Minor formatting differences vs 1.36.x debug output are possible (whitespace/order), but output is now stable machine-readable textproto.
  - Scope includes other call sites using Expr::print(...) for message-valued CEL results (for example rate-limit descriptor CEL stringification).
  
Additional Description:
Risk Level: low
Testing: unit and integration test
Docs Changes:
Release Notes: yes
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit envoyproxy#43466]
[Optional Deprecated:]
[Optional [API Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

---------

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
fishcakez pushed a commit to fishcakez/envoy that referenced this pull request Mar 25, 2026
…37 behavior under Protobuf 30+) (envoyproxy#43508)

Commit Message:

Envoy 1.37.0 updated protobuf from 29.3 to 33.2. That dependency change
altered debug-string output semantics and broke behavior that worked in
1.36.x for ext_proc consumers parsing `xds.virtual_host_metadata`.

This behavior change was introduced in envoyproxy#42435 and envoyproxy#42827.

This PR switches message serialization from debug-string APIs to
protobuf text-format APIs so message-valued CEL attributes are
machine-parseable again, as recommended by protobuf programming guides.
https://protobuf.dev/programming-guides/deserialize-debug

 **What broke in 1.37.0**

- In both 1.36.x and 1.37.0, message-valued CEL results were stringified
via ShortDebugString().
  - In 1.36.x (protobuf 29.3), that output was parseable.
- In 1.37.0 (protobuf 33.2), debug strings are now prefixed with
`goo.gle/debugonly` / `goo.gle/debugstr`, which is intentionally
non-parseable as textproto.
- Result: ext_proc implementations that parse
`xds.virtual_host_metadata` as textproto started failing after upgrading
to 1.37.0.
  
**Note**: xds metadata attributes in ext_proc requests are **not
diagnostic log fields**; they are machine-to-machine payload data
consumed by external processors. External processors parse these values
to make policy and routing decisions, so serialization must be stable
and machine-readable by standard protobuf tooling. `DebugString` is a
diagnostic format with no compatibility contract, and in protobuf 30+ it
may include `goo.gle/debug...` prefixes that intentionally break
parsing. For this path, protobuf `TextFormat` is the correct format, not
debug serialization.


**Example**

  Given virtual host metadata:

```yaml
  {
    "metadata": {
      "filterMetadata": {
        "envoy-gateway": {
          "resources": [
            {
              "kind": "Gateway",
              "name": "eg",
              "namespace": "default",
              "sectionName": "http"
            }
          ]
        }
      }
    }
  }
 ```

  Before (1.37.0 + protobuf 30+ path), ext_proc may receive:

`goo.gle/debugonly  filter_metadata { key: "envoy-gateway" value { ... } }`

  Parsing fails at token 1.

  After this PR:

`filter_metadata { key: "envoy-gateway" value { ... } }`

This is protobuf text format and parses via TextFormat::ParseFromString(...).

**Compatibility notes**

  - This restores 1.36.x-like effective behavior for ext_proc users (parseable metadata strings), while using the correct serialization API.
  - Minor formatting differences vs 1.36.x debug output are possible (whitespace/order), but output is now stable machine-readable textproto.
  - Scope includes other call sites using Expr::print(...) for message-valued CEL results (for example rate-limit descriptor CEL stringification).
  
Additional Description:
Risk Level: low
Testing: unit and integration test
Docs Changes:
Release Notes: yes
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit envoyproxy#43466]
[Optional Deprecated:]
[Optional [API Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

---------

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
krinkinmu pushed a commit to grnmeira/envoy that referenced this pull request Apr 20, 2026
…37 behavior under Protobuf 30+) (envoyproxy#43508)

Commit Message:

Envoy 1.37.0 updated protobuf from 29.3 to 33.2. That dependency change
altered debug-string output semantics and broke behavior that worked in
1.36.x for ext_proc consumers parsing `xds.virtual_host_metadata`.

This behavior change was introduced in envoyproxy#42435 and envoyproxy#42827.

This PR switches message serialization from debug-string APIs to
protobuf text-format APIs so message-valued CEL attributes are
machine-parseable again, as recommended by protobuf programming guides.
https://protobuf.dev/programming-guides/deserialize-debug

 **What broke in 1.37.0**

- In both 1.36.x and 1.37.0, message-valued CEL results were stringified
via ShortDebugString().
  - In 1.36.x (protobuf 29.3), that output was parseable.
- In 1.37.0 (protobuf 33.2), debug strings are now prefixed with
`goo.gle/debugonly` / `goo.gle/debugstr`, which is intentionally
non-parseable as textproto.
- Result: ext_proc implementations that parse
`xds.virtual_host_metadata` as textproto started failing after upgrading
to 1.37.0.
  
**Note**: xds metadata attributes in ext_proc requests are **not
diagnostic log fields**; they are machine-to-machine payload data
consumed by external processors. External processors parse these values
to make policy and routing decisions, so serialization must be stable
and machine-readable by standard protobuf tooling. `DebugString` is a
diagnostic format with no compatibility contract, and in protobuf 30+ it
may include `goo.gle/debug...` prefixes that intentionally break
parsing. For this path, protobuf `TextFormat` is the correct format, not
debug serialization.


**Example**

  Given virtual host metadata:

```yaml
  {
    "metadata": {
      "filterMetadata": {
        "envoy-gateway": {
          "resources": [
            {
              "kind": "Gateway",
              "name": "eg",
              "namespace": "default",
              "sectionName": "http"
            }
          ]
        }
      }
    }
  }
 ```

  Before (1.37.0 + protobuf 30+ path), ext_proc may receive:

`goo.gle/debugonly  filter_metadata { key: "envoy-gateway" value { ... } }`

  Parsing fails at token 1.

  After this PR:

`filter_metadata { key: "envoy-gateway" value { ... } }`

This is protobuf text format and parses via TextFormat::ParseFromString(...).

**Compatibility notes**

  - This restores 1.36.x-like effective behavior for ext_proc users (parseable metadata strings), while using the correct serialization API.
  - Minor formatting differences vs 1.36.x debug output are possible (whitespace/order), but output is now stable machine-readable textproto.
  - Scope includes other call sites using Expr::print(...) for message-valued CEL results (for example rate-limit descriptor CEL stringification).
  
Additional Description:
Risk Level: low
Testing: unit and integration test
Docs Changes:
Release Notes: yes
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit envoyproxy#43466]
[Optional Deprecated:]
[Optional [API Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

---------

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
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.

3 participants