Repository navigation
[CPLAT-12776] Port Sendbird patches to envoy v1.39.2 (Istio 1.31.1) - #27
gavin-jeong merged 11 commits into
Conversation
(cherry picked from commit 8287a74)
Include code formatting improvements for consistent style in trace test files. (cherry picked from commit 2af673c)
…uction This commit combines multiple fixes for Redis cluster stability: - Fix race conditions in cluster destruction by capturing is_destroying_ flag - Add comprehensive null checks to prevent segfaults during cluster destruction - Use local shared_ptr copies to prevent race conditions - Use shared_from_this() to keep RedisDiscoverySession alive during timer callbacks - Fix use-after-free by using session-owned flag instead of parent reference These fixes ensure safe cleanup of Redis clusters and prevent crashes during cluster removal and timer callback execution. (cherry picked from commit 6bd87fc)
(cherry picked from commit a298a4b)
(cherry picked from commit 1e1f86e)
Add TraceSampledFormatter that uses Envoy's internal tracing decision (stream_info.traceReason()) This approach works correctly at trace origin points (e.g., Istio Ingress Gateway) where no incoming traceparent header exists. Usage: %TRACE_SAMPLED% in access log format Returns: "true" if traced, "false" otherwise Co-Authored-By: Claude Opus 4.5 <[email protected]> (cherry picked from commit f733d65)
(cherry picked from commit d5a98c2)
Add per-shard statistics for Redis proxy to track hot shard usage: - enable_per_shard_stats: Emits per-shard request counters - upstream_rq_total: Total requests to each shard - upstream_rq_success: Successful requests - upstream_rq_failure: Failed requests - upstream_rq_active: Active requests (gauge) - enable_per_shard_latency_stats: Emits latency histogram - upstream_rq_time: Request latency in microseconds All metrics are scoped under: cluster.<cluster_name>.shard.<host_address>.* Per-shard command-level stats are also recorded when enable_command_stats is enabled alongside the per-shard options. Note: These options may significantly increase metric cardinality in large clusters. Use with caution in production environments. (cherry picked from commit 41e7a3d)
In v1.37, FormatterProvider uses format/formatValue with Context& instead of formatWithContext/formatValueWithContext with HttpFormatterContext&. Updated TraceSampledFormatter accordingly. (cherry picked from commit 3f9d804)
Cherry-pick of eval_ro/evalsha_ro support (4759ad9) onto upstream v1.38.3 left a stray diff3 base marker '||||||| parent of 36be96a' in redis_cluster_lb_test.cc, which also dropped the closing brace of the LocalZoneAffinityEmptyClientZone test. Replace the marker with the missing '}' so the file compiles and both the zone-aware and ReadOnlyCommand tests are well-formed. CPLAT-10838 (cherry picked from commit 870986c)
envoy 1.39 declares FormatterProvider::format as returning std::optional<std::string>, and every other formatter in http_specific_formatter.h follows it. TraceSampledFormatter was the only one left on absl::optional, which overrides correctly today only because Abseil aliases absl::optional to std::optional under ABSL_USES_STD_OPTIONAL. Depending on that alias to satisfy an `override` is a build break waiting for a flag change, so match the base signature directly.
|
| CVE | Package | Version | Fix |
|---|---|---|---|
| CVE-2026-78676 | gitpython |
3.1.50 |
3.1.59 |
| CVE-2026-102266 | pyjwt |
2.13.0 |
2.14.0 |
| CVE-2026-102268 | pyjwt |
2.13.0 |
2.14.0 |
| CVE-2026-78663 | golang.org/x/net |
v0.55.0 |
0.60.0 |
| CVE-2026-102267 | pyjwt |
2.13.0 |
2.14.0 |
🔶 High · 39 findings
| CVE | Package | Version | Fix |
|---|---|---|---|
| CVE-2026-76222 | gitpython |
3.1.50 |
3.1.58 |
| CVE-2026-102274 | pyjwt |
2.13.0 |
2.14.0 |
| CVE-2026-69247 | cryptography |
46.0.7 |
50.0.0 |
| CVE-2026-76218 | gitpython |
3.1.50 |
3.1.58 |
| CVE-2026-67322 | gitpython |
3.1.50 |
3.1.52 |
| CVE-2026-73625 | gitpython |
3.1.50 |
— |
| CVE-2026-101917 | pyjwt |
2.13.0 |
2.14.0 |
| UWV-2026-48452 | google.golang.org/grpc |
v1.79.3 |
— |
| CVE-2026-59885 | pyasn1 |
0.6.3 |
0.6.4 |
| CVE-2026-102275 | pyjwt |
2.13.0 |
2.15.0 |
| CVE-2026-78669 | golang.org/x/net |
v0.55.0 |
0.60.0 |
| CVE-2026-87817 | gitpython |
3.1.50 |
3.1.60 |
| CVE-2026-67325 | gitpython |
3.1.50 |
3.1.51 |
| CVE-2026-102271 | pyjwt |
2.13.0 |
2.14.0 |
| CVE-2026-84445 | google.golang.org/grpc |
v1.79.3 |
1.82.2 |
| CVE-2026-84304 | google.golang.org/grpc |
v1.79.3 |
1.83.1 |
| CVE-2026-67323 | gitpython |
3.1.50 |
3.1.51 |
| CVE-2026-69244 | aiohttp |
3.14.1 |
3.14.3 |
| CVE-2026-78675 | gitpython |
3.1.50 |
3.1.59 |
| CVE-2026-102272 | pyjwt |
2.13.0 |
2.14.0 |
| CVE-2026-78677 | gitpython |
3.1.50 |
3.1.59 |
| CVE-2026-69247 | cryptography |
47.0.0 |
50.0.0 |
| CVE-2026-76219 | gitpython |
3.1.50 |
3.1.58 |
| CVE-2026-87819 | gitpython |
3.1.50 |
3.1.60 |
| CVE-2026-97689 | urllib3 |
2.7.0 |
2.8.0 |
| CVE-2026-69249 | cryptography |
47.0.0 |
49.0.0 |
| CVE-2026-46600 | golang.org/x/net |
v0.55.0 |
0.56.0 |
| CVE-2026-56852 | golang.org/x/text |
v0.37.0 |
0.39.0 |
| CVE-2026-78660 | golang.org/x/net |
v0.55.0 |
0.60.0 |
| CVE-2026-76220 | gitpython |
3.1.50 |
3.1.58 |
| CVE-2026-102273 | pyjwt |
2.13.0 |
2.14.0 |
| CVE-2026-59884 | pyasn1 |
0.6.3 |
0.6.4 |
| CVE-2026-56851 | golang.org/x/text |
v0.37.0 |
0.41.0 |
| CVE-2026-97687 | urllib3 |
2.7.0 |
2.8.0 |
| CVE-2026-59886 | pyasn1 |
0.6.3 |
0.6.4 |
| CVE-2026-55099 | icalendar |
7.1.1 |
7.1.3 |
| CVE-2026-69249 | cryptography |
46.0.7 |
49.0.0 |
| CVE-2026-78659 | golang.org/x/net |
v0.55.0 |
0.60.0 |
| CVE-2026-101918 | pyjwt |
2.13.0 |
2.15.0 |
🟡 Medium · 15 findings
| CVE | Package | Version | Fix |
|---|---|---|---|
| CVE-2026-78678 | gitpython |
3.1.50 |
3.1.59 |
| CVE-2026-102270 | pyjwt |
2.13.0 |
2.14.0 |
| CVE-2026-97688 | urllib3 |
2.7.0 |
2.8.0 |
| CVE-2026-78679 | gitpython |
3.1.50 |
3.1.59 |
| CVE-2026-104874 | multidict |
6.7.1 |
6.9.1 |
| CVE-2026-59881 | aiohttp |
3.14.1 |
3.14.2 |
| CVE-2026-103001 | pyjwt |
2.13.0 |
— |
| CVE-2026-84303 | google.golang.org/grpc |
v1.79.3 |
1.83.1 |
| CVE-2026-59890 | setuptools |
82.0.1 |
83.0.0 |
| CVE-2026-76217 | gitpython |
3.1.50 |
3.1.58 |
| CVE-2026-69243 | aiohttp |
3.14.1 |
3.14.2 |
| CVE-2026-102269 | pyjwt |
2.13.0 |
2.14.0 |
| CVE-2026-69248 | cryptography |
47.0.0 |
49.0.0 |
| CVE-2026-102265 | pyjwt |
2.13.0 |
2.14.0 |
| CVE-2026-69248 | cryptography |
46.0.7 |
49.0.0 |
⚪ Unknown · 1 finding
| CVE | Package | Version | Fix |
|---|---|---|---|
| CVE-2026-97032 | golang.org/x/net |
v0.55.0 |
0.60.0 |
View full analysis in Upwind Console
Scan completed in 11s
Scan history (1 scan)
| Commit | Scanned at | New | Resolved | Net |
|---|---|---|---|---|
5ff9653 < |
2026-10-14 09:29 UTC | +60 | 0 | +60 |
Last scanned: 5ff9653 · 2026-10-14 09:29 UTC
|
| Commit | Scanned at | New | Resolved | Net |
|---|---|---|---|---|
5ff9653 < |
2026-10-14 09:29 UTC | 0 | 0 | 0 |
Last scanned: 5ff9653 · 2026-10-14 09:29 UTC
|
Semgrep found 1 🟠 High severity issue identified in your code: Risk: Affected versions of cryptography are vulnerable to Dependency on Vulnerable Third-Party Component / Out-of-bounds Read. The PyPI wheels for the cryptography package statically link a version of OpenSSL that contains security vulnerabilities (including a high-severity use-after-free in PKCS7_verify and several denial-of-service and forgery issues). Any application installed from an affected wheel ships the vulnerable OpenSSL binary, so an attacker may trigger out-of-bounds reads, crashes, or other memory-safety issues through cryptographic operations that reach the bundled OpenSSL code. Manual Review Advice: A vulnerability from this advisory is reachable if you installed the cryptography package from a PyPI binary wheel not built from a source distribution Fix: Upgrade this library to at least version 48.0.1 at envoy/tools/base/requirements.txt:545. Reference(s): GHSA-537c-gmf6-5ccf Semgrep found 1 🟠 High severity issue identified in your code: Risk: Affected versions of hickory-resolver are vulnerable to Insufficient Control of Network Message Volume (Network Amplification) / Loop with Unreachable Exit Condition ('Infinite Loop') / Uncontrolled Resource Consumption. hickory-resolver's Fix: Upgrade this library to at least version 0.26.2 at envoy/Cargo.lock:485. Reference(s): GHSA-6w6g-hm98-mhgm |
|
On the Upwind "60 newly introduced vulnerabilities (6 Critical)" finding: it is real data measured against the wrong baseline for this repo, and this PR moves every flagged dependency forward, not backward. This PR touches no dependency manifest. All 29 changed files are Upwind compares against
So the three packages named in the scan summary are each newer here than in production. They read as "newly introduced" only because That gap is not something this PR can close. Istio pins one exact envoy commit ( Worth noting the scan also counts Suggested read: treat the Upwind delta on this PR as "the Istio 1.31.1 pin vs envoy main", which is information about Istio release cadence rather than about this change. If the CVEs matter on their own, the place to act is a separate review of whether we can carry dependency bumps on top of the pin — that would apply equally to the 1.30.2 branch running in production today, which has strictly older versions of all three. |
|
Tested the built binary before merge. The two patches I resolved by hand were each verified against a differential, since both could compile cleanly and fail silently. Image under test:
|
| command | origin | ours | istio/proxyv2:1.31.1 |
|---|---|---|---|
eval_ro, evalsha_ro |
our patch | accepted | rejected |
subscribe, ssubscribe, sunsubscribe, spublish |
our patch | accepted | rejected |
hexpire, hpexpire, hpersist, httl |
upstream, new in 1.39 | accepted | accepted |
definitely_not_a_command |
control | rejected | rejected |
13/13 as expected on ours, and the upstream column shows the probe actually discriminates. Both sides of the union survive — which is what the diff counts in the PR body asserted statically and this confirms at runtime.
request_id UUIDv7
Generated ids still carry version nibble 7 at index 15 (f1a13a5a-4366-7423-...), matching the 1.30.2 image. On the reworked sign-prefix tests: StringUtil::strtoull rejects a leading +/- explicitly before std::strtoull runs (source/common/common/utility.cc:370), so a0090100-0012-0110-00ff-0c00-1aaaaaa — sign at index 28, inside the window getInteger now parses — keeps those two EXPECT_FALSE assertions meaningful.
In a cluster
The image also ran as a real sidecar against istiod 1.31.1 on a dev cluster: all four xDS types ACKED per istiod /debug/syncz, update_rejected: 0, SDS cert issued, mTLS traffic 200 with both SPIFFE principals present, 0 restarts, clean logs. Details on https://github.com/sendbird/proxy-istio/pull/16.
A note on watch, not introduced here
watch sits in both simpleCommands and transactionCommands after the merge. That came from our own pubsub patch (a298a4b6), not from this port — it is the same on release/v1.38.3-sendbird-custom running in production. Behaviour is identical to upstream because transactionCommands registers last (command_splitter_impl.cc:1014 vs :981) and RadixTree::add defaults to overwrite_existing = true, so watch resolves to transaction_handler_. Redundant rather than wrong, but it would become a real behaviour change if that registration order were ever swapped.
JIRA: https://sendbird.atlassian.net/browse/CPLAT-12776
Carries the Sendbird envoy patches onto
ae1505b84c(v1.39.2-dev), the envoythat istio/proxy 1.31.1 pins. Base for the 1.31.1 proxyv2 image.
Why this one is not a routine rebase
1.29.5 -> 1.30.2 moved envoy by 2 commits. 1.30.2 -> 1.31.1 moves it by
743 commits ahead / 78 behind. Of 11 patches, 4 cherry-picked clean and 7
conflicted.
Dropped: QUIC keylog
envoy 1.39 implements SSLKEYLOGFILE support natively, behind
envoy.restart_features.quic_keylog_support. Carrying ours would be aduplicate definition, not a feature.
Hand-resolved (4)
All four were code movement or the
absl::nullopt->std::nulloptrename, notcompeting logic:
source/extensions/clusters/redis/redis_cluster.ccparentInfo()destruction guard, took upstreamstd::nulloptsource/extensions/filters/network/common/redis/supported_commands.hsource/common/formatter/http_specific_formatter.ccTraceSampledFormatterabove the rewrittenGrpcStatusFormatterfactorysource/extensions/request_id/uuid/config{,_test}.ccsupported_commands.his a set union, deliberately. Upstream added thehexpire/hpexpirefamily while we added pubsub commands. Both lists areabsl::flat_hash_setinitializers, so order carries no meaning -- but takingeither side wholesale would silently drop the other side commands, and an
unlisted command stops being routed or counted as a write. The merge was
computed as
upstream + (ours - base)and then checked three ways against bothinputs:
simpleCommandswriteCommandsNothing dropped from either side, nothing invented. The 5 additions to
simpleCommandsarespublish,ssubscribe,subscribe,sunsubscribe,watch;writeCommandsgainsspublish.request_id/uuidneeded its tests reworked, not just merged. Upstream addedtwo cases asserting
getInteger()rejects a sign-prefixed id:They put the sign at index 0, which
getInteger()no longer reads -- our UUIDv7change parses indices 28-35, where that id yields a perfectly valid
400600ff.Merged as written, the cases would have failed. The sign was moved into the
parsed window (
a0090100-0012-0110-00ff-0c00-1aaaaaa) so they still test whatthey were written to test.
StringUtil::strtoullrejects a leading+or-explicitly, so the assertion holds for the new ids.
A triage trap worth recording
The first pass decided "upstream absorbed this" by grepping upstream for a
symbol each patch touches.
onClusterSlotUpdatehit 6 times inredis_cluster.cc, so the redis race/use-after-free patch was reported asdroppable. That was wrong -- it is an upstream function name that exists either
way. Probing for a symbol the patch introduces (
parent_destroyed_,isParentAlive) returns 0, so the patch is still ours. Dropping it would havedeleted a use-after-free guard in redis cluster destruction.
Verification
source/,test/orapi/(the 1.38.3branch shipped one for months;
870986ceexists to delete it)resolution silently dropped a file from a commit
Build completed successfully, 17418 total actions(amd64) and16988(arm64), no warning in any resolved filebuild/proxyv2-1.31.1-sendbird-custom-v0.0.1so branch cleanup cannot 404 theproxy-istio build
Security checklist (Infrastructure code)