Integration - #48
Merged
Merged
Conversation
rhysrevans3
approved these changes
Jun 25, 2026
rhysrevans3
left a comment
Collaborator
There was a problem hiding this comment.
This looks really good @lukaszlacinski I've made a new release of esgf-core-utils:1.1.0 with your changes to unify the authorizers. Happy for this to be merged once those changes have been made 👍
sturoscy-personal
approved these changes
Jul 7, 2026
sturoscy-personal
left a comment
Collaborator
There was a problem hiding this comment.
Fixing merge conflicts.
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.
PR #48 — Integration Summary
Repo: ESGF/stac-transaction-api
Branch:
integration→mainAuthor: @lukaszlacinski
Status: Open — awaiting review from @rhysrevans3, @sturoscy-personal
Commits: 13
Overview
This PR integrates
esgf-core-utilsinto the Globus authorization layer,introduces a structured Pydantic auth model, adds access control policy
caching, and fixes several issues in the PATCH request handling path.
New File:
src/authorizer/globus_auth.pyIntroduces a clean Pydantic-based authorization model hierarchy to replace
ad-hoc dict handling of Globus entitlements.
Models:
NodeProjectNodesNodeobjects; handles node-level asset authorizationProjectsProjectobjects; handles project-level authorizationGlobusAuthRoles (
Literaltype):CREATE,UPDATE,DELETE,REPLICATE,REVOKEKey behavior:
GlobusAuth.add(entitlements)parses raw Globus entitlement strings viaregex and populates per-project and per-node role sets.
GlobusAuth.authorize(collection_id, item, role, ...)checks both projectand node permissions, raising
AuthorizationException(fromesgf-core-utils) on failure.Nodes.authorize()recursively checks asset HREFs includingalternateentries.
into the existing set rather than replaced.
Exceptions sourced from
esgf_core_utils.models.exceptions:MissingPermissionException— raised byProjects/Nodeson missingpermission
AuthorizationException— raised byGlobusAuth, wrapping the above withrequest/event context
Modified:
src/authorizer/globus_authorizer.pyAccess Control Policy Caching
Added a TTL-based in-memory cache for the access control policy (the list of
entitlement strings mapping Globus groups to roles):
_CachedPolicydataclass holds the policy list and an expiry timestamp._policy_lock(threadingLock) guards cache reads and writes.get_access_control_policy()returns the cached policy if still valid;otherwise reloads from
settings.client.policy_path(supports bothfile://URIs and HTTP URLs viaurllib3).exists, it is returned with a warning log rather than raising.
_authorizer_context()helperNew function that builds a
GlobusAuthobject from token introspection dataand cached policy entitlements:
auth["groups"]list.memberships.
GlobusAuthwith those entitlements applied.Middleware dispatch changes
Both the cache-hit and cache-miss paths in
GlobusAuthorizerMiddleware.dispatch()now call
_authorizer_context(auth)and assign the resultingGlobusAuthobject to
request.state.authorizer, replacing the previous behavior ofassigning the raw
authdict directly.Modified:
src/client.pyinstitute_idfromitem_id(parsed from theURL path) rather than from the request body, making it robust when the body
omits that field.
collection_idmatchesitem.collection, relaxinga validation constraint that was failing legitimate cross-collection
references.
validate_patch()function signature.Dump patch operations correctly).Modified:
src/settings/globus.pyesgf-core-utilsinstead ofesgf-playground-utilsexample.envaccess_control_policy.json/.txtModified:
src/utils.pyRemoved unused module imports (cleanup).
Notable Migration
This PR completes the shift from
esgf-playground-utilstoesgf-core-utilsfor project and node definitions used in Globus authorization — consistent
with the refactor tracked in earlier work on
stac-transaction-api.