Skip to content

feat(chart): set the OIDC provider and groups - #284

Merged
uniqueg merged 5 commits into
devfrom
feat/281-oidc-settings
Nov 11, 2026
Merged

uniqueg merged 5 commits into
devfrom
feat/281-oidc-settings

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Lets deployments with an OIDC provider other than ELIXIR AAI (e.g., LS Login) set tesk-api's provider and group settings through values. All new values are optional and are passed on only when set, so tesk-api's defaults apply otherwise:

  • auth.userInfoUri sets SECURITY_OAUTH2_RESOURCE_USER_INFO_URI.
  • auth.groups.claim, prefix, suffix, parentGroup and adminSubgroup set TESK_API_AUTHORISATION_GROUPS_CLAIM, …_GROUP_PREFIX, …_GROUP_SUFFIX, …_PARENT_GROUP and …_ADMIN_SUBGROUP.
  • auth.swaggerOauth.authorizationEndpoint, tokenEndpoint and scopes set TESK_API_SWAGGER_OAUTH_AUTHORIZATION_ENDPOINT, …_TOKEN_ENDPOINT and …_SCOPES.
  • The schema closes both maps, and checks that the endpoints are HTTP(S) URLs.
  • auth.envBaseGroup and auth.envSubgroup are now passed on only when set, and always as strings. Before, they were passed as empty text, or unquoted (a 0 broke the Deployment). This lets auth.groups.parentGroup and auth.envSubgroup make up the environment group when envBaseGroup is "". The notes warn if parentGroup is set while envBaseGroup replaces it.
  • The chart no longer sets the Swagger UI's scopes itself. It used to set them in TESK_API_SWAGGER-OAUTH_SCOPES, which is not tesk-api's documented variable, and with the same value as tesk-api's default. tesk-api's default scopes now apply unless auth.swaggerOauth.scopes is set; they also follow auth.groups.claim.
  • Numbers from values files are rendered as written (tesk.secretValue), not in scientific notation.

Docs:

  • The configuration reference has all the new values and the corrected envBaseGroup/envSubgroup semantics.
  • The deployment guide has a new section, "LS Login and other providers", with an example. Its endpoints were checked against LS Login's discovery document: user info https://login.aai.lifescience-ri.eu/oidc/userinfo, authorize …/authorize, token …/token, claim eduperson_entitlement. The entitlement format urn:geant:lifescience-ri.eu:group:<vo>:<group>#aai.lifescience-ri.eu comes from Perun's entitlement docs. A test renders the example from the docs.
  • The upgrade notes (0.3.0) have a new section.
  • The misleading "LS Login (ELIXIR AAI)" wording is fixed in values.yaml, the schema, configuration.md and deployment.md: the defaults are ELIXIR AAI's.

