Use native Interchange authorization for artifacts - #5
Merged
TheGreatAxios merged 5 commits intoAug 2, 2026
Merged
Conversation
Contributor
Author
|
Self-review ( |
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
deleted the
cl-4620-delete-the-identity-seam-from-artifact-core-hosts-read
branch
August 2, 2026 18:39
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.
Summary
TenantEnvand authorize artifact mutations through hostRequireGrant.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 theARCHITECTURE.mdmodule 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.tsexits 0.bun run typecheckexits 0.bun run test:acceptancebuilds the package and passes the acceptance suite, including new "ownership-derived grants" scenarios against a real Postgres-backed grant table.ALLOW_DESTRUCTIVE_ARTIFACT_TESTS=1; this harness stops at that safety guard before executing those tests.Closes CL-4620