Skip to content

feat: Add migration op event context redaction tests - #383

Merged
keelerm84 merged 2 commits into
v2from
mk/sdk-2716/migration-context-redaction
Jul 20, 2026
Merged

keelerm84 merged 2 commits into
v2from
mk/sdk-2716/migration-context-redaction

Conversation

@keelerm84

@keelerm84 keelerm84 commented Jul 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Migration op events inline the evaluation context, but the harness only verified the context key -- it never checked that private attributes were redacted. This meant an SDK could leak private context attributes in migration_op events while still passing the suite.

This adds a redacts private context attributes test (gated on inline-context-all) covering:

  • all-attributes-private
  • globally-configured private attributes
  • context-specified private attributes
  • nested-property private references

Each asserts the migration op event context via JSONMatchesEventContext, the same redaction matcher used by the ordinary event-context tests.

It also strengthens the existing redacts anonymous context attributes migration test, which previously only checked the context key, to assert the redacted context when the SDK inlines it.

Verified against a server SDK with the redaction bug present (new tests fail, leaking the private attribute) and against the fixed SDK (all migration tests pass).


Note

Low Risk
Test-only changes in the SDK harness; no production runtime behavior is modified.

Overview
Tightens the migration test harness so inline migration_op event contexts must redact sensitive attributes, not just match the context key.

Adds redacts private context attributes (requires inline-context-all) with table-driven cases for all-attributes-private, global private attributes, per-context Private(), and nested paths like /address/city. Each run uses JSONMatchesEventContext to expect stripped values and _meta.redactedAttributes, reusing the same matcher as ordinary event-context tests.

When inline-context-all is enabled, redacts anonymous context attributes now also asserts the full redacted context via JSONMatchesEventContext, not only key-level checks.

createClient accepts optional SDKConfigurer values (e.g. WithEventsConfig) and applies caller options before the event sink so merged events config stays correct.

Reviewed by Cursor Bugbot for commit ef18bea. Bugbot is set up for automated code reviews on this repo. Configure here.

Migration op events inline the evaluation context, but the harness only
verified the context key -- never that private attributes were redacted.
Add coverage for all-attributes-private, globally-configured private
attributes, context-specified private attributes, and nested-property
private references, asserting the redacted context via
JSONMatchesEventContext. Also strengthen the existing anonymous-redaction
migration test, which previously only checked the context key.

Relates to SDK-2716, SEC-8527.
@keelerm84
keelerm84 marked this pull request as ready for review July 20, 2026 14:43
@keelerm84
keelerm84 requested a review from a team as a code owner July 20, 2026 14:43
@keelerm84 keelerm84 changed the title test: Add migration op event context redaction tests feat: Add migration op event context redaction tests Jul 20, 2026
@keelerm84
keelerm84 merged commit daa7ad4 into v2 Jul 20, 2026
8 checks passed
@keelerm84
keelerm84 deleted the mk/sdk-2716/migration-context-redaction branch July 20, 2026 16:27
tanderson-ld pushed a commit that referenced this pull request Jul 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.38.0](v2.37.0...v2.38.0)
(2026-07-20)


### Features

* Add contract tests for client-side secure mode hash (h query param)
([#358](#358))
([16ed598](16ed598))
* Add migration op event context redaction tests
([#383](#383))
([daa7ad4](daa7ad4))
* Contract tests for client-side prerequisite cycle detection
([#384](#384))
([3605eb7](3605eb7))


### Bug Fixes

* Fix capability guarding custom event redaction
([#386](#386))
([357898f](357898f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Mechanical version and changelog update with no runtime or test logic
changes in the diff.
> 
> **Overview**
> **Release 2.38.0** bumps the harness version from **2.37.0** to
**2.38.0** in `main.go` and `.release-please-manifest.json`, and adds a
**2.38.0** section to `CHANGELOG.md`.
> 
> The changelog for this release (from already-merged work) covers new
contract tests for client-side secure mode hash (`h` query param),
migration op event context redaction, and client-side prerequisite cycle
detection, plus a fix for capability guarding on custom event redaction
tests. This PR does not change test or framework code—only release
metadata.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9ab60fd. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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