[Canon] Per-graph permissions (read, use, approve) and default grant review
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 24/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- sql, typescript
- Ambito
- authorization, backend, databases, security
Direzione di ricerca
Start by reading plans/canon-master-plan.md Workstream 5 and the referenced SearchScopePermissionResolver.ts to understand the existing permission model. The issue identifies GraphEngine.ts, CanonGraphEngine.ts, the graph entity servers, Explorer, and the v6.2.x graph migration as affected areas, and calls for a separate plan covering schema, resolution, enforcement, caching, and Explorer updates. Done means per-graph Read, Use, and Approve access is enforced across the listed entry points, with the default grants and caching reviewed; the open design questions need resolution first.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What should Canon do that it does not do today?
Add per-graph permissions (Read, Use, Approve) modeled on MJ: Search Scope Permissions (SearchScopePermissionResolver), and review/tighten today's wide default grants across all MJ: Graph* entities so callers, agents, skills, and graph stewards can only read, traverse, or approve graphs they are authorized for.
Who needs it, and what goes wrong without it?
Today graph access is binary across the whole instance: Graph: Approve Edges is global across every graph, and every node/edge read relies solely on row-level permissions of the referenced target entities. In multi-tenant or multi-domain hosts (such as Betty hosting one Canon graph per customer organization alongside platform graphs):
- A customer org admin cannot be granted permission to approve concepts or edges in their own organization's graph without handing them global
Graph: Approve Edgesacross every tenant's graph. GraphEnginehas no graph-levelReadorUsecheck before traversing a graph (Subgraph), running an agent/skill against it, or loading it in Explorer — so an organization's graph metadata or unanchored concepts/edges can be inspected or traversed across domain boundaries unless the host builds custom middleware.migrations/v6/V202611022300__v6.2.x__Semantic_Graph_And_Graph_Concepts.sqlseeds wide defaultAllowgrants:UI(E0AFCCEC-6A37-EF11-86D4-000D3A4E707E) holds unfilteredCanRead = 1onMJ: Graphs,MJ: Graph Concepts,MJ: Graph Edges,MJ: Graph Types,MJ: Graph Concept Types,MJ: Graph Authority Tiers,MJ: Graph Edge Types,MJ: Graph Edge Type Endpoints, andMJ: Graph Edge Providers, whileDeveloper(DEAFCCEC-...) andIntegration(DFAFCCEC-...) hold unfiltered1/1/1/1; andGraphEngine.Config()(packages/MJCoreEntities/src/graph/GraphEngine.ts:241-250) bulk-caches all eight tables withCacheLocal: truein every browser and server process.
Which layer does it touch?
- Governed data slices (alternate base views, queries)
- Concepts and authority (graph concepts, edges, tiers)
- Agent guardrails (canonical notes)
- Executable procedures (skills, actions, workflows)
- Schema (a new type, status, tier, edge type or column)
What existing work is it related to?
plans/canon-master-plan.md— Workstream 5 (5b)- Workstream
5a(MJGraphConceptEntityServer+GraphEngine.CanUserApproveGraph) packages/SearchEngine/src/permissions/SearchScopePermissionResolver.ts(reference permission-resolver model)migrations/v6/V202611022300__v6.2.x__Semantic_Graph_And_Graph_Concepts.sql(default grants)packages/MJCoreEntities/src/graph/GraphEngine.ts&packages/MJCoreEntities/src/engines/CanonGraphEngine.ts
Rough size
Large (needs its own plan / schema migration + resolver + engine + Explorer updates).
Design Sketch
1. Schema & Permission Model (MJ: Graph Permissions)
Mirror __mj.SearchScopePermission cleanly (decided at monthly review + schema review before migration):
__mj.GraphPermission(MJ: Graph Permissions):ID uniqueidentifier NOT NULL PKGraphID uniqueidentifier NOT NULL FK -> __mj.Graph(ID)UserID uniqueidentifier NULL FK -> __mj.User(ID)andRoleID uniqueidentifier NULL FK -> __mj.Role(ID)withCK_GraphPermission_Principalrequiring(UserID IS NOT NULL AND RoleID IS NULL) OR (UserID IS NULL AND RoleID IS NOT NULL)(matchingSearchScopePermission, unless denied explicitly)PermissionLevel nvarchar(20) NOT NULL CHECK (PermissionLevel IN ('None', 'Read', 'Use', 'Approve'))(Approve > Use > Read > None;'None'is an explicit deny overriding role grants for that graph/principal)PrimaryScopeRecordID nvarchar(450) NULL+StartsAt datetimeoffset NULL/EndsAt datetimeoffset NULLfor optional tenant/org scoping and time-boxed grants (matchingMJSearchScopePermission)
- Agent, Skill & Host RunScope Alignment (matching
AIAgent.SearchScopeAccess/AISkill.SearchScopeAccess/RunActionParams.RunScope.SearchScopeIDs):- Add
AIAgent.GraphAccess nvarchar(20) NULL CHECK IN ('None', 'Assigned', 'All')(NULLbehaves as'None'or explicit default decision at review), join entityMJ: AI Agent Graphs, and siblingAISkill.GraphAccess/MJ: AI Skill Graphs. - Support
RunActionParams.RunScope.GraphIDs?: readonly string[]so a host (e.g., workspace/tenant/channel) can narrow which graphs an agent run may reach without ever widening past the calling user's ownGraphPermission.
- Add
2. Replaceable GraphPermissionResolver (@RegisterClass Extension Point)
Follow the exact lesson captured in SearchScopePermissionResolver.ts:35:
- Ship
GraphPermissionResolver(BaseSingleton<GraphPermissionResolver>registered via@RegisterClassor DI lookup on@memberjunction/core-entities-server) evaluating a fail-closed decision tree for{ User, GraphID, Agent, Skill, PrimaryScopeRecordID, HostAssignedGraphIDs }:- Direct
UserIDgrant (explicit'None'denies regardless of role grants) - Role grant across
User.UserRoles(Approve > Use > Read; explicit'None'overrides lower grants unless higher explicit user allow — pin exact deny-wins precedence matchingSearchScopePermissionResolver) - Agent / Skill
GraphAccess('None'rejects;'Assigned'requires listing;'All'acts only as fallback/intersection, never overriding an explicit'None') - Default
'NoGrant'-> denied (Allowed: false, Level: 'None')
- Direct
- Make
GraphPermissionResolversubclassable via@RegisterClassso multi-tenant hosts (e.g., Betty usingbetty.Graph.OrganizationID+BCAuthorizationEngineorg-admin tier) resolveApprovefor an org admin on their own org's graph directly from host tenant/entitlement state without duplicating per-user permission rows.
3. Enforcement Seams
- Read (
Level >= 'Read'): Graph metadata, concepts, edges, and Explorer visualization (SemanticGraphExplorerComponent) refuse or withhold graphs where the caller lacksRead. Add RLS/PreRunView alignment or entity-server read enforcement rather than relying solely on client filtering. - Use (
Level >= 'Use'):GraphEngine.Subgraph,CanonGraphEngine.FindConcepts/CanonContext/ExplainConcept/ExplainEntity, and graph tools/actions (Get Graph Context,Resolve Concepts,Find Graph Path,Explain Concept) filter candidate graphs to those where[caller, ...AudienceReaders]all holdUse. - Approve (
Level === 'Approve'): UpdateMJGraphConceptEntityServer(5a) andMJGraphEdgeEntityServerso approval/deprecation/rejection/governed-edits succeed if the caller holdsGraph: Approve Edges(global platform steward /Owneroverride) ORGraphPermissionResolver.CanApproveGraph(user, graphID, provider)returnsApprove(except insideGRAPH_PIPELINE_EDGE_APPROVAL_OPERATIONcreates). Explorer (SemanticGraphExplorerComponent.CanApproveSelectedGraph) queries/checks the selected graph's effective permission rather than only checking the global authorization.
4. Default Grant & Caching Audit (V202611022300 & GraphEngine.Config())
Audit and plan backward-compatible tightening in the migration + code:
- Reference catalogs (
MJ: Graph Types,MJ: Graph Concept Types,MJ: Graph Authority Tiers,MJ: Graph Edge Types,MJ: Graph Edge Type Endpoints): static global vocabularies;UICanRead = 1is benign. - Instance / Tenant-bearing entities (
MJ: Graphs,MJ: Graph Concepts,MJ: Graph Edges,MJ: Graph Edge Providers): todayUIholds unfilteredCanRead = 1on all four, allowing directRunViewagainst/graphqlby anyUIuser to read all rows across every graph! Add documented RLS filters (RowLevelSecurityFilter) or graph-permission-aware server read scoping (MJGraph*EntityServer/ProviderBasehook) so directRunViewrespectsGraphPermission(Read) even outsideGraphEngine. GraphEngine.Config()(CacheLocal: true): Stop unconditionally caching the entireMJ: Graph Conceptstable (CacheLocal: true) in every browser client; loadOnDemandgraphs' concepts server-side/per-graph and cache only public/permittedPreloadgraphs ("MJ Canon"), keyed appropriately.
5. Open Questions for Dec 3 Canon Review
- Should
UIcontinue having read access to"MJ Canon"by default via a seededGraphPermissionrow on"MJ Canon"for theUIrole (Level = 'Use'), while newly created graphs default to private (NoGrant)? - Should
Graph: Approve Edgesremain as the global platform steward override alongside per-graphApprove, or be deprecated onceMJ: Graph Permissionsships? - When
SearchScope+Graphare paired in an agent run, shouldAISkill.SearchScopeAccessandAISkill.GraphAccessshare oneRunScopecheck pattern?
- Lingua principale
- TSQL
- Stelle
- 32
- Fork
- 7
- Merge medio
- 1g 16h
- PR unite (30g)
- 504
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MemberJunction/MJ
-
DBAutoDoc: export --state-file writes SQL Server SQL for a PostgreSQL database, ignoring --providerAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
MemberJunction/MJ#7094 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
MemberJunction/MJ#6971 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
MemberJunction/MJ#6947 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
MemberJunction/MJ#6800 ·
I maintainer di solito rispondono entro 1 giorno
-
Convention: saved-query discoverability follows Status — Approved is canon, Pending is a draftAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
MemberJunction/MJ#6746 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di MemberJunction/MJ
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
samkerrcode/opengent#113 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
sharkohark1234/redact-sensitive#120 ·
I maintainer di solito rispondono entro 1 giorno
-
bug vault
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
bancolombia/secrets-manager#150 ·
I maintainer di solito rispondono entro 1 giorno
-
gax type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
googleapis/google-cloud-swift#1721 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
hemilabs/umami-analytics#12 ·