Skip to content

feat(cedar): dataset-scoped NIH Approved-User gate (attest#100) - #114

Merged
scttfrdmn merged 1 commit into
mainfrom
feat/dataset-scoped-nih-gate
Jun 12, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
feat/dataset-scoped-nih-gate

Conversation

@scttfrdmn

Copy link
Copy Markdown
Collaborator

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 == true against any nih_controlled_access resource. 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

principal.nih_approval_dua_ids.contains(resource.dua_id)

A researcher reaches a dataset only with the DUA that dataset requires.

Three coupled changes make the set usable end to end

  1. evaluator toValue — lower a []string attribute to a real Cedar types.Set. Previously it hit the default branch and stringified, so .contains() could never have worked.
  2. compiler inferCedarType — plural ids → Set<String>, checked before the id string-indicator, so nih_approval_dua_ids types correctly while singular dua_id/repository_id/source_dua_id stay String.
  3. nih-gds framework.yaml — the inline cedar_policy gains the .contains(resource.dua_id) clause (with has guards) + 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: inferCedarType plural-vs-singular; nih-gds compiles, carries the .contains clause, parses through cedar-go, and types the set as Set<String>.

Honesty

  • A tightening: no principal gains access they previously lacked (a holder of the old blanket approval may now be denied a dataset they hold no DUA for — the point).
  • The empty DUA set → DENY case guards the inconsistent state approval.Revoke already refuses to write.
  • Full attest suite passes (0 failures).

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.

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
@scttfrdmn
scttfrdmn merged commit ddb9c0e into main Jun 12, 2026
2 checks passed
@scttfrdmn
scttfrdmn deleted the feat/dataset-scoped-nih-gate branch June 12, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant