Repository navigation
feat(cedar): dataset-scoped NIH Approved-User gate (attest#100) - #114
Merged
Merged
Conversation
The cedar-nih-approved-user policy was BLANKET — approval for any NIH study granted access to every nih_controlled_access dataset. Bind per-dataset: principal.nih_approval_dua_ids.contains(resource.dua_id). (#11, ADR 0002 Decision 3; consumes the attest:nih-dua-ids set attest approval writes.) Three coupled changes make the DUA set usable end to end: - evaluator toValue: lower []string -> cedar types.Set (was stringified, so .contains() could never work). - compiler inferCedarType: plural 'ids' -> Set<String>, ahead of the 'id' string indicator, so nih_approval_dua_ids types correctly while singular dua_id / repository_id / source_dua_id stay String. - nih-gds framework.yaml: inline cedar_policy gains the .contains(resource.dua_id) clause (and 'has' guards) + a dataset-scoped description. Tests: - dataset_scope_test.go: real cedar-go evaluation — holds-required-DUA ALLOW; wrong-DUA / empty-set / unapproved DENY; non-controlled resource ALLOW. - compiler_test.go: inferCedarType plural-vs-singular cases; nih-gds compiles, carries the .contains clause, parses through cedar-go, types the set right. A tightening — no principal gains access they previously lacked. Refs: #11, attest#100
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.
Build step 3 of the compute-to-data chain (#11 Tier 2; ADR 0002 Decision 3). The consumer of the DUA set that
attest approval(attest#99, just merged) produces.The problem
cedar-nih-approved-user(nih-gds 1.1) was blanket:principal.nih_approval_current == trueagainst anynih_controlled_accessresource. A researcher approved for one study could reach every controlled dataset — the TOCTOU-equivalent for data access.The fix
Bind per-dataset: the gate now also requires
A researcher reaches a dataset only with the DUA that dataset requires.
Three coupled changes make the set usable end to end
toValue— lower a[]stringattribute to a real Cedartypes.Set. Previously it hit thedefaultbranch and stringified, so.contains()could never have worked.inferCedarType— pluralids→Set<String>, checked before theidstring-indicator, sonih_approval_dua_idstypes correctly while singulardua_id/repository_id/source_dua_idstayString.framework.yaml— the inlinecedar_policygains the.contains(resource.dua_id)clause (withhasguards) + a dataset-scoped description.Tests (real cedar-go engine, not string matching)
dataset_scope_test.go: holds-required-DUA → ALLOW; wrong-DUA / empty-set / unapproved → DENY; non-controlled resource → ALLOW.compiler_test.go:inferCedarTypeplural-vs-singular; nih-gds compiles, carries the.containsclause, parses through cedar-go, and types the set asSet<String>.Honesty
empty DUA set → DENYcase guards the inconsistent stateapproval.Revokealready refuses to write.With this, the attest side of compute-to-data is complete (produce the DUA set → bind it per-dataset). The remaining chain item is ground#10 (network egress). Refs: #11, attest#100.