Repository navigation
test: property-based redaction invariants (pilot) - #438
Merged
Merged
Conversation
CamundaSdkConfiguration is a plain pydantic model, so its generated repr printed every value it held: the OAuth client secret and its alias, the basic-auth password, the inline mTLS key and its passphrase. ResolvedCamundaSdkConfiguration is a dataclass whose generated repr nested the unfiltered environment and explicit partials on top of that, and _OAuthToken's printed the bearer token. Any print(client.configuration), %r in an f-string, or traceback renderer that shows locals wrote them out. The five credential-bearing configuration fields are now declared repr=False, _OAuthToken.access_token likewise, and ResolvedCamundaSdkConfiguration renders the shape of the two raw partials rather than their contents. Nothing else changes: the values are still readable by attribute and still present in model_dump(), so no caller breaks. The regression test derives the credential set from the model's own field names rather than listing the fields that leaked, so a credential field added later fails here without anyone remembering to extend the test. Closes #422 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
Two configuration error paths put credential values verbatim into their message, and both fire at client construction -- process start-up -- where the traceback lands in application logs or a crash reporter. The alias-conflict error interpolated both sides with !r, and CAMUNDA_CLIENT_SECRET / CAMUNDA_CLIENT_AUTH_CLIENTSECRET is one of the alias pairs. It now renders a placeholder for the keys in the credential set and keeps the real values for the others, so a REST-address conflict is still diagnosable. A pydantic ValidationError records the input it was handed on every error, so a required-when failure repeated the whole merged configuration, credentials included. The resolver now validates a redacted copy to obtain the same diagnosis without them -- the model's validators test for presence, not content, so a placeholder is rejected exactly where the real value was -- and raises that, with the original suppressed so a chained traceback cannot print it. The exception type is unchanged. In the one case where the rejected value is itself a credential, the redacted copy validates and the errors are rendered without their input instead; that is a ValueError, which ValidationError already is. Closes #423 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
CI's escape-hatch guard failed: the three new helpers raised the `any` count in runtime/ from 371 to 375. None of them needs Any. _render_config_value only reprs its value, and the redaction pair only copies a mapping and compares it, so object expresses all three exactly and keeps the baseline where it was. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
From Copilot's review: the placeholder is non-empty, so redacting an empty credential let the redacted copy pass a presence check the real configuration failed. BASIC auth with a username and CAMUNDA_BASIC_AUTH_PASSWORD="" therefore raised a plain ValueError rather than the ValidationError naming the missing password, and an empty credential alongside another error lost its diagnosis entirely. An empty value is not a secret, so it is now left alone. Two tests cover it; the first fails against the previous redaction. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
…7-property-based-redaction-pilot
Add Hypothesis as a dev dependency and a small set of property tests asserting that, for arbitrary secret strings, no credential reaches a rendering of the configuration, a validation error or an alias-conflict error, while the non-secret fields still render and the secret stays readable through the model. Deterministic: derandomize=True and no example database, so a revision always runs the same examples. Stacked on #430 and #431, whose redaction this asserts. Refs camunda/sdk-infra#87 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
This was referenced Nov 13, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Secret-redaction tests can miss escaped credential leaks, and configuration-error sanitization drops the credential type error when another field is also invalid.
2 open issues
What changed in this PR
Introduces a Hypothesis pilot for credential-redaction invariants in the Python SDK, building on the fixes from #430 and #431 included in this stacked diff.
Changes:
- Adds four deterministic property tests for configuration rendering, error redaction, and preserved non-secret fields.
- Adds Hypothesis as a development dependency and documents the testing convention.
- Includes the prerequisite redaction fixes, example-based regression tests, and regenerated runtime and stubs.
| File | Description |
|---|---|
uv.lock |
Locks Hypothesis and its dependencies. |
tests/acceptance/test_secret_repr_redaction.py |
Checks credential hiding in configuration, client, and token renderings. |
tests/acceptance/test_secret_redaction_properties.py |
Adds property-based redaction invariants. |
tests/acceptance/test_secret_redaction_in_errors.py |
Adds configuration-error redaction regressions. |
stubs/camunda_orchestration_sdk/runtime/configuration_resolver.pyi |
Reflects resolver redaction changes in generated stubs. |
stubs/camunda_orchestration_sdk/runtime/auth.pyi |
Reflects token rendering changes. |
runtime/configuration_resolver.py |
Hides credentials in renderings and sanitizes configuration errors. |
runtime/auth.py |
Excludes access tokens from their dataclass representation. |
pyproject.toml |
Adds the Hypothesis development dependency. |
generated/camunda_orchestration_sdk/runtime/configuration_resolver.py |
Carries resolver redaction changes into the SDK. |
generated/camunda_orchestration_sdk/runtime/auth.py |
Carries token redaction into the SDK. |
CONTRIBUTING.md |
Documents deterministic property tests and regression handling. |
Review effort: Balanced
Compare each rendering and error text with the one produced for a fixed placeholder secret instead of searching for the secret as a substring, which repr() escaping could defeat. The short-secret filter is no longer needed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
…is also invalid The redacted copy accepts the placeholder for a non-string credential, so its own type error vanishes from the copy. When another field was also invalid the copy still failed, and that failure was returned as the whole diagnosis, silently dropping the credential's error. Return the redacted copy's error only when its locations, types and messages match the original's; otherwise render the original's errors without their input. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
…ion fix Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
…tion chain Render the formatted traceback and every visible cause or context, and assert that the validation error suppresses the credential-bearing original, so removing `from None` fails the tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda
emilyoram
approved these changes
Nov 19, 2026
emilyoram
left a comment
Collaborator
There was a problem hiding this comment.
Approved: CI green and Copilot review recommends approval.
Contributor
|
Successfully created backport PR for |
Contributor
|
Created backport PR for
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin backport-438-to-stable/9
git worktree add --checkout .worktree/backport-438-to-stable/9 backport-438-to-stable/9
cd .worktree/backport-438-to-stable/9
git reset --hard HEAD^
git cherry-pick -x b052412a5cd1880de5e51f8e4faa0f9663989972 |
camunda-sdk-automation Bot
pushed a commit
that referenced
this pull request
Nov 30, 2026
Cherry-picked from #438 onto stable/9 with conflicts. The conflict markers are committed as-is and must be resolved before this backport is merged.
jwulf
pushed a commit
that referenced
this pull request
Nov 30, 2026
* fix(config): keep credentials out of repr() and str() CamundaSdkConfiguration is a plain pydantic model, so its generated repr printed every value it held: the OAuth client secret and its alias, the basic-auth password, the inline mTLS key and its passphrase. ResolvedCamundaSdkConfiguration is a dataclass whose generated repr nested the unfiltered environment and explicit partials on top of that, and _OAuthToken's printed the bearer token. Any print(client.configuration), %r in an f-string, or traceback renderer that shows locals wrote them out. The five credential-bearing configuration fields are now declared repr=False, _OAuthToken.access_token likewise, and ResolvedCamundaSdkConfiguration renders the shape of the two raw partials rather than their contents. Nothing else changes: the values are still readable by attribute and still present in model_dump(), so no caller breaks. The regression test derives the credential set from the model's own field names rather than listing the fields that leaked, so a credential field added later fails here without anyone remembering to extend the test. Closes #422 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for credential repr redaction Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * fix(config): stop configuration errors echoing credentials Two configuration error paths put credential values verbatim into their message, and both fire at client construction -- process start-up -- where the traceback lands in application logs or a crash reporter. The alias-conflict error interpolated both sides with !r, and CAMUNDA_CLIENT_SECRET / CAMUNDA_CLIENT_AUTH_CLIENTSECRET is one of the alias pairs. It now renders a placeholder for the keys in the credential set and keeps the real values for the others, so a REST-address conflict is still diagnosable. A pydantic ValidationError records the input it was handed on every error, so a required-when failure repeated the whole merged configuration, credentials included. The resolver now validates a redacted copy to obtain the same diagnosis without them -- the model's validators test for presence, not content, so a placeholder is rejected exactly where the real value was -- and raises that, with the original suppressed so a chained traceback cannot print it. The exception type is unchanged. In the one case where the rejected value is itself a credential, the redacted copy validates and the errors are rendered without their input instead; that is a ValueError, which ValidationError already is. Closes #423 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for redacted configuration errors Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): type the redaction helpers with object, not Any CI's escape-hatch guard failed: the three new helpers raised the `any` count in runtime/ from 371 to 375. None of them needs Any. _render_config_value only reprs its value, and the redaction pair only copies a mapping and compares it, so object expresses all three exactly and keeps the baseline where it was. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the redaction helper signatures Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): leave empty credentials unredacted From Copilot's review: the placeholder is non-empty, so redacting an empty credential let the redacted copy pass a presence check the real configuration failed. BASIC auth with a username and CAMUNDA_BASIC_AUTH_PASSWORD="" therefore raised a plain ValueError rather than the ValidationError naming the missing password, and an empty credential alongside another error lost its diagnosis entirely. An empty value is not a secret, so it is now left alone. Two tests cover it; the first fails against the previous redaction. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the empty-credential redaction fix Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * test: property-based redaction invariants (pilot) Add Hypothesis as a dev dependency and a small set of property tests asserting that, for arbitrary secret strings, no credential reaches a rendering of the configuration, a validation error or an alias-conflict error, while the non-secret fields still render and the secret stays readable through the model. Deterministic: derandomize=True and no example database, so a revision always runs the same examples. Stacked on #430 and #431, whose redaction this asserts. Refs camunda/sdk-infra#87 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore: address review comments - assert independence from the secret Compare each rendering and error text with the one produced for a fixed placeholder secret instead of searching for the secret as a substring, which repr() escaping could defeat. The short-secret filter is no longer needed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): keep a rejected credential's error when another field is also invalid The redacted copy accepts the placeholder for a non-string credential, so its own type error vanishes from the copy. When another field was also invalid the copy still failed, and that failure was returned as the whole diagnosis, silently dropping the credential's error. Return the redacted copy's error only when its locations, types and messages match the original's; otherwise render the original's errors without their input. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the mixed-invalid-fields redaction fix Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): assert credential suppression across the visible exception chain Render the formatted traceback and every visible cause or context, and assert that the validation error suppresses the credential-bearing original, so removing `from None` fails the tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda --------- Co-authored-by: Claude <noreply@anthropic.com> (cherry picked from commit b052412)
jwulf
pushed a commit
that referenced
this pull request
Nov 30, 2026
* fix(config): keep credentials out of repr() and str() CamundaSdkConfiguration is a plain pydantic model, so its generated repr printed every value it held: the OAuth client secret and its alias, the basic-auth password, the inline mTLS key and its passphrase. ResolvedCamundaSdkConfiguration is a dataclass whose generated repr nested the unfiltered environment and explicit partials on top of that, and _OAuthToken's printed the bearer token. Any print(client.configuration), %r in an f-string, or traceback renderer that shows locals wrote them out. The five credential-bearing configuration fields are now declared repr=False, _OAuthToken.access_token likewise, and ResolvedCamundaSdkConfiguration renders the shape of the two raw partials rather than their contents. Nothing else changes: the values are still readable by attribute and still present in model_dump(), so no caller breaks. The regression test derives the credential set from the model's own field names rather than listing the fields that leaked, so a credential field added later fails here without anyone remembering to extend the test. Closes #422 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for credential repr redaction Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * fix(config): stop configuration errors echoing credentials Two configuration error paths put credential values verbatim into their message, and both fire at client construction -- process start-up -- where the traceback lands in application logs or a crash reporter. The alias-conflict error interpolated both sides with !r, and CAMUNDA_CLIENT_SECRET / CAMUNDA_CLIENT_AUTH_CLIENTSECRET is one of the alias pairs. It now renders a placeholder for the keys in the credential set and keeps the real values for the others, so a REST-address conflict is still diagnosable. A pydantic ValidationError records the input it was handed on every error, so a required-when failure repeated the whole merged configuration, credentials included. The resolver now validates a redacted copy to obtain the same diagnosis without them -- the model's validators test for presence, not content, so a placeholder is rejected exactly where the real value was -- and raises that, with the original suppressed so a chained traceback cannot print it. The exception type is unchanged. In the one case where the rejected value is itself a credential, the redacted copy validates and the errors are rendered without their input instead; that is a ValueError, which ValidationError already is. Closes #423 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for redacted configuration errors Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): type the redaction helpers with object, not Any CI's escape-hatch guard failed: the three new helpers raised the `any` count in runtime/ from 371 to 375. None of them needs Any. _render_config_value only reprs its value, and the redaction pair only copies a mapping and compares it, so object expresses all three exactly and keeps the baseline where it was. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the redaction helper signatures Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): leave empty credentials unredacted From Copilot's review: the placeholder is non-empty, so redacting an empty credential let the redacted copy pass a presence check the real configuration failed. BASIC auth with a username and CAMUNDA_BASIC_AUTH_PASSWORD="" therefore raised a plain ValueError rather than the ValidationError naming the missing password, and an empty credential alongside another error lost its diagnosis entirely. An empty value is not a secret, so it is now left alone. Two tests cover it; the first fails against the previous redaction. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the empty-credential redaction fix Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * test: property-based redaction invariants (pilot) Add Hypothesis as a dev dependency and a small set of property tests asserting that, for arbitrary secret strings, no credential reaches a rendering of the configuration, a validation error or an alias-conflict error, while the non-secret fields still render and the secret stays readable through the model. Deterministic: derandomize=True and no example database, so a revision always runs the same examples. Stacked on #430 and #431, whose redaction this asserts. Refs camunda/sdk-infra#87 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore: address review comments - assert independence from the secret Compare each rendering and error text with the one produced for a fixed placeholder secret instead of searching for the secret as a substring, which repr() escaping could defeat. The short-secret filter is no longer needed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): keep a rejected credential's error when another field is also invalid The redacted copy accepts the placeholder for a non-string credential, so its own type error vanishes from the copy. When another field was also invalid the copy still failed, and that failure was returned as the whole diagnosis, silently dropping the credential's error. Return the redacted copy's error only when its locations, types and messages match the original's; otherwise render the original's errors without their input. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the mixed-invalid-fields redaction fix Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): assert credential suppression across the visible exception chain Render the formatted traceback and every visible cause or context, and assert that the validation error suppresses the credential-bearing original, so removing `from None` fails the tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda --------- Co-authored-by: Claude <noreply@anthropic.com> (cherry picked from commit b052412)
jwulf
pushed a commit
that referenced
this pull request
Nov 30, 2026
* fix(config): keep credentials out of repr() and str() CamundaSdkConfiguration is a plain pydantic model, so its generated repr printed every value it held: the OAuth client secret and its alias, the basic-auth password, the inline mTLS key and its passphrase. ResolvedCamundaSdkConfiguration is a dataclass whose generated repr nested the unfiltered environment and explicit partials on top of that, and _OAuthToken's printed the bearer token. Any print(client.configuration), %r in an f-string, or traceback renderer that shows locals wrote them out. The five credential-bearing configuration fields are now declared repr=False, _OAuthToken.access_token likewise, and ResolvedCamundaSdkConfiguration renders the shape of the two raw partials rather than their contents. Nothing else changes: the values are still readable by attribute and still present in model_dump(), so no caller breaks. The regression test derives the credential set from the model's own field names rather than listing the fields that leaked, so a credential field added later fails here without anyone remembering to extend the test. Closes #422 Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for credential repr redaction Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * fix(config): stop configuration errors echoing credentials Two configuration error paths put credential values verbatim into their message, and both fire at client construction -- process start-up -- where the traceback lands in application logs or a crash reporter. The alias-conflict error interpolated both sides with !r, and CAMUNDA_CLIENT_SECRET / CAMUNDA_CLIENT_AUTH_CLIENTSECRET is one of the alias pairs. It now renders a placeholder for the keys in the credential set and keeps the real values for the others, so a REST-address conflict is still diagnosable. A pydantic ValidationError records the input it was handed on every error, so a required-when failure repeated the whole merged configuration, credentials included. The resolver now validates a redacted copy to obtain the same diagnosis without them -- the model's validators test for presence, not content, so a placeholder is rejected exactly where the real value was -- and raises that, with the original suppressed so a chained traceback cannot print it. The exception type is unchanged. In the one case where the rejected value is itself a credential, the redacted copy validates and the errors are rendered without their input instead; that is a ValueError, which ValidationError already is. Closes #423 Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for redacted configuration errors Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): type the redaction helpers with object, not Any CI's escape-hatch guard failed: the three new helpers raised the `any` count in runtime/ from 371 to 375. None of them needs Any. _render_config_value only reprs its value, and the redaction pair only copies a mapping and compares it, so object expresses all three exactly and keeps the baseline where it was. Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the redaction helper signatures Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): leave empty credentials unredacted From Copilot's review: the placeholder is non-empty, so redacting an empty credential let the redacted copy pass a presence check the real configuration failed. BASIC auth with a username and CAMUNDA_BASIC_AUTH_PASSWORD="" therefore raised a plain ValueError rather than the ValidationError naming the missing password, and an empty credential alongside another error lost its diagnosis entirely. An empty value is not a secret, so it is now left alone. Two tests cover it; the first fails against the previous redaction. Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the empty-credential redaction fix Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * test: property-based redaction invariants (pilot) Add Hypothesis as a dev dependency and a small set of property tests asserting that, for arbitrary secret strings, no credential reaches a rendering of the configuration, a validation error or an alias-conflict error, while the non-secret fields still render and the secret stays readable through the model. Deterministic: derandomize=True and no example database, so a revision always runs the same examples. Stacked on #430 and #431, whose redaction this asserts. Refs camunda/sdk-infra#87 Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore: address review comments - assert independence from the secret Compare each rendering and error text with the one produced for a fixed placeholder secret instead of searching for the secret as a substring, which repr() escaping could defeat. The short-secret filter is no longer needed. Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): keep a rejected credential's error when another field is also invalid The redacted copy accepts the placeholder for a non-string credential, so its own type error vanishes from the copy. When another field was also invalid the copy still failed, and that failure was returned as the whole diagnosis, silently dropping the credential's error. Return the redacted copy's error only when its locations, types and messages match the original's; otherwise render the original's errors without their input. Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the mixed-invalid-fields redaction fix Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): assert credential suppression across the visible exception chain Render the formatted traceback and every visible cause or context, and assert that the validation error suppresses the credential-bearing original, so removing `from None` fails the tests. Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda --------- (cherry picked from commit b052412) Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
jwulf
pushed a commit
that referenced
this pull request
Nov 30, 2026
* fix(config): keep credentials out of repr() and str() CamundaSdkConfiguration is a plain pydantic model, so its generated repr printed every value it held: the OAuth client secret and its alias, the basic-auth password, the inline mTLS key and its passphrase. ResolvedCamundaSdkConfiguration is a dataclass whose generated repr nested the unfiltered environment and explicit partials on top of that, and _OAuthToken's printed the bearer token. Any print(client.configuration), %r in an f-string, or traceback renderer that shows locals wrote them out. The five credential-bearing configuration fields are now declared repr=False, _OAuthToken.access_token likewise, and ResolvedCamundaSdkConfiguration renders the shape of the two raw partials rather than their contents. Nothing else changes: the values are still readable by attribute and still present in model_dump(), so no caller breaks. The regression test derives the credential set from the model's own field names rather than listing the fields that leaked, so a credential field added later fails here without anyone remembering to extend the test. Closes #422 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for credential repr redaction Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * fix(config): stop configuration errors echoing credentials Two configuration error paths put credential values verbatim into their message, and both fire at client construction -- process start-up -- where the traceback lands in application logs or a crash reporter. The alias-conflict error interpolated both sides with !r, and CAMUNDA_CLIENT_SECRET / CAMUNDA_CLIENT_AUTH_CLIENTSECRET is one of the alias pairs. It now renders a placeholder for the keys in the credential set and keeps the real values for the others, so a REST-address conflict is still diagnosable. A pydantic ValidationError records the input it was handed on every error, so a required-when failure repeated the whole merged configuration, credentials included. The resolver now validates a redacted copy to obtain the same diagnosis without them -- the model's validators test for presence, not content, so a placeholder is rejected exactly where the real value was -- and raises that, with the original suppressed so a chained traceback cannot print it. The exception type is unchanged. In the one case where the rejected value is itself a credential, the redacted copy validates and the errors are rendered without their input instead; that is a ValueError, which ValidationError already is. Closes #423 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for redacted configuration errors Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): type the redaction helpers with object, not Any CI's escape-hatch guard failed: the three new helpers raised the `any` count in runtime/ from 371 to 375. None of them needs Any. _render_config_value only reprs its value, and the redaction pair only copies a mapping and compares it, so object expresses all three exactly and keeps the baseline where it was. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the redaction helper signatures Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): leave empty credentials unredacted From Copilot's review: the placeholder is non-empty, so redacting an empty credential let the redacted copy pass a presence check the real configuration failed. BASIC auth with a username and CAMUNDA_BASIC_AUTH_PASSWORD="" therefore raised a plain ValueError rather than the ValidationError naming the missing password, and an empty credential alongside another error lost its diagnosis entirely. An empty value is not a secret, so it is now left alone. Two tests cover it; the first fails against the previous redaction. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the empty-credential redaction fix Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * test: property-based redaction invariants (pilot) Add Hypothesis as a dev dependency and a small set of property tests asserting that, for arbitrary secret strings, no credential reaches a rendering of the configuration, a validation error or an alias-conflict error, while the non-secret fields still render and the secret stays readable through the model. Deterministic: derandomize=True and no example database, so a revision always runs the same examples. Stacked on #430 and #431, whose redaction this asserts. Refs camunda/sdk-infra#87 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore: address review comments - assert independence from the secret Compare each rendering and error text with the one produced for a fixed placeholder secret instead of searching for the secret as a substring, which repr() escaping could defeat. The short-secret filter is no longer needed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): keep a rejected credential's error when another field is also invalid The redacted copy accepts the placeholder for a non-string credential, so its own type error vanishes from the copy. When another field was also invalid the copy still failed, and that failure was returned as the whole diagnosis, silently dropping the credential's error. Return the redacted copy's error only when its locations, types and messages match the original's; otherwise render the original's errors without their input. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(generation): regenerate SDK for the mixed-invalid-fields redaction fix Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(config): assert credential suppression across the visible exception chain Render the formatted traceback and every visible cause or context, and assert that the validation error suppresses the credential-bearing original, so removing `from None` fails the tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda --------- Co-authored-by: Claude <noreply@anthropic.com> (cherry picked from commit b052412) Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Before: The redaction tests (#430, #431) check the credential fields and values their authors thought of. sdk-infra#87 asks for a pilot of property-based testing, and nothing in this repo used it, so a secret value with an unusual shape could have slipped past redaction without any test noticing.
After: Four property tests state the invariant for arbitrary secret strings: no credential reaches
repr()/str()of the configuration, a validation error raised for an invalid configuration, or an alias-conflict error; the non-secret fields still render and the secret stays readable through the model. I checked they have teeth by flipping one field back torepr=Truelocally, which makes the rendering property fail. Hypothesis is added as a dev dependency (it was absent) throughuv add --dev, souv.lockchanges additively only.How: The tests are deterministic:
derandomize=Truederives the examples from the test source anddatabase=Nonecarries nothing between runs, so a revision always runs the same examples;.hypothesis/is git-ignored and CONTRIBUTING.md notes the convention. A generated secret that happens to occur in the non-secret text (checked against a baseline rendering with a placeholder secret) is filtered out per example rather than reported as a leak.Stacked. This branch was created from
mainwith the heads of #430 and #431 merged in, because the properties are red onmainuntil they land. Those two PRs must merge first; their commits then drop out of this diff. I did not push to their branches.Refs camunda/sdk-infra#87
Generated by Claude Code