Repository navigation
feat!: authenticate at WES backends - #213
Conversation
proWES authenticates at WES instances with credentials of its own, as the auth of their entries says: a token of its client at the identity provider of custom.wes.client_credentials (the default; client ID and secret in PROWES_CLIENT_ID and PROWES_CLIENT_SECRET), HTTP Basic credentials from named environment variables, or none. Discovered WES instances get the credentials of their registry entry. Credentials are looked up for each request from the current backend list, with FOCA's backend credentials; WES instances the list no longer yields get no request (no_credentials, not retried), and tracking their runs fails. Service infos are read without credentials. The worker task no longer takes a jwt argument. The startup check is FOCA's check_backends, which refuses missing environment variables and warns about basic, none and http. The smoke test's fake WES now issues tokens of proWES's client and requires them on its WES API over HTTPS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Access control gets a section on proWES's credentials at WES instances; configuration, deployment (Secret via prowes.extraEnv), getting started, API errors and the upgrade notes follow the new default auth: client_credentials. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The WESkit integration test (#209) lists WESkit without auth, which now defaults to client_credentials: set auth: none, as for Sapporo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tasks of earlier versions still pass jwt to the tracking task: keep it as an ignored argument, so that they run after an upgrade. One check of listed WES instances (WesClient.require_listed) serves the client and the worker. Docs: only the app checks credentials on startup (the worker fails to track runs), failed requests name the no_credentials cause, and init_app documents RuntimeError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Registry entries default to auth: client_credentials, so without audience_parameter every discovered WES instance gets the token that the configured ones accept: warn on startup, and document the replay risk. The app keeps sending jwt: None to the tracking task, which workers of earlier versions require during a rolling update. Docs say how failed token fetches affect forwarding and tracking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The worker set runs to SYSTEM_ERROR after one lookup of their WES instance, e.g., when a registry couldn't be read when tracking started. It now looks the instance up again, up to polling_attempts times, polling_wait seconds apart, before giving up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
📖 9 files modified
Preview · build overview · proWES · built Dec. 4, 2026, 1:49 a.m. UTC |
Reviewer's GuideData structuresExtend the WES configuration model to support FOCA credentials, a client-credentials provider, and validation that backend entries fit that provider.
APIKeep the tracking-task argument compatible with queued work from earlier versions while making clear that the client token is ignored.
Keep sending the legacy task argument during rolling upgrades so workers from earlier versions can accept the task payload.
Uses of the APIUse the current backend entry to authenticate each outbound WES request, refuse requests when the instance is no longer listed, and leave service-info reads unauthenticated.
Use backend credentials when forwarding and canceling runs, and have the worker retry backend lookups before failing tracking for an unlisted WES instance.
ImplementationCheck configured backends and credential availability at startup, warn about shared registry tokens, and resolve credentials from the current backend list for each request.
ConfigurationRequire chart-provided WES credential environment variables to come from Kubernetes Secrets, and account for missing or non-map config sections.
Pass proWES's client ID and secret to both Compose services and configure the smoke environment to exercise authenticated WES requests.
Update the base WES configuration comments to describe the default client-credentials mode and alternatives.
Set integration backends that need no authentication to
DocumentationExplain the credential modes, audience and registry-token behavior, failure cases, and client-token separation for outbound WES requests.
Document the new WES configuration fields, client setup, and behavior for runs whose backend is no longer yielded.
Describe supplying WES credentials from Kubernetes Secrets and the required pod restart after Secret changes.
Clarify that the getting-started example uses an unauthenticated WES backend.
Explain that requests without available WES credentials are not sent and how the worker reports those failures.
Document the breaking default change, worker upgrade requirements, and the loss of tracking for backends no longer in the list.
Update the chart README with how to configure proWES's client and opt out for backends that need no credentials.
Clarify how WES credential refusals are represented in the API response.
TestsCover credential modes, audiences, discovered and removed backends, unavailable credentials, unauthenticated service-info reads, and startup validation and warnings.
Exercise a real client-credentials token exchange and authenticated WES request over HTTPS in the fake WES used by the smoke test.
Update backend and client tests for the new default, request authentication, and refusal to send requests for unlisted instances.
Adjust retry, routing, workflow, and tracking tests for explicit no-auth fixtures and the worker's handling of legacy tasks and unlisted backends.
Verify Helm rejects literal or ConfigMap-sourced credentials while accepting Secret-backed values and tolerating config sections without backends.
Validate the custom configuration of smoke and integration overlays in unit tests so invalid backend authentication settings fail early.
Other changesFiles not grouped.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #213 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 1404 1451 +47
=========================================
+ Hits 1404 1451 +47 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit 43d46f4 #182 feat: authenticate at WES backends · 8 of 10 met
|
There was a problem hiding this comment.
Hey - I've found 7 issues
Sourcery assessment
Needs a human reviewer. 5 findings to address first, and proWES now sends its own bearer token or Basic credentials to configured WES backends; a backend that receives them could retain or replay them, and reverting stops future sends but cannot undo credentials already exposed. By default, backends share a token unless audience-specific tokens are configured.
Blocking findings: pro_wes/ga4gh/wes/client_wes.py:261, pro_wes/ga4gh/wes/workflow_runs.py:499, pro_wes/ga4gh/wes/client_wes.py:249, pro_wes/ga4gh/wes/client_wes.py:543, pro_wes/tasks/track_run_progress.py:121
Long-lived clients (the worker's) kept the entry found when they were created: a WES instance removed from the backend list kept getting requests. require_listed() now looks it up again for each request. Upgrade notes: upgrade workers together with the app. Test of a discovered WES instance with auth: none. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rendering fails if prowes.extraEnv sets PROWES_CLIENT_SECRET, or a variable that the basic of a backend entry in config names, from a value instead of a Secret (valueFrom), as #182 asks: credentials of WES instances come from Secrets only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chart refuses WES credentials in prowes.extraEnv unless they come from valueFrom.secretKeyRef (a ConfigMap or field ref was accepted). Docker Compose passes PROWES_CLIENT_ID and PROWES_CLIENT_SECRET from the host to the app and the worker, as proTES does. Docs: the upgrade snippet for the former WES instance sets auth: none; stored runs are tracked only while their WES instance stays listed; access control and the chart README say where the client comes from. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chart's check of WES credentials in prowes.extraEnv failed with a template error when config.custom or config.custom.wes was null or no map (e.g., an empty `wes:`); such sections now count as no backends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Conquest integration test (#211, merged into dev meanwhile) lists Conquest without `auth`, which now defaults to client_credentials, so the app and the worker refused the config. It sets `auth: none`. A unit test validates the app config of every smoke and integration overlay, so that such configs fail locally, not only in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
proWES authenticates at the WES instances it forwards runs to with credentials of its own, never with those of its clients, as the
authof their entries incustom.wes.backendssays (FOCA's backend credentials):client_credentials(the default): a token of proWES's client at the identity provider of the newcustom.wes.client_credentials(issuerortoken_endpoint, optionalaudience_parameterfor a token per WES instance, with the entry'saudienceor its URL); client ID and secret inPROWES_CLIENT_IDandPROWES_CLIENT_SECRET.basic: HTTP Basic credentials from the environment variables that the entry'sbasicnames (transitional).none: no credentials.Discovered WES instances get the credentials of their registry entry. Credentials are looked up for each request in the current backend list: WES instances that the list no longer yields get no request (
no_credentials, not retried), and tracking their runs fails (SYSTEM_ERROR). Service infos, read to choose WES instances, are read without credentials. The worker task ignores itsjwtargument (kept for tasks queued by earlier versions). The startup check is FOCA'scheck_backends: it refuses missing environment variables and warns aboutauth: basic,auth: noneandhttp.Breaking: the default
authwasnone(the only value accepted); deployments set the client, orauth: noneon entries of WES instances that require no credentials (upgrade notes indocs/upgrading.md).Tests and docs:
tests/ga4gh/wes/test_credentials.py), and an end-to-end test of a real token fetch from the smoke test's fake WES over HTTPS (test_tls_with_client_token).auth: none.docs/access-control.md; configuration, deployment (Secret viaprowes.extraEnv), getting started, API errors, upgrade notes, chart README, chart values and base config comments.prowes.extraEnvmust setPROWES_CLIENT_SECRETand the variables thatbasicof entries names from a Secret (valueFrom.secretKeyRef); rendering fails otherwise (chart tests). Docker Compose passesPROWES_CLIENT_IDandPROWES_CLIENT_SECRETfrom the host to the app and the worker.Deviations from the issue text (goal holds):
BackendList.find, instead of storing a backend id with each run; runs stored before the upgrade work the same way.jwtargument but ignores it, instead of dropping it, so that tasks queued by earlier versions still run during an upgrade; no token is passed on.Closes #182
Verification
coverage run -m pytest --deselect tests/test_chart.pyandcoverage report: 978 passed, 100% coverage.pytest tests/test_chart.py: 96 passed;helm lint deployment --strict: clean.ruff check,ruff format --check(0.17.5),mypy: clean.mkdocs build --strict: clean.semgrep scan --config=.semgrep --error,ast-grep scan: clean.CI: all checks passed on 43d46f4 (run 47246659145): Test, Lint, Docs, Chart, Chart install, Smoke test, Integration (Sapporo, WESkit, Conquest), Scan image, Trivy, codecov. Run 47241368669 on 7920b6c had failed Integration (Conquest): its config from #211 (merged into dev meanwhile) lacked
auth: none; fixed, with a unit test validating every smoke and integration overlay (tests/test_overlays.py).Follow-ups
401or403of a WES instance is still answered with the same status (as before, documented indocs/api.md); now it means that the WES instance refused proWES's credentials, not the client's. Whether to map it to500instead is a separate change.Declined review findings
Reviewed with the adversarial and quality reviewers in two rounds, and the contract reviewer. Contract review fixed: breaking-change mark in the title,
auth: nonein the upgrade snippet, Compose passes the client, stored runs tracked only while listed, chart guard requiressecretKeyRef, chart README. An adversarial review of these fixes found no high or medium findings; its two low ones are fixed (the guard renders with emptyconfig.custom/wessections; helper comment). Round 2 fixed: the worker looks a WES instance that the list doesn't yield up again (up topolling_attemptstimes,polling_waitapart) before settingSYSTEM_ERROR, e.g., while a registry can't be read; docstring and wording of the shared-token warning. Round 1 fixed: the worker task keeps an ignoredjwtargument and the app keeps sendingjwt: None(tasks queued across a rolling update), one check of listed WES instances (WesClient.require_listed), a startup warning (and docs) when registry entries would share proWES's token withoutaudience_parameter, docs on the worker (not checked on startup),no_credentialsin operations,init_appexceptions, test layout.docs/access-control.mdinstead.auth: client_credentialswithoutaudience_parameter(adversarial, medium, alternative fix): not all identity providers support audiences; a warning plus docs (as D-267 did for proTES's shared token) keeps such setups possible.FakeHttpand_registryinto a shared test helper module (quality, low): the new test module imports them fromtest_client_wes.py; a move touches many tests unrelated to this issue.docs/getting-started.mdexplainingauth: none(quality, low): the sentence before the example already does.auth: none. Answered: no credentials in task payloads for old workers (upgrade workers with the app),WesClienttoken API is internal, the initial run-log fetch already counts towardspolling_attempts, backend lookup by stored URL instead of a stored id (deviation above),jwtkept as an ignored argument for queued tasks.Open questions
None.
🤖 Generated with Claude Code