Skip to content

fix: mark connector and function user config as sensitive - #221

Merged
freeznet merged 4 commits into
streamnative:masterfrom
david-streamlio:feat/sensitive-configs
Aug 26, 2026
Merged

fix: mark connector and function user config as sensitive#221
freeznet merged 4 commits into
streamnative:masterfrom
david-streamlio:feat/sensitive-configs

Conversation

@david-streamlio

Copy link
Copy Markdown
Contributor

Fixes #213

Motivation

configs on pulsar_source and pulsar_sink carries arbitrary connector settings, and in practice that is where credentials end up — a JDBC sink needs its password somewhere, and configs is where every other setting for that connector already goes. The attribute is not marked sensitive, so those values are echoed in terraform plan and terraform apply output.

pulsar_function has the same shape in user_config.

This is the enforcement half of #204, which documents the hazard. Documentation alone leaves the value printed to every terminal and CI log that runs a plan.

Modifications

Add Sensitive: true to:

  • configs on pulsar_sink (resource_pulsar_sink.go)
  • configs on pulsar_source (resource_pulsar_source.go)
  • user_config on pulsar_function (resource_pulsar_function.go)

and regenerate docs/.

Scope, and what I deliberately left alone. The issue asks to audit pulsar_function for the same gap, so to be explicit about where I drew the line:

Trade-off worth naming. Non-secret settings in configs and user_config — a JDBC URL, a table name, a threshold — now render as (sensitive value) in diffs. That is the unavoidable cost of a free-form attribute: the provider cannot tell which keys hold credentials. The issue raises the same concern. If you would rather accept noisier diffs than mask everything, the alternative is to leave configs visible and rely on #204's documentation alone — happy to go that way instead.

Also note this is a mitigation rather than a fix: the value still lives in state, as with any sensitive attribute. Using secrets, so the credential never reaches connector config, function metadata or state at all, remains the stronger recommendation.

Verifying this change

  • Make sure that the change passes the CI checks.

This change is already covered by existing tests:

  • make test and golangci-lint pass.
  • go generate ./... reproduces the committed docs/ output; the only diff is the three attributes gaining the Sensitive marker.
  • Acceptance tests run against Pulsar 4.0.3: TestSink, TestSinkUpdate, TestSource and TestFunction all pass, confirming that marking the attributes sensitive does not disturb the read/write paths or state handling.

Documentation

Check the box below.

Need to update docs?

  • doc-required

  • no-need-doc

  • doc

    docs/resources/{sink,source,function}.md regenerated; the three attributes now show as (Sensitive).

`configs` on pulsar_source and pulsar_sink carries arbitrary connector
settings, and in practice that is where credentials end up - a JDBC sink
needs its password somewhere, and `configs` is where every other setting
for that connector goes. The attribute was not marked sensitive, so those
values were echoed in `terraform plan` and `terraform apply` output.

Mark it `Sensitive: true` on both resources, and do the same for
`user_config` on pulsar_function, which is the equivalent free-form
surface there.

This is a mitigation, not a fix: the value still lives in state, as it
does for any sensitive attribute. Using `secrets` so the credential never
reaches connector config, function metadata or state at all remains the
stronger recommendation. This only stops the value being printed.

Deliberately left alone:

- `secrets` itself. It holds `{path, key}` references rather than values,
  and keeping it visible shows which secret names are wired up, which is
  useful in a diff and not itself sensitive.
- `custom_runtime_options`. It can carry credentials, but its structure is
  being changed by streamnative#219, and masking it would hide runtime settings that
  are usually not secret. Worth deciding separately.

The trade-off is that non-secret settings in `configs` and `user_config` -
a JDBC URL, a table name, a threshold - now render as `(sensitive value)`
in diffs. That is the cost of the attribute being free-form: the provider
cannot tell which keys hold credentials.

Fixes streamnative#213

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@david-streamlio
david-streamlio requested a review from a team as a code owner August 21, 2026 00:21
@github-actions github-actions Bot added the doc This pr contains a document label Aug 21, 2026
@freeznet

Copy link
Copy Markdown
Member

Pushed 7988721 to close the post-#219 sensitivity gap.

Changes:

  • mark pulsar_function.sink_config.configs and source_config.configs as sensitive, matching the existing connector configs and function user_config behavior;
  • regenerate the function docs;
  • add a schema regression test covering both nested blocks.

Validation:

  • GOTOOLCHAIN=go1.25.14+auto GOWORK=off go test ./...
  • GOTOOLCHAIN=go1.25.14+auto GOWORK=off go vet ./...
  • go generate ./...

custom_runtime_options remains unchanged as discussed in the PR scope. As with other Terraform sensitive attributes, the values are redacted from normal CLI output but remain present in Terraform state.

freeznet
freeznet previously approved these changes Aug 26, 2026
maxsxu
maxsxu previously approved these changes Aug 26, 2026
@freeznet
freeznet dismissed stale reviews from maxsxu and themself via e795420 August 26, 2026 15:17
@freeznet
freeznet merged commit 8ad0d2a into streamnative:master Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc This pr contains a document

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mark configs as Sensitive: true on pulsar_source / pulsar_sink schemas

3 participants