Skip to content

Use native Interchange authorization for artifacts - #5

Merged
TheGreatAxios merged 5 commits into
mainfrom
cl-4620-delete-the-identity-seam-from-artifact-core-hosts-read
Aug 2, 2026
Merged

Use native Interchange authorization for artifacts#5
TheGreatAxios merged 5 commits into
mainfrom
cl-4620-delete-the-identity-seam-from-artifact-core-hosts-read

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Read authenticated tenant and principal data from Interchange TenantEnv and authorize artifact mutations through host RequireGrant.
  • Remove the Identity port, owner display names, creator-kind filtering, and cross-tenant tool overrides.
  • Demonstrate the two-seam host surface in the reference host and package documentation.
  • Add a host grant-provisioning seam (onArtifactCreated) and a real, discriminating grant check in the reference host and test suites, so ownership denial is proven against a real evaluator rather than a default-allow stub.

Scope vs. PR #7

No semantic conflict with #7 (findOrVersionArtifact) — different concern, same touched files (ARCHITECTURE.md, CHANGELOG.md, src/artifacts.ts, src/index.ts). A trial rebase shows exactly one conflicting hunk: two adjacent rows of the ARCHITECTURE.md module table (mount.ts, artifacts.ts), trivially resolved. Whichever merges second needs a real rebase there, not a fast-forward.

Verification

  • bun run scripts/check-deps.ts exits 0.
  • bun run typecheck exits 0.
  • bun run test:acceptance builds the package and passes the acceptance suite, including new "ownership-derived grants" scenarios against a real Postgres-backed grant table.
  • The core database suite requires ALLOW_DESTRUCTIVE_ARTIFACT_TESTS=1; this harness stops at that safety guard before executing those tests.
  • Latest commit's checks left to CI — the local environment forbids installs/builds/full test runs, so this round was written by reading neighboring tests and verified against the pushed CI run rather than locally.

Closes CL-4620

@TheGreatAxios

Copy link
Copy Markdown
Contributor Author

Self-review (code-review skill) returned clean.

Adds a host grant-provisioning seam (onArtifactCreated) and wires it in
the reference host to mint a real creator-origin grant on artifact
creation, checked through the platform's own createRequireGrant/authorize
rather than a default-allow stub. Unit tests run the same routes through
createInMemoryGrantStore so a non-owner is refused on the merits, not by
a bare test predicate; acceptance tests prove the same end to end against
a real Postgres-backed grant table.

Cross-tenant tool reads stay removed: Interchange's GrantStore resolves
grants within one tenant, so there is no platform primitive to check a
cross-tenant grant against. Recorded explicitly in CHANGELOG/ARCHITECTURE
rather than left as an unexplained gap.
A real grant evaluator has no existence check of its own: it denies a
ghost id or another tenant's artifact with the same 403 it gives a real
row the caller lacks permission on. Switching the reference host off a
default-allow stub surfaced this — write routes ran requireGrant before
loadScoped, so CI caught cross-tenant/skill-draft ids answering 403
instead of the documented 404.

Adds an artifactExists middleware that resolves existence/tenant/
skill-draft ahead of requireGrant on the three single-artifact write
routes, so a caller who cannot see the row still gets 404 regardless of
what the grant evaluator would have said.
@TheGreatAxios
TheGreatAxios merged commit a493fcd into main Aug 2, 2026
1 check passed
@TheGreatAxios
TheGreatAxios deleted the cl-4620-delete-the-identity-seam-from-artifact-core-hosts-read branch August 2, 2026 18:39
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