Skip to content

fix: enforce maxRecvMsgSize and maxCompressedMsgSize for OTLP - #20312

Merged
shantanualsi merged 8 commits into
mainfrom
jnewbigin/otlp-unbounded-reads
Jan 19, 2026
Merged

fix: enforce maxRecvMsgSize and maxCompressedMsgSize for OTLP#20312
shantanualsi merged 8 commits into
mainfrom
jnewbigin/otlp-unbounded-reads

Conversation

@jnewbigin

@jnewbigin jnewbigin commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The compressed payloads were not validated against any maximum size limit

The reporting of the raw payload exceeding the maximum was also ineffective.

This patch ensures that:

  • the maxRecvMsgSize is tested regardless of read error status and
  • that compressed data does not exceed 10:1 compression ratio

Edit (shantanu):
Modified the hard-coded compression ratio of 10:1 to a configurable absolute "max decompressed size" as ratio can be hard to reason about.

Which issue(s) this PR fixes:
0

Special notes for your reviewer:

The expanded test coverage found that maxRecvMsgSize was not being reported as an error, though the data was being truncated at the limit. This probably caused other errors about invalid payloads.

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR
The compressed payloads were not validated against any maximum size limit

The validation of the raw payload was also ineffective.

This patch ensures that the maxRecvMsgSize is tested regardless of read error status
and ensure that compressed data does not exceed 10:1 compression ratio.
@jnewbigin
jnewbigin force-pushed the jnewbigin/otlp-unbounded-reads branch from 2d16727 to 39ad6d2 Compare January 7, 2026 04:36
@github-actions

github-actions Bot commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

💻 Deploy preview deleted (fix: enforce maxRecvMsgSize and maxCompressedMsgSize for OTLP).

@shantanualsi
shantanualsi marked this pull request as ready for review January 15, 2026 12:56
@shantanualsi
shantanualsi requested a review from a team as a code owner January 15, 2026 12:56
@shantanualsi
shantanualsi merged commit fc270fd into main Jan 19, 2026
73 checks passed
@shantanualsi
shantanualsi deleted the jnewbigin/otlp-unbounded-reads branch January 19, 2026 07:37
shantanualsi added a commit that referenced this pull request Jan 19, 2026
Co-authored-by: shantanualshi <shantanu.alshi@grafana.com>
shantanualsi added a commit that referenced this pull request Jan 19, 2026
#20487)

Co-authored-by: John Newbigin <john.newbigin@grafana.com>
@Segflow
Segflow restored the jnewbigin/otlp-unbounded-reads branch January 19, 2026 09:09
@Segflow
Segflow deleted the jnewbigin/otlp-unbounded-reads branch January 19, 2026 09:30
@shantanualsi shantanualsi mentioned this pull request Jan 19, 2026
shantanualsi added a commit that referenced this pull request Jan 21, 2026
Co-authored-by: shantanualshi <shantanu.alshi@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants