Skip to content

[202605] Backport payload-safe tablePath logging (#768) - #770

Open
donghaolicd wants to merge 1 commit into
sonic-net:202605from
donghaolicd:backport/pr-768-202605
Open

[202605] Backport payload-safe tablePath logging (#768)#770
donghaolicd wants to merge 1 commit into
sonic-net:202605from
donghaolicd:backport/pr-768-202605

Conversation

@donghaolicd

@donghaolicd donghaolicd commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Why I did it

Backport #768 so the 202605 release does not write raw protobuf payload bytes from tablePath values into gNMI text logs. Those bytes can be invalid UTF-8, which made Ansible omit stdout while collecting diagnostics and masked the original gNMI result.

How I did it

Cherry-picked the merged #768 commit (23e37370e65edbce6d348d19b2514f66d57aa4a6) onto 202605 as one backport commit. git range-diff reports the code patch as identical to the merged change; the only commit-message difference is the -x cherry-pick provenance line.

The change adds payload-safe String and GoString formatting for tablePath, keeps useful path metadata, and replaces JSON/protobuf values with their byte lengths.

How to verify it

Which release branch to backport (provide reason below if selected)

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511
  • 202605

Tracking issue/work item for backport/cherry-pick request (GitHub issue or Microsoft ADO): https://msazure.visualstudio.com/One/_workitems/edit/39376939
Failure type: other - latent payload-unsafe logging exposed by DASH protobuf SETs

The target release failure was reproduced on SONiC.20260510.11 in Elastictest plan https://elastictest.org/scheduler/testplan/6a8ced4c5585d0b8ab0a86e5.

Tested branch

  • master
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511
  • 202605
  • N/A

Test result

  • master: focused sonic_data_client regression test passed in the SONiC Trixie build environment as documented in sonic_data_client: redact table path payloads #768.
  • 202605: official PR package validated on physical SONiC.20260510.11; authenticated protobuf Set update/delete succeeded, payload-safe tablePath logging remained valid UTF-8, and the release gNMI auth module passed both cases. See the sanitized validation comment below.

Description for the changelog

Prevent tablePath logging from exposing request payloads or writing invalid UTF-8 bytes to gNMI text logs.

Link to config_db schema for YANG module changes

N/A

Signed-off-by: donghaolicd <leedonhom@gmail.com>
(cherry picked from commit 23e3737)
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@mssonicbld

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@donghaolicd

Copy link
Copy Markdown
Contributor Author

202605 physical validation

Validated the amd64 package from this PR on a physical SmartSwitch running SONiC.20260510.11.

  • Package SHA-256: 96b3636c2b65d1280ef6b9d4fe68ffca694d7e70e7258656000816e0d3a37af4
  • Live PR telemetry SHA-256: 9f20d1ba628275fc280ee21145b00682df722ccc861f79edcac61196884b5384
  • Sent a certificate-authenticated 23-byte protobuf UPDATE to DPU_APPL_DB/dpu0/DASH_VNET_TABLE, then deleted the same key. Both Set RPCs succeeded.
  • The verbosity-10 scratch log decoded as valid UTF-8 and contained no raw NUL bytes.
  • The patched formatter emitted metadata and payload length only:
handleTableData: tblPath tablePath{namespace="" db="DPU_APPL_DB" table="DASH_VNET_TABLE" key="<redacted>" field="" operation="add" index=-1 json_bytes=0 proto_bytes=23 virtual=false}
  • The corresponding structured completion record reported the names-only path and code="OK"; no path keys or values were included.
  • The release-branch gnmi_e2e/test_gnmi_auth.py module also passed both cases (2 passed), with pretest 12 passed, 2 skipped and posttest 5 passed.

The full physical-lab logs and testbed identity are intentionally not published. After validation, I removed the test key, certificates/role/checkpoints, staged package, and runtime overlay. I recreated the gnmi container from docker-sonic-gnmi:latest and verified the stock telemetry SHA-256 41263281bf0e315ab4fe86aebb2851506a4fe1916de48a9a9e8fa195316c94b7, active services, listening port, clean Monit status, and a final green/unlocked Elastictest health check.

Separately, the release DASH fixture currently launches telemetry without explicit certificate-auth flags. With the translib-write package it defaults to JWT/password and rejects its certificate-only client before reaching the protobuf handler. That fixture issue is not caused by this PR and was excluded from the product result above.

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