@memberjunction/core-entities-server 6.3.0-edge.2 → 6.3.0-edge.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/custom/ArtifactSecurityHookHelpers.d.ts.map +1 -1
- package/dist/custom/ArtifactSecurityHookHelpers.js +50 -0
- package/dist/custom/ArtifactSecurityHookHelpers.js.map +1 -1
- package/dist/custom/GraphConceptReadSecurityHook.d.ts +75 -0
- package/dist/custom/GraphConceptReadSecurityHook.d.ts.map +1 -0
- package/dist/custom/GraphConceptReadSecurityHook.js +574 -0
- package/dist/custom/GraphConceptReadSecurityHook.js.map +1 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.d.ts +45 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.d.ts.map +1 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.js +744 -0
- package/dist/custom/GraphRecordChangesReadSecurityHook.js.map +1 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.d.ts +13 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.js +52 -0
- package/dist/custom/MJAIAgentActionEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.d.ts +30 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.js +127 -0
- package/dist/custom/MJAIAgentCategoryEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.d.ts +12 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.js +46 -0
- package/dist/custom/MJAIAgentClientToolEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentEntityServer.server.d.ts +113 -7
- package/dist/custom/MJAIAgentEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentEntityServer.server.js +1946 -96
- package/dist/custom/MJAIAgentEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentModalityEntityServer.server.d.ts +13 -0
- package/dist/custom/MJAIAgentModalityEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentModalityEntityServer.server.js +52 -0
- package/dist/custom/MJAIAgentModalityEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts +64 -8
- package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentNoteEntityServer.server.js +263 -9
- package/dist/custom/MJAIAgentNoteEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentPersonaEntityServer.server.d.ts +2 -2
- package/dist/custom/MJAIAgentPersonaEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentPersonaEntityServer.server.js +10 -8
- package/dist/custom/MJAIAgentPersonaEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts +5 -2
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.js +25 -2
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentSkillEntityServer.server.d.ts +12 -0
- package/dist/custom/MJAIAgentSkillEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentSkillEntityServer.server.js +46 -0
- package/dist/custom/MJAIAgentSkillEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.d.ts +28 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.js +117 -0
- package/dist/custom/MJAIAgentStepTypeEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentTypeEntityServer.server.d.ts +34 -0
- package/dist/custom/MJAIAgentTypeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentTypeEntityServer.server.js +231 -0
- package/dist/custom/MJAIAgentTypeEntityServer.server.js.map +1 -0
- package/dist/custom/MJActionEntityServer.server.d.ts +37 -0
- package/dist/custom/MJActionEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJActionEntityServer.server.js +208 -3
- package/dist/custom/MJActionEntityServer.server.js.map +1 -1
- package/dist/custom/MJComponentEntityServer.server.d.ts +6 -0
- package/dist/custom/MJComponentEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJComponentEntityServer.server.js +20 -2
- package/dist/custom/MJComponentEntityServer.server.js.map +1 -1
- package/dist/custom/MJContentSourceEntityServer.server.d.ts +28 -0
- package/dist/custom/MJContentSourceEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJContentSourceEntityServer.server.js +73 -0
- package/dist/custom/MJContentSourceEntityServer.server.js.map +1 -0
- package/dist/custom/MJContentSourceTypeEntityServer.server.d.ts +25 -0
- package/dist/custom/MJContentSourceTypeEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJContentSourceTypeEntityServer.server.js +73 -0
- package/dist/custom/MJContentSourceTypeEntityServer.server.js.map +1 -0
- package/dist/custom/MJDashboardEntityServer.server.d.ts +6 -0
- package/dist/custom/MJDashboardEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJDashboardEntityServer.server.js +24 -2
- package/dist/custom/MJDashboardEntityServer.server.js.map +1 -1
- package/dist/custom/MJGraphConceptEntityServer.server.d.ts +175 -23
- package/dist/custom/MJGraphConceptEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJGraphConceptEntityServer.server.js +584 -41
- package/dist/custom/MJGraphConceptEntityServer.server.js.map +1 -1
- package/dist/custom/MJGraphEdgeEntityServer.server.d.ts +38 -11
- package/dist/custom/MJGraphEdgeEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJGraphEdgeEntityServer.server.js +249 -39
- package/dist/custom/MJGraphEdgeEntityServer.server.js.map +1 -1
- package/dist/custom/MJGraphEntityServer.server.d.ts +58 -0
- package/dist/custom/MJGraphEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphEntityServer.server.js +357 -0
- package/dist/custom/MJGraphEntityServer.server.js.map +1 -0
- package/dist/custom/MJGraphLinkEntityServer.server.d.ts +98 -0
- package/dist/custom/MJGraphLinkEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphLinkEntityServer.server.js +375 -0
- package/dist/custom/MJGraphLinkEntityServer.server.js.map +1 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.d.ts +29 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.js +141 -0
- package/dist/custom/MJGraphPermissionEntityServer.server.js.map +1 -0
- package/dist/custom/MJListDetailEntityServer.server.d.ts +4 -4
- package/dist/custom/MJListDetailEntityServer.server.js +4 -4
- package/dist/custom/MJListEntityServer.server.d.ts +2 -1
- package/dist/custom/MJListEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJListEntityServer.server.js +5 -2
- package/dist/custom/MJListEntityServer.server.js.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.d.ts +51 -3
- package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.js +142 -28
- package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
- package/dist/custom/MJQueryParameterEntityServer.server.d.ts +37 -0
- package/dist/custom/MJQueryParameterEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJQueryParameterEntityServer.server.js +160 -0
- package/dist/custom/MJQueryParameterEntityServer.server.js.map +1 -0
- package/dist/custom/MJQuerySQLEntityServer.server.d.ts +23 -0
- package/dist/custom/MJQuerySQLEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQuerySQLEntityServer.server.js +106 -9
- package/dist/custom/MJQuerySQLEntityServer.server.js.map +1 -1
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts +1 -1
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js +8 -5
- package/dist/custom/MJRowLevelSecurityFilterEntityServer.server.js.map +1 -1
- package/dist/custom/MJUserRoleEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserRoleEntityServer.server.js +9 -0
- package/dist/custom/MJUserRoleEntityServer.server.js.map +1 -1
- package/dist/custom/MJUserViewEntityServer.server.d.ts +9 -0
- package/dist/custom/MJUserViewEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserViewEntityServer.server.js +59 -3
- package/dist/custom/MJUserViewEntityServer.server.js.map +1 -1
- package/dist/custom/agentRelationalGrantGuard.d.ts +73 -0
- package/dist/custom/agentRelationalGrantGuard.d.ts.map +1 -0
- package/dist/custom/agentRelationalGrantGuard.js +375 -0
- package/dist/custom/agentRelationalGrantGuard.js.map +1 -0
- package/dist/custom/approvalStamp.d.ts +68 -4
- package/dist/custom/approvalStamp.d.ts.map +1 -1
- package/dist/custom/approvalStamp.js +107 -13
- package/dist/custom/approvalStamp.js.map +1 -1
- package/dist/custom/canon/CanonFingerprintRecorderServer.d.ts +20 -0
- package/dist/custom/canon/CanonFingerprintRecorderServer.d.ts.map +1 -0
- package/dist/custom/canon/CanonFingerprintRecorderServer.js +148 -0
- package/dist/custom/canon/CanonFingerprintRecorderServer.js.map +1 -0
- package/dist/custom/canon/index.d.ts +2 -0
- package/dist/custom/canon/index.d.ts.map +1 -0
- package/dist/custom/canon/index.js +2 -0
- package/dist/custom/canon/index.js.map +1 -0
- package/dist/custom/graph/GraphFindPathServerOperation.d.ts +7 -5
- package/dist/custom/graph/GraphFindPathServerOperation.d.ts.map +1 -1
- package/dist/custom/graph/GraphFindPathServerOperation.js +41 -12
- package/dist/custom/graph/GraphFindPathServerOperation.js.map +1 -1
- package/dist/custom/graphPermissionGuard.d.ts +69 -0
- package/dist/custom/graphPermissionGuard.d.ts.map +1 -0
- package/dist/custom/graphPermissionGuard.js +229 -0
- package/dist/custom/graphPermissionGuard.js.map +1 -0
- package/dist/custom/graphRlsCacheInvalidation.d.ts +38 -0
- package/dist/custom/graphRlsCacheInvalidation.d.ts.map +1 -0
- package/dist/custom/graphRlsCacheInvalidation.js +111 -0
- package/dist/custom/graphRlsCacheInvalidation.js.map +1 -0
- package/dist/custom/queryParentFingerprint.d.ts +36 -0
- package/dist/custom/queryParentFingerprint.d.ts.map +1 -0
- package/dist/custom/queryParentFingerprint.js +159 -0
- package/dist/custom/queryParentFingerprint.js.map +1 -0
- package/dist/custom/queryParentSaveChain.d.ts +5 -0
- package/dist/custom/queryParentSaveChain.d.ts.map +1 -0
- package/dist/custom/queryParentSaveChain.js +25 -0
- package/dist/custom/queryParentSaveChain.js.map +1 -0
- package/dist/custom/seededMetadataPush.d.ts +7 -0
- package/dist/custom/seededMetadataPush.d.ts.map +1 -0
- package/dist/custom/seededMetadataPush.js +23 -0
- package/dist/custom/seededMetadataPush.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +31 -31
|
@@ -0,0 +1,574 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import { BaseEntity, FormatVisibilityNodeKey, GetDataHooks, LogError, Metadata, RegisterDataHook, RegisterPostRunViewProtectedEntity, ResolveVisibility, RunView, WellKnownUserSource, } from '@memberjunction/core';
|
|
3
|
+
import { GetGlobalObjectStore, UUIDsEqual } from '@memberjunction/global';
|
|
4
|
+
import { LoadCoreVisibilityRules, NeutralGraphNodeLabel, } from '@memberjunction/core-entities';
|
|
5
|
+
import { UserCache } from '@memberjunction/generic-database-provider';
|
|
6
|
+
import { EntityNamesMatch, ResolveTargetEntityNameAsync, StripSyntheticFieldsFromRow } from './ArtifactSecurityHookHelpers.js';
|
|
7
|
+
const GRAPH_CONCEPTS_ENTITY_NAME = 'MJ: Graph Concepts';
|
|
8
|
+
/**
|
|
9
|
+
* Explicit allow-list of non-sensitive structural columns preserved on a redacted
|
|
10
|
+
* `MJ: Graph Concepts` row (Finding 377 — allow-list, NOT deny-list). Every other column
|
|
11
|
+
* (including `Description`, `Specification`, `Synonyms`, `EffectiveFrom`, `EffectiveTo`,
|
|
12
|
+
* `Parent`, and any future text column) is blanked to `null`, and `Name` is replaced with
|
|
13
|
+
* {@link NeutralGraphNodeLabel}.
|
|
14
|
+
*/
|
|
15
|
+
export const CONCEPT_REDACTED_ALLOWED_FIELDS = [
|
|
16
|
+
'ID',
|
|
17
|
+
'GraphID',
|
|
18
|
+
'Graph',
|
|
19
|
+
'ConceptTypeID',
|
|
20
|
+
'ConceptType',
|
|
21
|
+
'ParentID',
|
|
22
|
+
'Status',
|
|
23
|
+
'Origin',
|
|
24
|
+
'ApprovalMode',
|
|
25
|
+
'ApprovedByUserID',
|
|
26
|
+
'ApprovedAt',
|
|
27
|
+
'AuthorityTierID',
|
|
28
|
+
'AuthorityTier',
|
|
29
|
+
'Confidence',
|
|
30
|
+
'IsActive',
|
|
31
|
+
'__mj_CreatedAt',
|
|
32
|
+
'__mj_UpdatedAt',
|
|
33
|
+
];
|
|
34
|
+
const CONCEPT_REDACTED_ALLOWED_LOWER = new Set(CONCEPT_REDACTED_ALLOWED_FIELDS.map((f) => f.toLowerCase()));
|
|
35
|
+
/** Plain refusal message returned when a caller attempts to save or delete a redacted concept instance (Finding 379). */
|
|
36
|
+
export const REDACTED_CONCEPT_WRITE_DENIED_MESSAGE = 'Cannot save or delete a redacted graph concept; full source access is required to modify it.';
|
|
37
|
+
const REDACTED_CONCEPT_ENTITY_SYMBOL = Symbol.for('__MJ_REDACTED_GRAPH_CONCEPT_ENTITY__');
|
|
38
|
+
const GLOBAL_KEY_CONCEPT_EVAL_ALS = '__MJ_GRAPH_CONCEPT_VISIBILITY_EVAL_ALS__';
|
|
39
|
+
const GLOBAL_KEY_ORIGINAL_CONCEPT_FIELDS = '__MJ_ORIGINAL_GRAPH_CONCEPT_FIELDS_BY_PARAMS__';
|
|
40
|
+
const UUID_LITERAL_PATTERN = "'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'";
|
|
41
|
+
/**
|
|
42
|
+
* Anchored allow-list for `ExtraFilter` on `MJ: Graph Concepts` when non-exempt readers may keep
|
|
43
|
+
* `'Redacted'` rows (Finding 391): strictly `[ID] = '<uuid>'`, `ID = '<uuid>'`, `[GraphID] = '<uuid>'`,
|
|
44
|
+
* `GraphID = '<uuid>'`, or the corresponding `IN ('<uuid>', ...)` forms. Everything else defaults to
|
|
45
|
+
* refusing (dropping Redacted rows from both results and counts).
|
|
46
|
+
*/
|
|
47
|
+
const SAFE_CONCEPT_FILTER_RE = new RegExp(`^(?:\\[?(?:ID|GraphID)\\]?\\s*=\\s*${UUID_LITERAL_PATTERN}|\\[?(?:ID|GraphID)\\]?\\s+IN\\s*\\(\\s*${UUID_LITERAL_PATTERN}(?:\\s*,\\s*${UUID_LITERAL_PATTERN})*\\s*\\))$`, 'i');
|
|
48
|
+
/** Anchored allow-list for `OrderBy`: strictly one allow-listed column with optional `ASC`/`DESC`. */
|
|
49
|
+
const SAFE_CONCEPT_ORDER_BY_RE = /^\[?([A-Za-z_][A-Za-z0-9_]*)\]?(?:\s+(?:ASC|DESC))?$/i;
|
|
50
|
+
function getConceptEvalALS() {
|
|
51
|
+
const store = GetGlobalObjectStore();
|
|
52
|
+
if (!(store[GLOBAL_KEY_CONCEPT_EVAL_ALS] instanceof AsyncLocalStorage)) {
|
|
53
|
+
store[GLOBAL_KEY_CONCEPT_EVAL_ALS] = new AsyncLocalStorage();
|
|
54
|
+
}
|
|
55
|
+
return store[GLOBAL_KEY_CONCEPT_EVAL_ALS];
|
|
56
|
+
}
|
|
57
|
+
function getOriginalConceptFieldsMap() {
|
|
58
|
+
const store = GetGlobalObjectStore();
|
|
59
|
+
if (!(store[GLOBAL_KEY_ORIGINAL_CONCEPT_FIELDS] instanceof WeakMap)) {
|
|
60
|
+
store[GLOBAL_KEY_ORIGINAL_CONCEPT_FIELDS] = new WeakMap();
|
|
61
|
+
}
|
|
62
|
+
return store[GLOBAL_KEY_ORIGINAL_CONCEPT_FIELDS];
|
|
63
|
+
}
|
|
64
|
+
/** True while executing inside `GraphConceptReadSecurityHook`'s own `ResolveVisibility` call. */
|
|
65
|
+
export function IsInsideGraphConceptVisibilityEval() {
|
|
66
|
+
return getConceptEvalALS().getStore() === true;
|
|
67
|
+
}
|
|
68
|
+
function runInsideConceptVisibilityEval(work) {
|
|
69
|
+
return getConceptEvalALS().run(true, work);
|
|
70
|
+
}
|
|
71
|
+
/** Marks or clears the server-side redacted-instance flag on an in-memory `MJGraphConceptEntity` (Finding 379). */
|
|
72
|
+
export function MarkConceptEntityRedacted(entity, redacted) {
|
|
73
|
+
const tagged = entity;
|
|
74
|
+
if (redacted) {
|
|
75
|
+
tagged[REDACTED_CONCEPT_ENTITY_SYMBOL] = true;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
delete tagged[REDACTED_CONCEPT_ENTITY_SYMBOL];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** True when `entity` was loaded in redacted form and therefore must never be saved or deleted (Finding 379). */
|
|
82
|
+
export function IsRedactedConceptEntity(entity) {
|
|
83
|
+
return entity[REDACTED_CONCEPT_ENTITY_SYMBOL] === true;
|
|
84
|
+
}
|
|
85
|
+
function isServerSystemUser(user) {
|
|
86
|
+
if (!user) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const systemUserId = UserCache.Instance?.GetSystemUser?.()?.ID;
|
|
90
|
+
return Boolean((systemUserId && UUIDsEqual(user.ID, systemUserId)) ||
|
|
91
|
+
WellKnownUserSource.Instance.IsSystemUser(user));
|
|
92
|
+
}
|
|
93
|
+
function resolveProvider(hookProvider, contextUser) {
|
|
94
|
+
return (hookProvider ??
|
|
95
|
+
contextUser?.OwningProvider ??
|
|
96
|
+
Metadata.Provider ?? // global-provider-ok: fallback when provider is not attached to user
|
|
97
|
+
null);
|
|
98
|
+
}
|
|
99
|
+
function readRowStringField(row, fieldName) {
|
|
100
|
+
if (!row || typeof row !== 'object') {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
if (row instanceof BaseEntity) {
|
|
104
|
+
const val = row.GetFieldByName(fieldName)?.Value;
|
|
105
|
+
return typeof val === 'string' && val.trim().length > 0 ? val.trim() : null;
|
|
106
|
+
}
|
|
107
|
+
const record = row;
|
|
108
|
+
const direct = record[fieldName];
|
|
109
|
+
if (typeof direct === 'string' && direct.trim().length > 0) {
|
|
110
|
+
return direct.trim();
|
|
111
|
+
}
|
|
112
|
+
const targetLower = fieldName.toLowerCase();
|
|
113
|
+
for (const [k, v] of Object.entries(record)) {
|
|
114
|
+
if (k.trim().toLowerCase() === targetLower && typeof v === 'string' && v.trim().length > 0) {
|
|
115
|
+
return v.trim();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Default-refuse probe detector for `MJ: Graph Concepts` (Finding 391): returns `true` (so
|
|
122
|
+
* `'Redacted'` rows are dropped from BOTH results and counts) whenever `UserSearchString`,
|
|
123
|
+
* `ViewID`, `ViewName`, `ViewEntity`, `ExtraFilter`, or `OrderBy` is set — with the sole
|
|
124
|
+
* allow-listed exception of an anchored UUID-only `ID`/`GraphID` `=`/`IN` filter AND/OR a single
|
|
125
|
+
* allow-listed `OrderBy` column (`CONCEPT_REDACTED_ALLOWED_FIELDS` + optional `ASC`/`DESC`).
|
|
126
|
+
*/
|
|
127
|
+
export function DoesConceptQueryProbeRedactedColumns(params) {
|
|
128
|
+
if (typeof params.UserSearchString === 'string' && params.UserSearchString.trim().length > 0) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
if ((typeof params.ViewID === 'string' && params.ViewID.trim().length > 0) ||
|
|
132
|
+
(typeof params.ViewName === 'string' && params.ViewName.trim().length > 0) ||
|
|
133
|
+
params.ViewEntity != null) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
if (params.ExtraFilter != null) {
|
|
137
|
+
if (typeof params.ExtraFilter !== 'string') {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
const trimmedFilter = params.ExtraFilter.trim();
|
|
141
|
+
if (trimmedFilter.length > 0 && !SAFE_CONCEPT_FILTER_RE.test(trimmedFilter)) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (params.OrderBy != null) {
|
|
146
|
+
if (typeof params.OrderBy !== 'string') {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
const trimmedOrder = params.OrderBy.trim();
|
|
150
|
+
if (trimmedOrder.length > 0) {
|
|
151
|
+
const match = SAFE_CONCEPT_ORDER_BY_RE.exec(trimmedOrder);
|
|
152
|
+
if (!match || !CONCEPT_REDACTED_ALLOWED_LOWER.has(match[1].toLowerCase())) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Redacts an in-memory `MJGraphConceptEntity` (`BaseEntity`) instance in place from the explicit
|
|
161
|
+
* allow-list {@link CONCEPT_REDACTED_ALLOWED_FIELDS}, resets field dirty tracking, and marks the
|
|
162
|
+
* instance redacted so `Save()` and `Delete()` are refused (Findings 377 & 379).
|
|
163
|
+
*/
|
|
164
|
+
export function RedactConceptEntityInPlace(entity, conceptId) {
|
|
165
|
+
const neutralName = NeutralGraphNodeLabel(GRAPH_CONCEPTS_ENTITY_NAME, conceptId);
|
|
166
|
+
for (const field of entity.Fields) {
|
|
167
|
+
const lower = field.Name.trim().toLowerCase();
|
|
168
|
+
if (lower === 'name') {
|
|
169
|
+
field.Value = neutralName;
|
|
170
|
+
field.ResetOldValue();
|
|
171
|
+
}
|
|
172
|
+
else if (!CONCEPT_REDACTED_ALLOWED_LOWER.has(lower)) {
|
|
173
|
+
field.Value = null;
|
|
174
|
+
field.ResetOldValue();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
MarkConceptEntityRedacted(entity, true);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Blanks the virtual `Parent` name column on an otherwise `'Allowed'` row when the parent concept
|
|
181
|
+
* itself did not resolve `'Allowed'` (Finding 377). Never mutates frozen cache rows.
|
|
182
|
+
*/
|
|
183
|
+
function blankParentNameOnRow(row) {
|
|
184
|
+
if (!row || typeof row !== 'object') {
|
|
185
|
+
return row;
|
|
186
|
+
}
|
|
187
|
+
if (row instanceof BaseEntity) {
|
|
188
|
+
const field = row.GetFieldByName('Parent');
|
|
189
|
+
if (field && field.Value != null) {
|
|
190
|
+
field.Value = null;
|
|
191
|
+
field.ResetOldValue();
|
|
192
|
+
}
|
|
193
|
+
return row;
|
|
194
|
+
}
|
|
195
|
+
const record = row;
|
|
196
|
+
let hasNonNullParent = false;
|
|
197
|
+
for (const [k, v] of Object.entries(record)) {
|
|
198
|
+
if (k.trim().toLowerCase() === 'parent' && v != null) {
|
|
199
|
+
hasNonNullParent = true;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (!hasNonNullParent) {
|
|
204
|
+
return row;
|
|
205
|
+
}
|
|
206
|
+
const copy = { ...record };
|
|
207
|
+
for (const key of Object.keys(copy)) {
|
|
208
|
+
if (key.trim().toLowerCase() === 'parent') {
|
|
209
|
+
copy[key] = null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return copy;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Builds a redacted clone of a plain `RunView` row from the explicit allow-list
|
|
216
|
+
* {@link CONCEPT_REDACTED_ALLOWED_FIELDS} (never mutates frozen cache rows), or redacts a
|
|
217
|
+
* `BaseEntity` row in place. Any column outside the allow-list (including `Description`,
|
|
218
|
+
* `Specification`, `Synonyms`, `EffectiveFrom`, `EffectiveTo`, `Parent`, and any future text
|
|
219
|
+
* column) is set to `null`, and `Name` is replaced with {@link NeutralGraphNodeLabel}.
|
|
220
|
+
*/
|
|
221
|
+
export function RedactConceptRow(row, conceptId) {
|
|
222
|
+
if (!row || typeof row !== 'object') {
|
|
223
|
+
return row;
|
|
224
|
+
}
|
|
225
|
+
if (row instanceof BaseEntity) {
|
|
226
|
+
RedactConceptEntityInPlace(row, conceptId);
|
|
227
|
+
return row;
|
|
228
|
+
}
|
|
229
|
+
const source = row;
|
|
230
|
+
const neutralName = NeutralGraphNodeLabel(GRAPH_CONCEPTS_ENTITY_NAME, conceptId);
|
|
231
|
+
const out = {};
|
|
232
|
+
for (const key of Object.keys(source)) {
|
|
233
|
+
const lower = key.trim().toLowerCase();
|
|
234
|
+
if (lower === 'name') {
|
|
235
|
+
out[key] = neutralName;
|
|
236
|
+
}
|
|
237
|
+
else if (CONCEPT_REDACTED_ALLOWED_LOWER.has(lower)) {
|
|
238
|
+
out[key] = source[key];
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
out[key] = null;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return out;
|
|
245
|
+
}
|
|
246
|
+
function stripSyntheticFields(row, originalFields) {
|
|
247
|
+
if (!originalFields || !row || typeof row !== 'object') {
|
|
248
|
+
return row;
|
|
249
|
+
}
|
|
250
|
+
return StripSyntheticFieldsFromRow(row, originalFields);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Server-side `PreRunView` hook for `MJ: Graph Concepts` (D7 / 5c / MJ #6724 / Finding 377).
|
|
254
|
+
* Ensures `ID` (and `ParentID` whenever `Parent` is requested) are projected on narrow `Fields`
|
|
255
|
+
* queries for non-system callers so `PostRunView` can enforce `ResolveVisibility` and blank
|
|
256
|
+
* `Parent` names for hidden/redacted parents before stripping synthetic columns.
|
|
257
|
+
*/
|
|
258
|
+
export const GraphConceptPreRunViewHook = async (params, contextUser, hookProvider) => {
|
|
259
|
+
if (!params || !contextUser || IsInsideGraphConceptVisibilityEval() || isServerSystemUser(contextUser)) {
|
|
260
|
+
return params;
|
|
261
|
+
}
|
|
262
|
+
const provider = resolveProvider(hookProvider, contextUser);
|
|
263
|
+
if (!provider || provider.ProviderType !== 'Database') {
|
|
264
|
+
return params;
|
|
265
|
+
}
|
|
266
|
+
const entityName = await ResolveTargetEntityNameAsync(params, provider, contextUser);
|
|
267
|
+
if (!entityName || !EntityNamesMatch(entityName, GRAPH_CONCEPTS_ENTITY_NAME, provider)) {
|
|
268
|
+
return params;
|
|
269
|
+
}
|
|
270
|
+
if (!Array.isArray(params.Fields) || params.Fields.length === 0 || params.ResultType === 'count_only') {
|
|
271
|
+
return params;
|
|
272
|
+
}
|
|
273
|
+
const lowerFields = new Set(params.Fields.map((f) => (typeof f === 'string' ? f.trim().toLowerCase() : '')));
|
|
274
|
+
const additions = [];
|
|
275
|
+
if (!lowerFields.has('id')) {
|
|
276
|
+
additions.push('ID');
|
|
277
|
+
}
|
|
278
|
+
if (lowerFields.has('parent') && !lowerFields.has('parentid')) {
|
|
279
|
+
additions.push('ParentID');
|
|
280
|
+
}
|
|
281
|
+
if (additions.length === 0) {
|
|
282
|
+
return params;
|
|
283
|
+
}
|
|
284
|
+
getOriginalConceptFieldsMap().set(params, [...params.Fields]);
|
|
285
|
+
params.Fields = [...params.Fields, ...additions];
|
|
286
|
+
return params;
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Server-side `PostRunView` hook for `MJ: Graph Concepts` (D7 / 5c / MJ #6724 / Findings 376 & 377).
|
|
290
|
+
* Enforces core {@link ResolveVisibility} on EVERY plain `RunView` query:
|
|
291
|
+
* - `'Hidden'` rows are removed.
|
|
292
|
+
* - `'Redacted'` rows are dropped whenever `ExtraFilter`, `UserSearchString`, or `OrderBy` probes
|
|
293
|
+
* a redacted column (Finding 376a), and otherwise rebuilt from {@link CONCEPT_REDACTED_ALLOWED_FIELDS}
|
|
294
|
+
* (Finding 377).
|
|
295
|
+
* - On surviving `'Allowed'` rows, `Parent` is blanked to `null` unless the parent concept also
|
|
296
|
+
* resolves `'Allowed'` in the same visibility batch (Finding 377).
|
|
297
|
+
* - `TotalRowCount` is computed accurately from the full set of visible matching IDs on paged,
|
|
298
|
+
* empty-page (`StartRow` past end), and `count_only` queries so hidden/redacted counts never leak
|
|
299
|
+
* (Finding 376b).
|
|
300
|
+
*/
|
|
301
|
+
export const GraphConceptPostRunViewHook = async (params, results, contextUser, hookProvider) => {
|
|
302
|
+
const originalFieldsMap = getOriginalConceptFieldsMap();
|
|
303
|
+
const originalFields = originalFieldsMap.get(params);
|
|
304
|
+
originalFieldsMap.delete(params);
|
|
305
|
+
if (!results?.Success || IsInsideGraphConceptVisibilityEval()) {
|
|
306
|
+
return results;
|
|
307
|
+
}
|
|
308
|
+
const provider = resolveProvider(hookProvider, contextUser);
|
|
309
|
+
if (!provider || provider.ProviderType !== 'Database') {
|
|
310
|
+
return results;
|
|
311
|
+
}
|
|
312
|
+
const entityName = await ResolveTargetEntityNameAsync(params, provider, contextUser);
|
|
313
|
+
if (!entityName || !EntityNamesMatch(entityName, GRAPH_CONCEPTS_ENTITY_NAME, provider)) {
|
|
314
|
+
return results;
|
|
315
|
+
}
|
|
316
|
+
if (!contextUser) {
|
|
317
|
+
return { ...results, Results: [], RowCount: 0, TotalRowCount: 0 };
|
|
318
|
+
}
|
|
319
|
+
if (isServerSystemUser(contextUser)) {
|
|
320
|
+
return originalFields && Array.isArray(results.Results)
|
|
321
|
+
? { ...results, Results: results.Results.map((r) => stripSyntheticFields(r, originalFields)) }
|
|
322
|
+
: results;
|
|
323
|
+
}
|
|
324
|
+
LoadCoreVisibilityRules();
|
|
325
|
+
try {
|
|
326
|
+
const dropRedacted = DoesConceptQueryProbeRedactedColumns(params);
|
|
327
|
+
if (params.ResultType === 'count_only') {
|
|
328
|
+
const visibleCount = await computeVisibleConceptCount(params, contextUser, provider, dropRedacted);
|
|
329
|
+
return { ...results, TotalRowCount: visibleCount };
|
|
330
|
+
}
|
|
331
|
+
const rows = Array.isArray(results.Results) ? results.Results : [];
|
|
332
|
+
const conceptEntity = provider.EntityByName(GRAPH_CONCEPTS_ENTITY_NAME);
|
|
333
|
+
if (!conceptEntity) {
|
|
334
|
+
return { ...results, Results: [], RowCount: 0, TotalRowCount: 0 };
|
|
335
|
+
}
|
|
336
|
+
const rawTotal = results.TotalRowCount ?? results.RowCount ?? rows.length;
|
|
337
|
+
const isPagedOrEmptyWithTotal = !params.SkipTotalRowCount &&
|
|
338
|
+
(rawTotal > rows.length ||
|
|
339
|
+
(typeof params.StartRow === 'number' && params.StartRow > 0) ||
|
|
340
|
+
(typeof params.MaxRows === 'number' && params.MaxRows > 0 && rows.length >= params.MaxRows));
|
|
341
|
+
if (rows.length === 0) {
|
|
342
|
+
if (!isPagedOrEmptyWithTotal || rawTotal <= 0) {
|
|
343
|
+
return results;
|
|
344
|
+
}
|
|
345
|
+
// Finding 376b: an empty page (e.g. StartRow past the end) must never leak raw TotalRowCount.
|
|
346
|
+
const exactTotal = await computeVisibleConceptCount(params, contextUser, provider, dropRedacted);
|
|
347
|
+
return exactTotal === results.TotalRowCount ? results : { ...results, TotalRowCount: exactTotal };
|
|
348
|
+
}
|
|
349
|
+
const rowEntries = rows.map((row) => ({
|
|
350
|
+
Row: row,
|
|
351
|
+
Id: readRowStringField(row, 'ID'),
|
|
352
|
+
ParentId: readRowStringField(row, 'ParentID'),
|
|
353
|
+
}));
|
|
354
|
+
// Resolve both row IDs AND non-null ParentIDs in ONE batched ResolveVisibility call (Finding 377).
|
|
355
|
+
const refs = [];
|
|
356
|
+
const seenRefIds = new Set();
|
|
357
|
+
const addRef = (id) => {
|
|
358
|
+
if (!id) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
const norm = id.toLowerCase();
|
|
362
|
+
if (!seenRefIds.has(norm)) {
|
|
363
|
+
seenRefIds.add(norm);
|
|
364
|
+
refs.push({ EntityName: GRAPH_CONCEPTS_ENTITY_NAME, EntityID: conceptEntity.ID, RecordID: id });
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
for (const entry of rowEntries) {
|
|
368
|
+
addRef(entry.Id);
|
|
369
|
+
addRef(entry.ParentId);
|
|
370
|
+
}
|
|
371
|
+
const decisions = refs.length > 0
|
|
372
|
+
? await runInsideConceptVisibilityEval(() => ResolveVisibility(refs, contextUser, {
|
|
373
|
+
Provider: provider,
|
|
374
|
+
Caller: 'GraphConceptReadSecurityHook',
|
|
375
|
+
// Base entity CanRead + DB RLS already ran on this RunView result; skipping
|
|
376
|
+
// Step 1 avoids a redundant query and prevents single-flight RunViews self-deadlock.
|
|
377
|
+
SkipBaseRowCheck: true,
|
|
378
|
+
}))
|
|
379
|
+
: new Map();
|
|
380
|
+
const decisionForId = (id) => decisions.get(FormatVisibilityNodeKey({ EntityName: GRAPH_CONCEPTS_ENTITY_NAME, EntityID: conceptEntity.ID, RecordID: id }, provider));
|
|
381
|
+
const nextRows = [];
|
|
382
|
+
let changed = Boolean(originalFields);
|
|
383
|
+
for (const entry of rowEntries) {
|
|
384
|
+
if (!entry.Id) {
|
|
385
|
+
changed = true;
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
const decision = decisionForId(entry.Id);
|
|
389
|
+
if (!decision || decision.Outcome === 'Hidden') {
|
|
390
|
+
changed = true;
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
if (decision.Outcome === 'Redacted') {
|
|
394
|
+
changed = true;
|
|
395
|
+
if (dropRedacted) {
|
|
396
|
+
// Finding 376a: drop Redacted rows when filter/search/sort probed a redacted column.
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
const redacted = RedactConceptRow(entry.Row, entry.Id);
|
|
400
|
+
nextRows.push(stripSyntheticFields(redacted, originalFields));
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
// Outcome === 'Allowed': blank Parent name if parent concept is NOT Allowed (Finding 377).
|
|
404
|
+
let outputRow = entry.Row;
|
|
405
|
+
if (entry.ParentId) {
|
|
406
|
+
const parentDecision = decisionForId(entry.ParentId);
|
|
407
|
+
if (!parentDecision || parentDecision.Outcome !== 'Allowed') {
|
|
408
|
+
const blanked = blankParentNameOnRow(outputRow);
|
|
409
|
+
if (blanked !== outputRow) {
|
|
410
|
+
changed = true;
|
|
411
|
+
}
|
|
412
|
+
outputRow = blanked;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
nextRows.push(stripSyntheticFields(outputRow, originalFields));
|
|
416
|
+
}
|
|
417
|
+
let exactTotalRowCount;
|
|
418
|
+
if (params.SkipTotalRowCount) {
|
|
419
|
+
exactTotalRowCount = nextRows.length;
|
|
420
|
+
}
|
|
421
|
+
else if (isPagedOrEmptyWithTotal) {
|
|
422
|
+
// Finding 376b: compute exact TotalRowCount from the full matching visible ID set.
|
|
423
|
+
exactTotalRowCount = await computeVisibleConceptCount(params, contextUser, provider, dropRedacted);
|
|
424
|
+
if (exactTotalRowCount !== results.TotalRowCount) {
|
|
425
|
+
changed = true;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
exactTotalRowCount = nextRows.length;
|
|
430
|
+
}
|
|
431
|
+
if (!changed) {
|
|
432
|
+
return results;
|
|
433
|
+
}
|
|
434
|
+
return {
|
|
435
|
+
...results,
|
|
436
|
+
Results: nextRows,
|
|
437
|
+
RowCount: nextRows.length,
|
|
438
|
+
TotalRowCount: exactTotalRowCount,
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
catch (err) {
|
|
442
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
443
|
+
LogError(`GraphConceptPostRunViewHook failed; failing closed: ${msg}`);
|
|
444
|
+
return { ...results, Results: [], RowCount: 0, TotalRowCount: 0 };
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
async function computeVisibleConceptCount(params, contextUser, provider, dropRedacted) {
|
|
448
|
+
const conceptEntity = provider.EntityByName(GRAPH_CONCEPTS_ENTITY_NAME);
|
|
449
|
+
if (!conceptEntity) {
|
|
450
|
+
return 0;
|
|
451
|
+
}
|
|
452
|
+
const probeRes = await runInsideConceptVisibilityEval(() => RunView.FromMetadataProvider(provider).RunView({
|
|
453
|
+
EntityName: GRAPH_CONCEPTS_ENTITY_NAME,
|
|
454
|
+
ExtraFilter: params.ExtraFilter,
|
|
455
|
+
UserSearchString: params.UserSearchString,
|
|
456
|
+
Fields: ['ID'],
|
|
457
|
+
ResultType: 'simple',
|
|
458
|
+
IgnoreMaxRows: true,
|
|
459
|
+
}, contextUser));
|
|
460
|
+
if (!probeRes.Success) {
|
|
461
|
+
LogError(`GraphConceptPostRunViewHook count probe failed; failing closed: ${probeRes.ErrorMessage}`);
|
|
462
|
+
return 0;
|
|
463
|
+
}
|
|
464
|
+
const ids = (probeRes.Results ?? [])
|
|
465
|
+
.map((r) => r.ID)
|
|
466
|
+
.filter((id) => typeof id === 'string' && id.trim().length > 0);
|
|
467
|
+
if (ids.length === 0) {
|
|
468
|
+
return 0;
|
|
469
|
+
}
|
|
470
|
+
const refs = ids.map((id) => ({
|
|
471
|
+
EntityName: GRAPH_CONCEPTS_ENTITY_NAME,
|
|
472
|
+
EntityID: conceptEntity.ID,
|
|
473
|
+
RecordID: id,
|
|
474
|
+
}));
|
|
475
|
+
const decisions = await runInsideConceptVisibilityEval(() => ResolveVisibility(refs, contextUser, {
|
|
476
|
+
Provider: provider,
|
|
477
|
+
Caller: 'GraphConceptReadSecurityHook.count',
|
|
478
|
+
SkipBaseRowCheck: true,
|
|
479
|
+
}));
|
|
480
|
+
let visibleCount = 0;
|
|
481
|
+
for (const id of ids) {
|
|
482
|
+
const dec = decisions.get(FormatVisibilityNodeKey({ EntityName: GRAPH_CONCEPTS_ENTITY_NAME, EntityID: conceptEntity.ID, RecordID: id }, provider));
|
|
483
|
+
if (!dec || dec.Outcome === 'Hidden') {
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
if (dropRedacted && dec.Outcome === 'Redacted') {
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
visibleCount++;
|
|
490
|
+
}
|
|
491
|
+
return visibleCount;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Direct-load enforcement invoked by `MJGraphConceptEntityServer.InnerLoad` (D7 / 5c / Findings 377 & 379).
|
|
495
|
+
* - Returns `false` (and resets entity via `NewRecord()`) when `'Hidden'`.
|
|
496
|
+
* - Redacts sensitive columns from the allow-list and marks the instance unsaveable when `'Redacted'`.
|
|
497
|
+
* - Blanks `Parent` on `'Allowed'` rows whose parent concept is not `'Allowed'`.
|
|
498
|
+
*/
|
|
499
|
+
export async function EnforceGraphConceptDirectLoadVisibility(concept, contextUser, provider) {
|
|
500
|
+
MarkConceptEntityRedacted(concept, false);
|
|
501
|
+
if (IsInsideGraphConceptVisibilityEval() || isServerSystemUser(contextUser)) {
|
|
502
|
+
return true;
|
|
503
|
+
}
|
|
504
|
+
const resolvedProvider = resolveProvider(provider, contextUser);
|
|
505
|
+
if (resolvedProvider && resolvedProvider.ProviderType !== 'Database') {
|
|
506
|
+
return true;
|
|
507
|
+
}
|
|
508
|
+
if (!contextUser || !resolvedProvider || !concept.ID) {
|
|
509
|
+
concept.NewRecord();
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
const conceptEntity = resolvedProvider.EntityByName(GRAPH_CONCEPTS_ENTITY_NAME);
|
|
513
|
+
if (!conceptEntity) {
|
|
514
|
+
concept.NewRecord();
|
|
515
|
+
return false;
|
|
516
|
+
}
|
|
517
|
+
LoadCoreVisibilityRules();
|
|
518
|
+
try {
|
|
519
|
+
const refs = [
|
|
520
|
+
{ EntityName: GRAPH_CONCEPTS_ENTITY_NAME, EntityID: conceptEntity.ID, RecordID: concept.ID },
|
|
521
|
+
];
|
|
522
|
+
const parentId = typeof concept.ParentID === 'string' && concept.ParentID.trim().length > 0
|
|
523
|
+
? concept.ParentID.trim()
|
|
524
|
+
: null;
|
|
525
|
+
if (parentId && !UUIDsEqual(parentId, concept.ID)) {
|
|
526
|
+
refs.push({ EntityName: GRAPH_CONCEPTS_ENTITY_NAME, EntityID: conceptEntity.ID, RecordID: parentId });
|
|
527
|
+
}
|
|
528
|
+
const decisions = await runInsideConceptVisibilityEval(() => ResolveVisibility(refs, contextUser, {
|
|
529
|
+
Provider: resolvedProvider,
|
|
530
|
+
Caller: 'MJGraphConceptEntityServer.InnerLoad',
|
|
531
|
+
}));
|
|
532
|
+
const decision = decisions.get(FormatVisibilityNodeKey({ EntityName: GRAPH_CONCEPTS_ENTITY_NAME, EntityID: conceptEntity.ID, RecordID: concept.ID }, resolvedProvider));
|
|
533
|
+
if (!decision || decision.Outcome === 'Hidden') {
|
|
534
|
+
concept.NewRecord();
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
if (decision.Outcome === 'Redacted') {
|
|
538
|
+
RedactConceptEntityInPlace(concept, concept.ID);
|
|
539
|
+
}
|
|
540
|
+
else if (parentId) {
|
|
541
|
+
const parentDecision = decisions.get(FormatVisibilityNodeKey({ EntityName: GRAPH_CONCEPTS_ENTITY_NAME, EntityID: conceptEntity.ID, RecordID: parentId }, resolvedProvider));
|
|
542
|
+
if (!parentDecision || parentDecision.Outcome !== 'Allowed') {
|
|
543
|
+
blankParentNameOnRow(concept);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return true;
|
|
547
|
+
}
|
|
548
|
+
catch (err) {
|
|
549
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
550
|
+
LogError(`MJGraphConceptEntityServer.InnerLoad visibility check failed; failing closed: ${msg}`);
|
|
551
|
+
concept.NewRecord();
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Registers {@link GraphConceptPreRunViewHook} and {@link GraphConceptPostRunViewHook} and marks
|
|
557
|
+
* `MJ: Graph Concepts` as a PostRunView-protected entity so differential cache / raw SQL bypasses
|
|
558
|
+
* are blocked. Idempotent.
|
|
559
|
+
*/
|
|
560
|
+
export function EnsureGraphConceptReadHookRegistered() {
|
|
561
|
+
LoadCoreVisibilityRules();
|
|
562
|
+
const existingPre = GetDataHooks('PreRunView');
|
|
563
|
+
if (!existingPre.includes(GraphConceptPreRunViewHook)) {
|
|
564
|
+
RegisterDataHook('PreRunView', GraphConceptPreRunViewHook);
|
|
565
|
+
}
|
|
566
|
+
const existingPost = GetDataHooks('PostRunView');
|
|
567
|
+
if (!existingPost.includes(GraphConceptPostRunViewHook)) {
|
|
568
|
+
RegisterDataHook('PostRunView', GraphConceptPostRunViewHook);
|
|
569
|
+
}
|
|
570
|
+
RegisterPostRunViewProtectedEntity(GRAPH_CONCEPTS_ENTITY_NAME);
|
|
571
|
+
}
|
|
572
|
+
// Auto-register when @memberjunction/core-entities-server is loaded
|
|
573
|
+
EnsureGraphConceptReadHookRegistered();
|
|
574
|
+
//# sourceMappingURL=GraphConceptReadSecurityHook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphConceptReadSecurityHook.js","sourceRoot":"","sources":["../../src/custom/GraphConceptReadSecurityHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EACH,UAAU,EACV,uBAAuB,EACvB,YAAY,EAEZ,QAAQ,EACR,QAAQ,EAGR,gBAAgB,EAChB,kCAAkC,EAClC,iBAAiB,EACjB,OAAO,EAIP,mBAAmB,GAGtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EACH,uBAAuB,EAEvB,qBAAqB,GACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EA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ityInfo, PostRunViewHook, PreRunViewHook } from '@memberjunction/core';
|
|
2
|
+
/**
|
|
3
|
+
* Entities whose `MJ: Record Changes` audit rows contain graph-scoped state (link targets,
|
|
4
|
+
* concept text, edge descriptions, graph metadata) and therefore require `Read` permission
|
|
5
|
+
* on the owning graph before a non-admin caller can read those change rows (Finding 298 / D70).
|
|
6
|
+
*/
|
|
7
|
+
export declare const GRAPH_SCOPED_RECORD_CHANGE_ENTITIES: readonly ["MJ: Graphs", "MJ: Graph Concepts", "MJ: Graph Edges", "MJ: Graph Links"];
|
|
8
|
+
/**
|
|
9
|
+
* Extracts all `GraphID` UUIDs referenced by a `MJ: Record Changes` row's `FullRecordJSON` and/or
|
|
10
|
+
* `ChangesJSON` payloads (including both `OldValue` and `NewValue` on a graph reparent).
|
|
11
|
+
*/
|
|
12
|
+
export declare function ExtractGraphIdsFromRecordChangePayloads(fullRecordJson: string | null | undefined, changesJson: string | null | undefined): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Extracts the bare primary-key UUID from a `MJ: Record Changes.RecordID` value (handling both
|
|
15
|
+
* `'ID|<uuid>'` concatenated keys and bare `'<uuid>'` strings).
|
|
16
|
+
*/
|
|
17
|
+
export declare function ExtractSingleRecordIdFromChange(entity: EntityInfo, rawRecordId: string | null | undefined): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Explicit allow-list of non-sensitive structural columns preserved on a Redacted concept's
|
|
20
|
+
* `MJ: Record Changes` row (Finding 394). Every other column (including `FullRecordJSON`,
|
|
21
|
+
* `ChangesJSON`, `ChangesDescription`, `ErrorLog`, `Comments`, `RestoreReason`, `ChangeContext`,
|
|
22
|
+
* and any future text column) is nulled so hidden concept text cannot leak.
|
|
23
|
+
*/
|
|
24
|
+
export declare const REDACTED_RECORD_CHANGE_ALLOWED_FIELDS: Set<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Server-side `PreRunView` hook for `MJ: Record Changes` (Finding 298).
|
|
27
|
+
* Ensures `EntityID`, `RecordID`, `FullRecordJSON`, and `ChangesJSON` are projected when a
|
|
28
|
+
* non-admin caller specifies a narrow `Fields` list, so `PostRunView` can filter graph-scoped
|
|
29
|
+
* change history without mutating the caller's requested shape afterward.
|
|
30
|
+
*/
|
|
31
|
+
export declare const GraphRecordChangesPreRunViewHook: PreRunViewHook;
|
|
32
|
+
/**
|
|
33
|
+
* Server-side `PostRunView` hook for `MJ: Record Changes` (Finding 298).
|
|
34
|
+
* Filters out change-history rows for `MJ: Graphs`, `MJ: Graph Concepts`, `MJ: Graph Edges`, and
|
|
35
|
+
* `MJ: Graph Links` whenever the caller lacks `Read` permission on the owning graph (including
|
|
36
|
+
* `count_only` queries). Never mutates `results.Results` in place.
|
|
37
|
+
*/
|
|
38
|
+
export declare const GraphRecordChangesPostRunViewHook: PostRunViewHook;
|
|
39
|
+
/**
|
|
40
|
+
* Ensures {@link GraphRecordChangesPreRunViewHook} and {@link GraphRecordChangesPostRunViewHook}
|
|
41
|
+
* are registered and `MJ: Record Changes` is protected from differential-cache / raw-view bypasses.
|
|
42
|
+
* Idempotent.
|
|
43
|
+
*/
|
|
44
|
+
export declare function EnsureGraphRecordChangesReadHookRegistered(): void;
|
|
45
|
+
//# sourceMappingURL=GraphRecordChangesReadSecurityHook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphRecordChangesReadSecurityHook.d.ts","sourceRoot":"","sources":["../../src/custom/GraphRecordChangesReadSecurityHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,UAAU,EAMV,eAAe,EACf,cAAc,EAUjB,MAAM,sBAAsB,CAAC;AAkB9B;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,qFAKtC,CAAC;AAsFX;;;GAGG;AACH,wBAAgB,uCAAuC,CACnD,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACvC,MAAM,EAAE,CA4CV;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAezH;AA+FD;;;;;GAKG;AACH,eAAO,MAAM,qCAAqC,aAWhD,CAAC;AAgWH;;;;;GAKG;AACH,eAAO,MAAM,gCAAgC,EAAE,cAoC9C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,EAAE,eAiF/C,CAAC;AAkEF;;;;GAIG;AACH,wBAAgB,0CAA0C,IAAI,IAAI,CAUjE"}
|