Skip to content

feat(sensitive): schema.Path for sensitive_paths + LeafSchema sensitive flag + include_sensitive rename - #123

Open
steiler wants to merge 2 commits into
mainfrom
feat-sensitive-paths-schema-path
Open

feat(sensitive): schema.Path for sensitive_paths + LeafSchema sensitive flag + include_sensitive rename#123
steiler wants to merge 2 commits into
mainfrom
feat-sensitive-paths-schema-path

Conversation

@steiler

@steiler steiler commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR extends the SDC protobuf surface so northbound callers can classify sensitive configuration: schema carries a static baseline (sensitive on leaf types), transactions can declare per-intent path markers, and read APIs support an explicit admin bypass flag. It supports the sensitive-data design (key-pruned paths, *** redaction, union of markers across intents for merged views).

Motivation

  • Schema baseline: Device-profile YANG can mark leaves via sdcio-ext:sensitive once goyang#4 fixes ApplyDeviate for extensions. Consumers need a first-class bool on LeafSchema / LeafListSchema.
  • Operator markers: Intents store which paths the submitter treats as sensitive; using repeated schema.Path matches other path fields and avoids ad-hoc string validation.
  • Admin bypass: Rename expose_sensitiveinclude_sensitive on GetIntentRequest / BlameConfigRequest for clearer API semantics (same field numbers).
  • Ergonomics: SchemaElem.IsSensitive() delegates to LeafSchema / LeafListSchema GetSensitive() so callers avoid duplicating oneof switches.

API changes (summary)

Area Change
schema.proto LeafSchema.sensitive (22), LeafListSchema.sensitive (24)
data.proto GetIntentRequest.include_sensitive, BlameConfigRequest.include_sensitive; TransactionIntent.sensitive_paths as repeated schema.Path
tree_persist.proto Intent.sensitive_paths as repeated schema.Path (field 8)
sdcpb/schema_elem_additions.go (*SchemaElem).IsSensitive()

Compatibility notes

  • include_sensitive: Wire-compatible rename from expose_sensitive (unchanged field numbers).
  • Intent.sensitive_paths field 8: Type change from repeated string to repeated schema.Pathwire-breaking for that field; acceptable while no production persistence depends on the old encoding. Regenerated Go and tests cover round-trip and legacy blob behaviour where applicable.

Related PRs

Repo PR Role
sdcio/goyang #4 ApplyDeviate extension propagation
sdcio/sdc-protos #123 This PR
sdcio/schema-server #244 Set Sensitive from YANG
sdcio/data-server #452 Northbound redaction + persistence

Test plan

  • go test ./... in sdc-protos (includes tree_persist_sensitive_test.go round-trip / backward-compat coverage)
  • Regenerated *.pb.go matches *.proto in CI
  • After merge: tag release and bump importing repos off pseudo-version pins

Three related changes bundled together as they are mutually dependent:

1. schema.proto / sdcpb/schema.pb.go
   Add `bool sensitive = 22` to LeafSchema and `bool sensitive = 24`
   to LeafListSchema. Schema-server sets this flag when it detects the
   sdcio-ext:sensitive extension on a parsed leaf; data-server reads it
   at northbound render time.

2. data.proto / sdcpb/data.pb.go
   - TransactionIntent.sensitive_paths: repeated string → repeated schema.Path
     Structured paths eliminate the string-based validation that rejected
     key predicates; keys are stripped at union time via ToXPath(true).
   - GetIntentRequest.expose_sensitive → include_sensitive
   - BlameConfigRequest.expose_sensitive → include_sensitive

3. tree_persist.proto / tree_persist/tree_persist.pb.go
   Intent.sensitive_paths: repeated string → repeated schema.Path
   Consistent with data.proto; no conversion needed at the persist
   boundary. Field number unchanged — this is a WIP break.
   Add tree_persist_sensitive_test.go: round-trip + legacy-blob tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
@steiler
steiler requested a review from a team as a code owner June 8, 2026 15:51
Convenience method so callers can check sensitivity without a type
switch on the oneof field. Returns false for containers and nil receivers.

Co-authored-by: Cursor <cursoragent@cursor.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.

1 participant