Skip to content

feat(chart): deprecate auth.clientSecret - #258

Merged
uniqueg merged 4 commits into
devfrom
chore/client-secret-deprecation
Nov 7, 2026
Merged

uniqueg merged 4 commits into
devfrom
chore/client-secret-deprecation

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Deprecates the chart value auth.clientSecret (and its old key auth.client_secret). The Swagger UI is a public client: its default implicit grant needs no secret, and tesk-api 1.2.0 and later ignore TESK_API_SWAGGER_OAUTH_CLIENT_SECRET (elixir-cloud-aai/tesk-api#106).

  • The secret key of the oauth-client-secret Secret is empty when the value is unset or empty (before, it was null, which Kubernetes also stores as empty). An upgrade without the value therefore also clears a value stored before; Helm can't remove a stringData key from the stored data. A set value (also 0 or false) renders as before, and older tesk-api images still get it.
  • The notes warn when the value is set, without printing it, and point to the upgrade notes.
  • A helper tesk.isSet (set: not null, not empty) is shared by the Secret, this warning and the FTP warning.
  • Docs: values file and schema descriptions, configuration reference, deployment guide (register a public client), upgrade notes ("Swagger UI client secret deprecated": remove the value, register a public client, rotate the secret, restart the API if its pod doesn't change). The camelCase rename table notes that auth.clientSecret is deprecated itself.

Closes #257

Verification

Full-review lane (Helm chart, 2 rounds).

  • Tests first (tests/test_chart.py):
    • the Secret with the value unset, empty or null (empty secret), and set;
    • the notes warning for unset, empty, 0, the old key and with auth.mode=auth, never printing the value;
    • test_secret_unset updated;
    • the legacy-chart comparison reads the earlier chart's null secret as empty.
  • REQUIRE_HELM=1 pytest tests with Helm 3.22.1: 344 passed.
  • ruff check, ruff format --check, mypy tests, helm lint charts/tesk: pass.
  • mkdocs build --strict: passes.
  • CI: see the checks of the head commit.

Declined review findings

  • Quality, medium: render the API's environment variable only when the value is set. Kept: the variable reads the (now always present) key, so older images get an empty value as before rather than the image's built-in default. A later release that removes the value removes the variable too.
  • Quality, medium: a version-aware warning. Dropped after round 1: the Swagger UI's default implicit grant needs no secret on any tesk-api version, so the same advice applies to all.
  • Adversarial, low: the notes list auth.client_secret under renamed keys and then warn that auth.clientSecret is deprecated. Both hold; the rename table in the upgrade notes now says so.
  • Adversarial, low: the warning also shows with auth.mode: noauth. Intended: the value is deprecated whatever the mode.
  • Adversarial, low: a checksum annotation to restart the API when the Secret changes. It would change the pod template for all releases; the upgrade notes say to restart instead.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Deprecate the Swagger UI OAuth client secret and provide migration guidance for public OIDC client configuration.

Enhancements:

  • Deprecate the Swagger UI OAuth client secret configuration and guide deployments toward public OIDC clients.
  • Clear the deprecated client secret from the generated Kubernetes Secret when it is unset while retaining compatibility for older API images.
  • Warn users when the deprecated client secret is configured, including legacy key usage, without exposing the secret.

Documentation:

  • Update chart configuration, deployment, and upgrade documentation for public Swagger UI clients and removal of the deprecated secret.

Tests:

  • Add coverage for deprecated client-secret rendering, clearing, warnings, legacy keys, and value types.

uniqueg and others added 3 commits November 7, 2026 17:09
tesk-api 1.2.0 and later treat the Swagger UI as a public client and
ignore its client secret. Render the secret key only if the value is
set, warn in the notes when it is, and document the deprecation and
the upgrade steps.

Closes #257

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Render the secret key empty when auth.clientSecret is unset, so an
upgrade also clears a stored value; share an isSet helper; one notes
warning (a public client needs no secret); tighten docs and schema.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

API

Update the values schema to describe the deprecated auth.clientSecret setting.

  • charts/tesk/values.schema.json L295-299

Implementation

Add shared set-value detection and use it for the FTP and client-secret warnings, including values YAML may parse as 0 or false.

  • charts/tesk/templates/_helpers.tpl L139, L148-156, L174-183

Configuration

Render an empty OAuth Secret value when the deprecated client secret is unset, while retaining the environment-variable wiring for older API images.

  • charts/tesk/templates/common/oauth-client-secret.yaml L13-17
  • charts/tesk/templates/common/tesk-deployment.yaml L144-145
  • charts/tesk/values.yaml L115-118

Documentation

Document the public-client recommendation, the deprecation, and the steps to remove and rotate the secret and restart the API if needed.

  • docs/configuration.md L108, L165
  • docs/deployment.md L50-51, L236-241
  • docs/upgrading.md L12-32, L99

Tests

Cover empty and set client-secret rendering, warning behavior and redaction, and compatibility with the earlier chart's null value.

  • tests/test_chart.py L598-615, L891-918, L1176-1206 (+3 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d1a0d0d) to head (bf4f970).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #258   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          229       229           
=========================================
  Hits           229       229           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 7, 2026 16:34

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 3 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="charts/tesk/templates/common/oauth-client-secret.yaml" line_range="17" />
<code_context>
+  Empty if unset, so that an upgrade also clears a value set before (Helm
+  can't remove a key of stringData from the stored data) */}}
+  {{- $secret := index $values "auth.clientSecret" }}
+  secret: {{ if include "tesk.isSet" $secret }}{{ include "tesk.secretValue" $secret }}{{ else }}""{{ end }}
 {{- end }}
</code_context>
<issue_to_address>
**Removed secret remains stored**

When an operator removes `auth.clientSecret` from their values files and upgrades with `--reuse-values`, `tesk.resolveValues` retains the prior release value, so `tesk.isSet` treats it as set and the template renders the old secret. The Secret stays populated and older API images keep receiving the old value.

Update value resolution or the template so removing `auth.clientSecret` clears the Secret even when the upgrade uses `--reuse-values`.
</issue_to_address>

### Comment 2
<location path="docs/upgrading.md" line_range="20" />
<code_context>
+older tesk-api images, and its notes warn when it is set; a future release
+may remove it. When you upgrade:
+
+- Remove `auth.clientSecret` (or `auth.client_secret`) from your values
+  (e.g., `secrets.yaml`). The chart then sets the secret's `secret` key to
+  empty, which also clears the value stored before. Running pods keep the
</code_context>
<issue_to_address>
**Reuse upgrades retain the secret**

When operators use `--reuse-values` after removing the key only from their values files, when operators remove `auth.clientSecret` from their files but run `helm upgrade --reuse-values`, `tesk.resolveValues` still sees the value retained from the previous release and renders it as set. The Secret therefore keeps the old secret and the notes continue to warn; tell operators to upgrade without `--reuse-values` or explicitly override the value to null.

In the upgrade instructions, say to run without `--reuse-values` or explicitly set `auth.clientSecret=null` (and the legacy alias if applicable).
</issue_to_address>

### Comment 3
<location path="tests/test_chart.py" line_range="1079" />
<code_context>
     assert get(manifests, "Secret", "oauth-client-secret")["stringData"] == {
         "id": None,
-        "secret": None,
+        "secret": "",
     }

</code_context>
<issue_to_address>
**Unset-secret test description is false**

When `auth.clientSecret` is unset, `test_secret_unset` now expects the OAuth secret to be empty, but its docstring says unset credentials render as null; readers get the wrong description of the test's behavior.

Update the docstring to distinguish the FTP credentials, which remain null, from the OAuth client secret, which is empty.
</issue_to_address>

Linked issues

#257 Deprecate the Swagger UI client secret value · 5 of 5 met

# Requirement Status Notes
1 Document the deprecation and tesk-api 1.2.0 behavior in the values file, schema, configuration reference, and deployment guide. ✅ Met The values file, schema, configuration reference, and deployment guide explain that the Swagger UI is a public client and tesk-api 1.2.0 and later ignore the secret.
2 Render the OAuth Secret's secret key empty when the value is unset, and preserve the value when it is set. ✅ Met The template renders an empty string when auth.clientSecret is unset or empty, and uses the secret value otherwise.
3 Warn in the notes when auth.clientSecret or auth.client_secret is set. ✅ Met The notes check the resolved value, including the legacy key, and the shared helper treats values such as 0 and false as set.
4 Document upgrade steps to remove the value, register a public client, and rotate the secret at the identity provider. ✅ Met The upgrading guide includes all three steps and explains that a restart may be needed to clear the value from running pods.
5 Add tests for the unset and set cases, and describe the deprecation in the docs and upgrade notes. ✅ Met Tests cover unset, empty, null, and set values, as well as the warning for the legacy key; the relevant documentation is updated.

Sourcery assessment

Needs a human reviewer. 2 findings to address first, and when the deprecated value is unset, the chart writes an empty secret key, clearing the credential from the Kubernetes Secret. An older API image that still reads it could lose Swagger UI login; restoring the value and redeploying can repair this bounded configuration loss.

Blocking findings: charts/tesk/templates/common/oauth-client-secret.yaml:17, docs/upgrading.md:20


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread docs/upgrading.md Resolved
Comment thread tests/test_chart.py Resolved
@uniqueg
uniqueg merged commit 573ff5e into dev Nov 7, 2026
21 checks passed
@uniqueg
uniqueg deleted the chore/client-secret-deprecation branch November 7, 2026 16:50
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.

Deprecate the Swagger UI client secret value

1 participant