Repository navigation
v0.23.0
Pre-releaseFOCA 0.23.0 hardens apps against clients that send large bodies or no tokens, and extends the plugin gateway for WES. Request bodies are limited by default (10 MiB, URL-encoded bodies 500 kB) and checked before requests are authenticated, and on operations with bearer tokens that FOCA validates, the token is checked before the body is read. Subjects are always namespaced by their issuer, also with a single trusted issuer, which changes the users that apps and FOCA store; existing deployments keep bare subjects with namespace: "" or rewrite them with the new command foca namespace-subjects. Plugins of WES gateways get runs in a defined shape, backend lists know WES, FOCA resolves the credentials of backends, and guarded HTTP clients and registry reads can trust private certificate authorities. Apps get helpers for lists paged with page tokens, patches of specifications can remove keys, the permissions API reports invalid fields, the plugin store limits the size of each namespace, and $ in patterns matches at the end only. Several changes need action in apps, deployments or clients: see the migration guide.
Breaking changes
- Subjects are namespaced by their issuer (
<namespace>|<subject>) also if only one issuer is trusted:get_current_subject(),get_on_behalf_of_user(),namespace_subject(), thePrincipalof gateway plugins, audit events, stored rules and roles (user:<namespace>|<subject>) and owner fields; stored bare users no longer apply, and apps refuse to start while configured rules name bare users. Setnamespace: ""for the issuer to keep subjects bare, or rewrite stored rules withfoca namespace-subjects(see Subjects are always namespaced by issuer) (#631, #773) - Request bodies larger than 10 MiB are rejected with
413by default (server.max_content_length, before without a limit), and URL-encoded bodies larger than 500 kB too (new settingserver.max_form_memory_size); bodies are checked before requests are authenticated. The configuration template no longer setsmax_content_length: null(#798, #813) - On operations that require bearer tokens validated by FOCA, the token is checked before the body is read: anonymous requests with too large bodies get
401instead of413,before_requesthooks run after this check, and apps that mock Connexion's security handler instead offoca.security.auth.validate_tokenmust replacevalidate_tokentoo (#814, #817) nullin patches of specifications removes keys (JSON Merge Patch, RFC 7396) instead of setting values tonull; files ofpathkeepnullvalues unlessmerge_null_removes: trueis set (#762, #763)- The permissions API (
/permissions) rejects invalid rules, identifiers and pages as invalid fields (problem typeinvalid-request, witherrorsand stable codes); its controllers raisefoca.errors.InvalidFieldsProbleminstead ofBadRequest(#760, #765) - The plugin store limits each namespace to
max_namespace_sizebytes (by default 16 MiB) and raisesfoca.plugins.StoreFullErrorbeyond it; store backends of their own must accept the new keyword argumentmax_sizeofset()andincrement(); with a database, sizes are kept in the new collectionplugin_store_sizes(#552, #774) - Plugins of WES gateways get runs (
POST /runs) in one shape, checked after each hook against the new limitsplugins.attachments(by default 256 files and 32 MiB per run); apps that pass payloads of another shape build them withfoca.plugins.wes.parse_run_request()(#781, #782) - A client's backend choice
{"type": "allow", ...}of identifiers only, none of which names a backend of the gateway, is refused with400(invalid-backends) byrun.route(); apps that route only some of their backends pass the others asknown(#808, #809) - A
$in apatternof a request body or parameter matches only at the end of the value, as in ECMA 262, so values with a trailing newline are refused with400(pattern-mismatch) (#797, #810)
Features
- Backend lists take WES instances (
type: ga4gh-wes, APIwes),ServiceEntryhas an optionalapi_path, andBackendList(entries, api=...)refuses entries of another API's type (#789, #791) - FOCA resolves the credentials of backends for TES and WES gateways:
ClientCredentialsConfig,TokenProvider(client credentials grant, cached per process),get_credentials(),check_backends(), and an optionalaudienceofServiceEntry(#794, #796) GuardedClienttakes aca_bundle(a file or directory of certificate authorities trusted instead of the public ones); TLS verification can't be turned off (#790, #792)fetch_json()takes aca_bundle, and registry entries of backend lists aregistry_ca_bundle, so that registries behind a private certificate authority can be read (#793, #795)foca.plugins.weswithparse_run_request(),check_run_request()andrun_request_form(), andhost.start()reads the tags of WES runs from the payload (#781, #782)merge_null_removesof specifications lets merged files ofpathremove keys withnull(#762, #763)foca.utils.paginationpages lists with page tokens (keyset pagination):get_page_size(),PageKeyandfind_page(), with invalid sizes and tokens as invalid fields (#799, #828)
Security
- Anonymous clients can no longer make apps parse request bodies of any size: bodies are limited by default and checked before authentication, and bearer tokens validated by FOCA are checked before bodies are read (#798, #813; #814, #817)
- Patterns ending in
$no longer accept a trailing newline, which let values past request validation that controllers then failed on (#797, #810) - The semgrep rules shared with the apps find disabled TLS checks in calls on any object (e.g.,
session.get(url, verify=False)) and more ways of decoding JWTs without verification or with algorithms from the token's header (#783, #784)
Fixes
- Choices of unknown backends are refused with
400instead of ending without a backend, which apps answered as an outage (#808, #809) - Page tokens that aren't strings (e.g., from JSON bodies) are refused with
400instead of failing with500, and page keys refuse fields that aren't a tuple of strings (#830, #829)
Documentation
- The migration guide covers every change that apps, deployments and clients may have to act on (#631, #773; #798, #813; #814, #817)
- Requests to backends discovered in registries go through
GuardedClient, which checks the address of each connection, notBackendSession, which is for the identity provider and configured backends (#824, #825) - The migration guide also names the stricter checks of backend lists (entries of another API's type,
audiencewithoutauth: client_credentials) and the limit of bare subjects containing|, and the API reference listsInvalidRuleError(#822, #823) - The docs of page tokens say when
find_page()raises, how items without sort fields are sorted, why to sort by values that the app sets, and how to accept empty tokens of generated clients (#830, #829) - The migration guide says that the endpoints for managing roles and the permissions API still accept bare users, which then apply to nobody (#822, #823)
- The examples no longer import Flask (#753, #764)
- The release commands of the contributing guide run in a worktree at the release commit (#756, #757)
Maintenance
- The release workflow checks that the tag is signed and that the version is not on PyPI or Docker Hub yet, and never moves image tags (#818, #819)
- The package and the library chart get separate generated release notes (#758, #759)
- CI cancels pull request runs only for new commits, and Dependabot labels all its pull requests (#761; #775, #776)
- The deadline tests of the HTTP client are deterministic (#815, #816)
- Release preparation for 0.23.0: citation metadata and release notes (#822, #823)
- Dependency updates (#766, #767, #768, #769, #770, #771, #777, #778, #800, #801, #802, #803, #804, #805, #806)
Commits
- docs: run release commands in a worktree by @uniqueg in #757
- ci: separate package and chart release notes by @uniqueg in #759
- ci: cancel PR runs only for new commits by @uniqueg in #761
- feat(spec): let null remove keys in spec patches by @uniqueg in #763
- docs: move the examples off Flask imports by @uniqueg in #764
- feat: report invalid fields in the permissions API by @uniqueg in #765
- feat(plugins): limit store namespace size by @uniqueg in #774
- ci: let Dependabot label all its pull requests by @uniqueg in #776
- feat(auth)!: always namespace subjects by issuer by @uniqueg in #773
- build(deps): Bump the github-actions group across 3 directories with 7 updates by @dependabot[bot] in #769
- feat(plugins): define the WES run request by @uniqueg in #782
- fix: catch disabled TLS checks in session calls by @uniqueg in #784
- build(deps): Bump the python-dependencies group across 1 directory with 7 updates by @dependabot[bot] in #770
- build(deps): Bump the ruff group across 2 directories with 1 update by @dependabot[bot] in #767
- build(deps): Bump the semgrep group across 2 directories with 1 update by @dependabot[bot] in #768
- build(deps): Bump python from
db20d85to07d4824in /docker in the python-images group across 1 directory by @dependabot[bot] in #766 - build(deps): Bump astral-sh/uv from 0.13.7 to 0.13.8 in /examples/petstore by @dependabot[bot] in #777
- build(deps): Bump astral-sh/uv from 0.13.7 to 0.13.8 in /examples/gateway by @dependabot[bot] in #778
- build(deps): Bump types-pyyaml from 6.0.12.20261030 to 6.0.12.20261113 by @dependabot[bot] in #771
- feat(http): let guarded clients trust other CAs by @uniqueg in #792
- feat(plugins): add WES to typed backend lists by @uniqueg in #791
- feat(plugins): let registry reads trust other CAs by @uniqueg in #795
- feat(plugins): add credentials of backends by @uniqueg in #796
- fix(plugins): reject backend choices without match by @uniqueg in #809
- fix: match pattern
$only at the end of values by @uniqueg in #810 - build(deps): Bump astral-sh/uv from 0.13.8 to 0.13.9 in /examples/gateway by @dependabot[bot] in #800
- build(deps): Bump astral-sh/uv from 0.13.8 to 0.13.9 in /examples/petstore by @dependabot[bot] in #801
- build(deps): Bump the ruff group across 2 directories with 1 update by @dependabot[bot] in #802
- build(deps): Bump the github-actions group across 1 directory with 3 updates by @dependabot[bot] in #803
- build(deps): Bump the semgrep group across 2 directories with 1 update by @dependabot[bot] in #804
- build(deps-dev): Update gunicorn requirement from <27,>=26.2 to >=26.2,<28 by @dependabot[bot] in #806
- build(deps): Bump the python-dependencies group across 3 directories with 4 updates by @dependabot[bot] in #805
- fix!: limit request bodies by default by @uniqueg in #813
- test: make HTTP deadline tests deterministic by @uniqueg in #816
- fix: check bearer tokens before reading bodies by @uniqueg in #817
- ci: check tag signature and released versions by @uniqueg in #819
- feat: add page-token pagination helpers by @uniqueg in #828
- docs: say BackendSession doesn't check addresses by @uniqueg in #825
- fix: refuse page tokens that aren't strings by @uniqueg in #829
- build: prepare the 0.23.0 release by @uniqueg in #823
Full Changelog: v0.22.0...v0.23.0