Decisions:

  • The delimiter (TESK_API_AUTHORISATION_DELIMITER) is not exposed, because tesk-api recognises teams by : whatever it is (as the issue's proposal leaves it out). TESK_API_SWAGGER_OAUTH_IMPLICIT is not exposed either.
  • No generic tesk.extraEnv (the issue's alternative): it's out of scope here and can get its own issue if wanted.
  • Defaults are unchanged (envSubgroup: CSC, envBaseGroup: ECP_CLN). The rendered Deployment with default values differs from dev only by the removed scopes variable and the order and quoting of the two group variables. Behaviour is the same, but the pod restarts on upgrade.
  • No version bump: this goes into the unreleased chart 0.3.0. The curated release notes (docs/releases/0.3.0.md) have a Features bullet (feat(chart): set tesk-api's OIDC and group settings #281, feat(chart): set the OIDC provider and groups #284), and the intro mentions the new settings.

Verification

Local runs with Helm v3.22.1, as pinned in CI:

  • helm lint charts/tesk --strict: passed.
  • helm template tesk charts/tesk --namespace tesk: rendered.
  • REQUIRE_HELM=1 pytest tests/test_chart.py: 478 passed (the dev branch has 425; 53 new). The new tests cover every value in auth and noauth mode, null and empty values, numbers and booleans from --set and from values files, schema rejections, the NOTES warning, and the LS Login example from the docs.
  • coverage run -m pytest --ignore=tests/test_chart.py: 156 passed, 100% coverage.
  • pre-commit run --all-files: passed.
  • mkdocs build --strict: passed.
  • Not run locally: the kind install (Chart install). The sandbox blocks the Docker socket and kind isn't installed, so CI runs it.

CI (run 42904474370): all checks passed, including Chart install (kind), Chart, Lint, Test, Docs, Release readiness, CI passed, CodeQL, Codecov and the Read the Docs preview.

Review

Full review (Helm chart): adversarial-reviewer and quality-reviewer, then a second adversarial round after the logic fix. All findings were fixed:

  • The docs now say that the LS Login environment group itself must be released, and that group names are URL-encoded in the claim.
  • Whole numbers from values files are rendered as written, and the error for numbers too large to be exact names the auth values.
  • A notes test with auth.groups: null was added.
  • PROVIDER and PROVIDER_VALUES are now checked to stay in sync.
  • The LS Login paragraph was reflowed.

Declined review findings

  • The tesk-api defaults quoted in the docs (EBI, GA4GH:GA4GH-CAP, ADMIN, the ELIXIR prefix and suffix) aren't tied to tesk-api by a test. They were checked by hand against tesk-api v1.2.0's application.properties, and the chart pins tesk-api 1.2.0 as its appVersion.

Open questions

None.

Closes #281

🤖 Generated with Claude Code

https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV

Summary by Sourcery

Enable Helm deployments to configure OIDC providers and group authorization settings while preserving tesk-api defaults when values are unset.

New Features:

  • Add optional Helm values for configuring non-default OIDC providers, group claims, group naming, environment groups, and Swagger OAuth endpoints and scopes.
  • Document and provide a tested LS Login configuration example.

Bug Fixes:

  • Preserve configured numeric and boolean authentication values as strings and avoid scientific notation when rendering values from files.
  • Stop overriding tesk-api's default Swagger scopes with an undocumented environment variable.
  • Only pass optional authentication settings when explicitly set, allowing tesk-api defaults to apply.

Enhancements:

  • Add validation and warnings for authentication URLs, insecure user-info endpoints, and conflicting environment-group settings.
  • Clarify authentication configuration, provider defaults, environment-group semantics, and upgrade guidance.

Documentation:

  • Update the configuration, deployment, release, and upgrade documentation for provider-specific authentication settings.

Tests:

  • Expand chart coverage for provider settings, defaults, null and scalar values, schema validation, warnings, and the documented LS Login example.

uniqueg and others added 3 commits November 10, 2026 21:41
Add the optional values auth.userInfoUri, auth.groups.* (claim, prefix,
suffix, parentGroup, adminSubgroup) and auth.swaggerOauth.*
(authorizationEndpoint, tokenEndpoint, scopes), so that deployments with
another OIDC provider than ELIXIR AAI (e.g., LS Login) can set the user
info endpoint, the group names and the Swagger UI's endpoints. Each is
passed on to tesk-api only when set, so tesk-api's defaults apply
otherwise; the schema checks that the endpoints are HTTP(S) URLs.

auth.envBaseGroup and auth.envSubgroup are passed on only when set too,
and as strings, so that the parent group can make up the environment
group; the notes warn if auth.groups.parentGroup is set while
auth.envBaseGroup replaces it. The chart no longer sets the Swagger UI's
scopes itself (in a variable other than tesk-api's documented one), so
tesk-api's default scopes, which are the same and follow the groups
claim, apply unless auth.swaggerOauth.scopes is set.

Document the values, an example for LS Login (endpoints checked against
its discovery document) and the upgrade notes, and fix the comment that
called tesk-api's default group model that of LS Login.

Closes #281

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Render the provider and group values with tesk.secretValue, so that
whole numbers from values files (which Helm reads as floats) aren't
rendered in scientific notation. Test the notes with auth.groups null.
Document that the LS Login environment group itself must be released,
and that group names are URL-encoded in the claim.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
tesk.secretValue now also renders the provider and group values under
auth, so its error for whole numbers too large to be exact names them
too, instead of calling every value a secret. Test that path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Configuration

Define the optional OIDC and group settings, validate their values, and render only set values as strings for tesk-api, including the related warnings and removal of the old Swagger scopes override.

  • charts/tesk/templates/_helpers.tpl L300-316, L360-361, L368
  • charts/tesk/templates/common/tesk-deployment.yaml L109-131, L198 (removed lines)
  • charts/tesk/values.schema.json L375-419, L481-513
  • charts/tesk/values.yaml L164-198, L235-247

Documentation

Document the new provider and group settings, LS Login configuration, changed environment-group semantics, and upgrade impact.

  • docs/configuration.md L116-123, L131-140
  • docs/deployment.md L246-311, L400-402
  • docs/releases/0.3.0.md L1, L16
  • docs/upgrading.md L447-467

Tests

Test provider and group defaults, value rendering and validation, warnings, and the LS Login example documented in the deployment guide.

  • tests/test_chart.py L252-596, L2515-2517

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (65db464) to head (9cd39fa).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #284   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          422       422           
=========================================
  Hits           422       422           

☔ 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 10, 2026 21:26
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Linked issues

Checked at commit 9cd39fa

#281 feat(chart): set tesk-api's OIDC and group settings · 4 of 4 met

# Requirement Status Notes
1 Add optional values for the OIDC user-info endpoint, group settings, and Swagger OAuth endpoints and scopes, passing them to tesk-api only when set. ✅ Met The deployment template maps each requested value to its tesk-api environment variable and omits unset or empty values, preserving tesk-api defaults.
2 Add chart tests for the new settings. ✅ Met Tests cover each setting, defaults, null and empty values, scalar values, and the documented LS Login example.
3 Document the values in the configuration reference and provide an example for a provider other than ELIXIR AAI. ✅ Met The configuration reference lists the new values, and the deployment guide includes an LS Login example.
4 Fix the comment that calls tesk-api's default group model that of LS Login. ✅ Met The values and documentation now identify the defaults as ELIXIR AAI's.

@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/tesk-deployment.yaml" line_range="116" />
<code_context>
+        {{- $groups := default dict .Values.auth.groups }}
+        {{- $swaggerOauth := default dict .Values.auth.swaggerOauth }}
+        {{- range $variable, $value := dict
+          "SECURITY_OAUTH2_RESOURCE_USER_INFO_URI" .Values.auth.userInfoUri
+          "TESK_API_AUTHORISATION_GROUPS_CLAIM" $groups.claim
+          "TESK_API_AUTHORISATION_GROUP_PREFIX" $groups.prefix
</code_context>
<issue_to_address>
**Access tokens sent over plaintext**

When a deployment configures `auth.userInfoUri` with an `http://` URL, tesk-api sends each caller’s bearer token to the configured user-info endpoint to validate it, so a network attacker can intercept the token and use it to access the API as that caller.

Require HTTPS for `auth.userInfoUri`, allowing HTTP only for an explicitly constrained local-development case if needed.
</issue_to_address>

### Comment 2
<location path="charts/tesk/templates/common/tesk-deployment.yaml" line_range="129" />
<code_context>
+          "TESK_API_SWAGGER_OAUTH_SCOPES" $swaggerOauth.scopes }}
+        {{- if include "tesk.isSet" $value }}
+        - name: {{ $variable }}
+          value: {{ include "tesk.secretValue" $value }}
+        {{- end }}
+        {{- end }}
</code_context>
<issue_to_address>
**Requests fail during provider rollout**

When a Helm upgrade changes the provider or group settings while the Deployment is serving traffic, the Deployment serves old and new API pods concurrently, and requests routed to pods with different provider or group settings enforce different authorization rules. Callers therefore see intermittent authentication or authorization failures until the rollout finishes.

Use a rollout strategy that prevents old and new authorization configurations from serving traffic simultaneously, or require a compatible staged configuration during provider changes.
</issue_to_address>

### Comment 3
<location path="charts/tesk/templates/_helpers.tpl" line_range="358" />
<code_context>
 */}}
 {{- define "tesk.secretValue" -}}
 {{- if and (kindIs "float64" .) (eq (floor .) .) -}}
 {{- if and (lt . 9007199254740992.0) (gt . -9007199254740992.0) -}}
 {{- printf "%.0f" . | quote -}}
 {{- else -}}
</code_context>
<issue_to_address>
**Exact numeric settings fail to render**

When an auth provider or group value is supplied as the YAML integer 9007199254740992 or -9007199254740992, `tesk.secretValue` rejects these exactly representable integers because its bound check is strict, so Helm rendering fails instead of preserving the value.

Make the `tesk.secretValue` bounds inclusive so these exactly representable integers render successfully.

Also at `charts/tesk/templates/common/tesk-deployment.yaml:129-130`.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 3 findings to address first, and a configured user-info endpoint and group mapping now determine which tokens and group memberships tesk-api accepts for authorization. A wrong mapping could grant unintended access while deployed; reverting restores the chart settings, but any data exposed during that time cannot be recovered.

Blocking findings: charts/tesk/templates/common/tesk-deployment.yaml:116, charts/tesk/templates/common/tesk-deployment.yaml:129, charts/tesk/templates/_helpers.tpl:358


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

Comment thread charts/tesk/templates/_helpers.tpl Resolved
tesk-api sends the access token of every request to the user info
endpoint, so the notes warn if auth.userInfoUri is an http:// URL. Such
URLs stay allowed, for providers reached only within a trusted network
(e.g., in the cluster).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
@uniqueg
uniqueg merged commit 1b2c168 into dev Nov 11, 2026
23 checks passed
@uniqueg
uniqueg deleted the feat/281-oidc-settings branch November 11, 2026 09:49
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.

feat(chart): set tesk-api's OIDC and group settings

1 participant