Repository navigation
fix: read entitlements from eduperson_entitlement - #39
Conversation
The node read entitlements only from the user info claim `entitlements`, as the operator's docs say. LS Login released them to other clients of the same issuer in `eduperson_entitlement` (generic-issues#46). The node would then refuse account A with `refused: entitlement`, which looks exactly like a missing group release in T3. The node now reads every claim in `TESTBED_ENTITLEMENT_CLAIMS` (default `entitlements,eduperson_entitlement`) and takes the union of their values. Its report names the claims it found (`entitlement_claims` in the session's rows), and `discovery` shows `scopes_supported` and `claims_supported`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document `TESTBED_ENTITLEMENT_CLAIMS` (configuration, template), what generic-issues#46 observed, and what T1 and T3 record: the entitlement scopes and claims the provider lists, the claim and scope the values came with, and a one-off login with the scope `eduperson_entitlement` if user info shows neither claim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A claim of another type made the whole result an error, so a user whose entitlement was in the other claim got 502. Now such a claim is skipped and named in `error`, `null` counts as absent, and `claims` is in every result. Document the behaviour, the trust in both claims, and the claim fields of `discovery` and `call` (review findings). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A skipped claim now shows as `entitlements_error` on an allowed request, too. Say so in troubleshooting and the command reference, test that the session's rows carry it, and update the policy's docstring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Documentation build overview
|
Reviewer's GuideData structuresDefine the default entitlement claim names and add the setting field that carries the configured claims for other code to use.
APIExpose which entitlement claims supplied values in hop rows and include supported scopes and claims in discovery output.
ImplementationRead and union configured user-info claims, report malformed claims without discarding valid values, and treat incomplete reads as unknown rather than denying access.
ConfigurationParse and apply
DocumentationDocument the configurable claim sources, the provider behavior that motivated them, how T1 and T3 verify releases, and how to interpret reports and troubleshoot entitlement outcomes.
TestsCover claim-source unions, malformed and absent claims, custom configuration, and the additional session and discovery fields.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Linked issuesChecked at commit c79ad70 #37 fix: read entitlements from eduperson_entitlement too · 7 of 7 met
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/testbed/settings.py" line_range="31" />
<code_context>
TARGET_PARAMS = ("audience", "resource", "resource-url", "both")
+# The claim of AARC-G069 and the operator's Entitlements page, and the one that
+# LS Login released to other clients of the same issuer
+ENTITLEMENT_CLAIMS = ("entitlements", "eduperson_entitlement")
</code_context>
<issue_to_address>
**Unassigned users gain access**
When LS Login populates `eduperson_entitlement` from home-organisation attributes with the configured required value, without that value representing the user's resource-group assignment, `Service._entitlements` unions that value with the other configured claims, and `_apply_policy` grants access when the union contains the required entitlement, so a user without the required Perun group gets access to the node.
Restrict policy matching to entitlements tied to the user's resource-group assignment instead of treating `eduperson_entitlement` values as sufficient.
Also at `src/testbed/service.py:154`.
</issue_to_address>
### Comment 2
<location path="src/testbed/settings.py" line_range="31" />
<code_context>
TARGET_PARAMS = ("audience", "resource", "resource-url", "both")
+# The claim of AARC-G069 and the operator's Entitlements page, and the one that
+# LS Login released to other clients of the same issuer
+ENTITLEMENT_CLAIMS = ("entitlements", "eduperson_entitlement")
</code_context>
<issue_to_address>
**Alternate claim scope is never requested**
When LS Login gates `eduperson_entitlement` on requesting the `eduperson_entitlement` scope, `DEFAULT_SCOPE` in `src/testbed/session.py:43` requests `entitlements` but not `eduperson_entitlement`, and the login parser uses it by default at line 211. When LS Login releases `eduperson_entitlement` only for its matching scope, the new claim reader receives no values and account A still gets refused for a missing entitlement.
Request the alternate scope by default where appropriate, or expose and document a setting that ensures the login and exchange request the scope required for the configured claim.
</issue_to_address>
### Comment 3
<location path="src/testbed/service.py" line_range="153" />
<code_context>
+ ):
+ invalid.append(name)
+ continue
+ sources.append(name)
+ values.update(dict.fromkeys(found))
+ result: dict[str, Any] = {"values": list(values), "claims": sources}
</code_context>
<issue_to_address>
**Empty claims appear as sources**
When a configured user-info claim is a well-formed empty list, `_entitlements` adds its name to `sources` before checking whether it contributed values, so `claims` and downstream `entitlement_claims` report a source with no entitlements, misleading operators and callers.
Only add a claim to `sources` when its list contains values.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 3 findings to address first, and by default, the node treats eduperson_entitlement as equally trusted with entitlements, so a value in that claim can satisfy the access policy and grant access. If that claim does not have the intended group semantics, reverting stops future grants but cannot undo data already accessed; the default trust decision has no built-in signal that it was wrong.
Blocking findings: src/testbed/settings.py:31, src/testbed/settings.py:31, src/testbed/service.py:153
Summary
The node read entitlements only from the user info claim
entitlements. LS Login released them to other clients of the same issuer ineduperson_entitlement(generic-issues#46), so account A could be refused withrefused: entitlement, which looks exactly like a missing group release in T3.TESTBED_ENTITLEMENT_CLAIMS(comma-separated, defaultentitlements,eduperson_entitlement, mock and LS Login). The node takes the union of the values, in order, without repeats; a string counts as one value.entitlements.claims,entitlement_claimsin the session's rows).entitlements_error;nullcounts as absent. The node allows only if a well-formed claim holds the entitlement, otherwise 502 if a claim couldn't be read, else 403 (still fails closed).discoveryalso showsscopes_supportedandclaims_supported, so that T1 records which entitlement scope and claim LS Login advertises.lslogin.env.example, assumptions (what gi#46 observed, that both claims are trusted equally, and to narrow the setting after T3), T1 (record the advertised scopes and claims), T3 (record the claim and scope; one login with the scopeeduperson_entitlementif user info shows neither claim), client registration, troubleshooting, design, command reference.Must be merged before the live LS Login session on Thursday 19 November.
Verification
pytest: 253 passed, coverage 100%. The regression tests cover values only ineduperson_entitlement, only inentitlements, in both (union, no duplicates), a single string, neither (403), one malformed claim with the entitlement in the other (200) and without (502),nullas absent, a custom setting, settings parsing,discoveryfields and session rows.pre-commit run --all-files: all hooks passed exceptgitleaksandactionlint, which were skipped locally (their Go toolchain can't be downloaded in the sandbox; no workflow changed). CI runs them.mkdocs build --strict: passed.docker compose run --rm e2e): not run locally (no Docker in this setup); CI runs them.Declined review findings
_entitlementsinto a helper (quality, low): four short literals, kept readable as they are.eduperson_entitlement(high), "alternate claim scope is never requested" (high), "empty claims appear as sources" (medium): answered in their threads; the union and the default scope follow the plan of fix: read entitlements from eduperson_entitlement too #37, the trust question is documented in the assumptions, and a present but empty claim is what T3 needs to see.Open questions
None.
Closes #37
🤖 Generated with Claude Code