@lightdash-tools/common 0.6.0 → 0.8.0
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/dist/agentops/extract-yaml-project.d.ts +7 -0
- package/dist/agentops/extract-yaml-project.js +42 -0
- package/dist/agentops/formatters.d.ts +5 -0
- package/dist/agentops/formatters.js +47 -0
- package/dist/agentops/snapshots.d.ts +32 -0
- package/dist/agentops/snapshots.js +34 -0
- package/dist/agentops/types.d.ts +224 -0
- package/dist/agentops/types.js +430 -0
- package/dist/argument-validation.d.ts +25 -0
- package/dist/argument-validation.js +217 -0
- package/dist/argument-validation.test.d.ts +1 -0
- package/dist/argument-validation.test.js +205 -0
- package/dist/audit.d.ts +9 -2
- package/dist/audit.js +17 -2
- package/dist/audit.test.d.ts +1 -0
- package/dist/audit.test.js +73 -0
- package/dist/env.d.ts +8 -0
- package/dist/env.js +9 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.js +14 -2
- package/dist/input-validation.d.ts +35 -0
- package/dist/input-validation.js +87 -0
- package/dist/input-validation.test.js +93 -0
- package/dist/operations/agent-safe.d.ts +5 -0
- package/dist/operations/agent-safe.js +9 -0
- package/dist/operations/ai-agents.d.ts +6 -0
- package/dist/operations/ai-agents.js +427 -0
- package/dist/operations/cli-content.d.ts +5 -0
- package/dist/operations/cli-content.js +71 -0
- package/dist/operations/client-coverage.d.ts +113 -0
- package/dist/operations/client-coverage.js +130 -0
- package/dist/operations/client-coverage.test.d.ts +1 -0
- package/dist/operations/client-coverage.test.js +22 -0
- package/dist/operations/content-developer.d.ts +2 -0
- package/dist/operations/content-developer.js +457 -0
- package/dist/operations/content-governance.d.ts +7 -0
- package/dist/operations/content-governance.js +98 -0
- package/dist/operations/content-reader.d.ts +2 -0
- package/dist/operations/content-reader.js +183 -0
- package/dist/operations/index.d.ts +12 -0
- package/dist/operations/index.js +34 -0
- package/dist/operations/organization-audit.d.ts +2 -0
- package/dist/operations/organization-audit.js +273 -0
- package/dist/operations/parity.test.d.ts +1 -0
- package/dist/operations/parity.test.js +29 -0
- package/dist/operations/registry.d.ts +18 -0
- package/dist/operations/registry.js +110 -0
- package/dist/operations/registry.test.d.ts +1 -0
- package/dist/operations/registry.test.js +223 -0
- package/dist/operations/semantic-layer.d.ts +6 -0
- package/dist/operations/semantic-layer.js +154 -0
- package/dist/operations/types.d.ts +86 -0
- package/dist/operations/types.js +104 -0
- package/dist/operations/types.test.d.ts +1 -0
- package/dist/operations/types.test.js +92 -0
- package/dist/operations/users.d.ts +6 -0
- package/dist/operations/users.js +58 -0
- package/dist/safety.d.ts +32 -2
- package/dist/safety.js +62 -5
- package/dist/safety.test.js +217 -4
- package/dist/types/generated/openapi-types.d.ts +32623 -11194
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.js +29 -0
- package/dist/types/lightdash-api.d.ts +1 -1
- package/dist/types/v1/ai-agents.d.ts +112 -3
- package/dist/types/v1/charts.d.ts +5 -3
- package/dist/types/v1/dashboards.d.ts +13 -0
- package/dist/types/v1/index.d.ts +45 -8
- package/dist/types/v1/index.js +1 -1
- package/dist/types/v1/lightdash-api.d.ts +107 -16
- package/dist/types/v1/users.d.ts +4 -0
- package/dist/types/v2/content.d.ts +2 -0
- package/dist/types/v2/content.js +8 -0
- package/dist/types/v2/index.d.ts +11 -9
- package/dist/types/v2/index.js +1 -1
- package/package.json +17 -3
- package/src/agentops/extract-yaml-project.ts +42 -0
- package/src/agentops/formatters.ts +52 -0
- package/src/agentops/snapshots.ts +56 -0
- package/src/agentops/types.ts +599 -0
- package/src/argument-validation.test.ts +301 -0
- package/src/argument-validation.ts +258 -0
- package/src/audit.test.ts +87 -0
- package/src/audit.ts +32 -3
- package/src/env.ts +9 -0
- package/src/index.test.ts +1 -0
- package/src/index.ts +17 -6
- package/src/input-validation.test.ts +157 -1
- package/src/input-validation.ts +95 -0
- package/src/operations/agent-safe.ts +8 -0
- package/src/operations/ai-agents.ts +467 -0
- package/src/operations/cli-content.ts +79 -0
- package/src/operations/client-coverage.test.ts +23 -0
- package/src/operations/client-coverage.ts +147 -0
- package/src/operations/content-developer.ts +485 -0
- package/src/operations/content-governance.ts +110 -0
- package/src/operations/content-reader.ts +197 -0
- package/src/operations/index.ts +42 -0
- package/src/operations/organization-audit.ts +293 -0
- package/src/operations/parity.test.ts +33 -0
- package/src/operations/registry.test.ts +250 -0
- package/src/operations/registry.ts +128 -0
- package/src/operations/semantic-layer.ts +166 -0
- package/src/operations/types.test.ts +110 -0
- package/src/operations/types.ts +231 -0
- package/src/operations/users.ts +65 -0
- package/src/safety.test.ts +276 -4
- package/src/safety.ts +83 -4
- package/src/types/generated/openapi-types.ts +33701 -11813
- package/src/types/index.ts +13 -0
- package/src/types/lightdash-api.ts +39 -0
- package/src/types/v1/ai-agents.ts +133 -3
- package/src/types/v1/charts.ts +5 -3
- package/src/types/v1/dashboards.ts +19 -0
- package/src/types/v1/index.ts +51 -8
- package/src/types/v1/lightdash-api.ts +129 -20
- package/src/types/v1/users.ts +4 -0
- package/src/types/v2/content.ts +8 -0
- package/src/types/v2/index.ts +11 -9
- package/tsconfig.json +1 -0
package/src/env.ts
CHANGED
|
@@ -8,3 +8,12 @@ export const ENV_LIGHTDASH_TOOLS_DRY_RUN = 'LIGHTDASH_TOOLS_DRY_RUN';
|
|
|
8
8
|
export const ENV_LIGHTDASH_TOOLS_AUDIT_LOG = 'LIGHTDASH_TOOLS_AUDIT_LOG';
|
|
9
9
|
export const ENV_LIGHTDASH_TOOLS_SAFETY_MODE = 'LIGHTDASH_TOOLS_SAFETY_MODE';
|
|
10
10
|
export const ENV_LIGHTDASH_TOOLS_ALLOWED_PROJECTS = 'LIGHTDASH_TOOLS_ALLOWED_PROJECTS';
|
|
11
|
+
|
|
12
|
+
/** MCP HTTP server env vars (`LIGHTDASH_TOOLS_MCP_*` / `LIGHTDASH_TOOLS_OAUTH_*` per ADR-0009). */
|
|
13
|
+
/** @deprecated Removed — auth is credential-inferred (ADR-0007). Kept for migration error messages. */
|
|
14
|
+
export const ENV_LIGHTDASH_TOOLS_MCP_AUTH_MODE = 'LIGHTDASH_TOOLS_MCP_AUTH_MODE';
|
|
15
|
+
export const ENV_LIGHTDASH_TOOLS_MCP_HTTP_PORT = 'LIGHTDASH_TOOLS_MCP_HTTP_PORT';
|
|
16
|
+
export const ENV_LIGHTDASH_TOOLS_MCP_PUBLIC_URL = 'LIGHTDASH_TOOLS_MCP_PUBLIC_URL';
|
|
17
|
+
export const ENV_LIGHTDASH_TOOLS_MCP_SHARED_KEY = 'LIGHTDASH_TOOLS_MCP_SHARED_KEY';
|
|
18
|
+
export const ENV_LIGHTDASH_TOOLS_OAUTH_CLIENT_ID = 'LIGHTDASH_TOOLS_OAUTH_CLIENT_ID';
|
|
19
|
+
export const ENV_LIGHTDASH_TOOLS_OAUTH_CLIENT_SECRET = 'LIGHTDASH_TOOLS_OAUTH_CLIENT_SECRET';
|
package/src/index.test.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -11,12 +11,23 @@ export * from './safety';
|
|
|
11
11
|
// Export input validation
|
|
12
12
|
export * from './input-validation';
|
|
13
13
|
|
|
14
|
+
// Export argument / descriptor validation
|
|
15
|
+
export * from './argument-validation';
|
|
16
|
+
|
|
17
|
+
// Export shared typed operation catalog (ADR-0013)
|
|
18
|
+
export * from './operations';
|
|
19
|
+
|
|
20
|
+
// Export AgentOps bundle and gate types
|
|
21
|
+
export * from './agentops/types';
|
|
22
|
+
export * from './agentops/snapshots';
|
|
23
|
+
export * from './agentops/formatters';
|
|
24
|
+
export {
|
|
25
|
+
extractProjectUuidsFromToolArgs,
|
|
26
|
+
hasYamlProjectDocumentArgs,
|
|
27
|
+
} from './agentops/extract-yaml-project';
|
|
28
|
+
|
|
14
29
|
// Export audit logger (shared by MCP and CLI)
|
|
15
30
|
export * from './audit';
|
|
16
31
|
|
|
17
|
-
//
|
|
18
|
-
export * from './types
|
|
19
|
-
export type { LightdashApi } from './types/lightdash-api';
|
|
20
|
-
|
|
21
|
-
// Export raw OpenAPI types for direct use (e.g., by client package)
|
|
22
|
-
export type { paths, components, operations } from './types/generated/openapi-types';
|
|
32
|
+
// Curated Lightdash API types + generated OpenAPI shapes (single public path)
|
|
33
|
+
export * from './types';
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
rejectControlChars,
|
|
5
|
+
validateFingerprint,
|
|
6
|
+
validateResourceId,
|
|
7
|
+
validateSafeOutputDir,
|
|
8
|
+
validateSlug,
|
|
9
|
+
validateUuid,
|
|
10
|
+
validateUuidOrSlug,
|
|
11
|
+
} from './input-validation';
|
|
3
12
|
|
|
4
13
|
describe('input-validation', () => {
|
|
5
14
|
describe('rejectControlChars', () => {
|
|
@@ -75,6 +84,153 @@ describe('input-validation', () => {
|
|
|
75
84
|
});
|
|
76
85
|
});
|
|
77
86
|
|
|
87
|
+
describe('validateUuid', () => {
|
|
88
|
+
const validUuid = '550e8400-e29b-41d4-a716-446655440000';
|
|
89
|
+
|
|
90
|
+
it('accepts lowercase UUID', () => {
|
|
91
|
+
expect(validateUuid(validUuid)).toBe(validUuid);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('accepts uppercase UUID', () => {
|
|
95
|
+
expect(validateUuid(validUuid.toUpperCase())).toBe(validUuid.toUpperCase());
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('throws on invalid format', () => {
|
|
99
|
+
expect(() => validateUuid('not-a-uuid')).toThrow('Invalid UUID format');
|
|
100
|
+
expect(() => validateUuid('550e8400-e29b-41d4-a716')).toThrow('Invalid UUID format');
|
|
101
|
+
expect(() => validateUuid('550e8400-e29b-41d4-a716-446655440000-extra')).toThrow(
|
|
102
|
+
'Invalid UUID format',
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('throws on control characters', () => {
|
|
107
|
+
expect(() => validateUuid('550e8400-e29b-41d4-a716\u000044655440000')).toThrow(
|
|
108
|
+
'Input contains invalid control characters',
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('throws when id is not a string', () => {
|
|
113
|
+
expect(() => validateUuid(123 as unknown as string)).toThrow('UUID must be a string');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('validateSlug', () => {
|
|
118
|
+
it('accepts valid slugs', () => {
|
|
119
|
+
expect(validateSlug('my-chart')).toBe('my-chart');
|
|
120
|
+
expect(validateSlug('chart_123')).toBe('chart_123');
|
|
121
|
+
expect(validateSlug('a.b-c_d')).toBe('a.b-c_d');
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('throws on empty slug', () => {
|
|
125
|
+
expect(() => validateSlug('')).toThrow('Slug must be between 1 and 256 characters');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('throws when slug exceeds max length', () => {
|
|
129
|
+
expect(() => validateSlug('a'.repeat(257))).toThrow(
|
|
130
|
+
'Slug must be between 1 and 256 characters',
|
|
131
|
+
);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('accepts slug at max length', () => {
|
|
135
|
+
const slug = 'a'.repeat(256);
|
|
136
|
+
expect(validateSlug(slug)).toBe(slug);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('throws on invalid characters', () => {
|
|
140
|
+
expect(() => validateSlug('has space')).toThrow(
|
|
141
|
+
'Slug must contain only alphanumeric characters, dots, underscores, and hyphens',
|
|
142
|
+
);
|
|
143
|
+
expect(() => validateSlug('slug?query')).toThrow(
|
|
144
|
+
'Slug must contain only alphanumeric characters, dots, underscores, and hyphens',
|
|
145
|
+
);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('rejects path traversal segments', () => {
|
|
149
|
+
expect(() => validateSlug('.')).toThrow('Slug must not contain path traversal segments');
|
|
150
|
+
expect(() => validateSlug('..')).toThrow('Slug must not contain path traversal segments');
|
|
151
|
+
expect(() => validateSlug('foo..bar')).toThrow(
|
|
152
|
+
'Slug must not contain path traversal segments',
|
|
153
|
+
);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('throws on control characters', () => {
|
|
157
|
+
expect(() => validateSlug('slug\u0001')).toThrow('Input contains invalid control characters');
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('throws when id is not a string', () => {
|
|
161
|
+
expect(() => validateSlug(123 as unknown as string)).toThrow('Slug must be a string');
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
describe('validateUuidOrSlug', () => {
|
|
166
|
+
const validUuid = '550e8400-e29b-41d4-a716-446655440000';
|
|
167
|
+
|
|
168
|
+
it('accepts UUIDs', () => {
|
|
169
|
+
expect(validateUuidOrSlug(validUuid)).toBe(validUuid);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('accepts slugs such as dashboard names', () => {
|
|
173
|
+
expect(validateUuidOrSlug('sales-overview')).toBe('sales-overview');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('rejects invalid slug characters', () => {
|
|
177
|
+
expect(() => validateUuidOrSlug('bad?')).toThrow(
|
|
178
|
+
'Slug must contain only alphanumeric characters',
|
|
179
|
+
);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('rejects path traversal slugs', () => {
|
|
183
|
+
expect(() => validateUuidOrSlug('.')).toThrow(
|
|
184
|
+
'Slug must not contain path traversal segments',
|
|
185
|
+
);
|
|
186
|
+
expect(() => validateUuidOrSlug('..')).toThrow(
|
|
187
|
+
'Slug must not contain path traversal segments',
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('throws when id is not a string', () => {
|
|
192
|
+
expect(() => validateUuidOrSlug(123 as unknown as string)).toThrow(
|
|
193
|
+
'Resource ID must be a string',
|
|
194
|
+
);
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
describe('validateFingerprint', () => {
|
|
199
|
+
it('accepts non-empty fingerprints', () => {
|
|
200
|
+
expect(validateFingerprint('abc123')).toBe('abc123');
|
|
201
|
+
expect(validateFingerprint('sha256:deadbeef')).toBe('sha256:deadbeef');
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('throws on empty fingerprint', () => {
|
|
205
|
+
expect(() => validateFingerprint('')).toThrow(
|
|
206
|
+
'Fingerprint must be between 1 and 512 characters',
|
|
207
|
+
);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('throws when fingerprint exceeds max length', () => {
|
|
211
|
+
expect(() => validateFingerprint('x'.repeat(513))).toThrow(
|
|
212
|
+
'Fingerprint must be between 1 and 512 characters',
|
|
213
|
+
);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('accepts fingerprint at max length', () => {
|
|
217
|
+
const fp = 'x'.repeat(512);
|
|
218
|
+
expect(validateFingerprint(fp)).toBe(fp);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('throws on control characters', () => {
|
|
222
|
+
expect(() => validateFingerprint('fp\u0000')).toThrow(
|
|
223
|
+
'Input contains invalid control characters',
|
|
224
|
+
);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it('throws when id is not a string', () => {
|
|
228
|
+
expect(() => validateFingerprint(123 as unknown as string)).toThrow(
|
|
229
|
+
'Fingerprint must be a string',
|
|
230
|
+
);
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
|
|
78
234
|
describe('validateSafeOutputDir', () => {
|
|
79
235
|
it('accepts path within CWD', () => {
|
|
80
236
|
const result = validateSafeOutputDir('output');
|
package/src/input-validation.ts
CHANGED
|
@@ -9,6 +9,17 @@ import * as path from 'node:path';
|
|
|
9
9
|
|
|
10
10
|
const FORBIDDEN_IN_RESOURCE_ID = /[?#%]|\.\./;
|
|
11
11
|
|
|
12
|
+
/** RFC 4122 UUID (any version), case-insensitive hex. */
|
|
13
|
+
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
14
|
+
|
|
15
|
+
const SLUG_REGEX = /^[A-Za-z0-9._-]+$/;
|
|
16
|
+
|
|
17
|
+
const SLUG_MIN_LENGTH = 1;
|
|
18
|
+
const SLUG_MAX_LENGTH = 256;
|
|
19
|
+
|
|
20
|
+
const FINGERPRINT_MIN_LENGTH = 1;
|
|
21
|
+
const FINGERPRINT_MAX_LENGTH = 512;
|
|
22
|
+
|
|
12
23
|
function hasControlChars(str: string): boolean {
|
|
13
24
|
for (let i = 0; i < str.length; i++) {
|
|
14
25
|
if (str.charCodeAt(i) < 0x20) return true;
|
|
@@ -52,6 +63,90 @@ export function validateResourceId(id: string): string {
|
|
|
52
63
|
return id;
|
|
53
64
|
}
|
|
54
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Validates a UUID string (RFC 4122 format).
|
|
68
|
+
*
|
|
69
|
+
* @param id - UUID to validate
|
|
70
|
+
* @returns The input if valid
|
|
71
|
+
* @throws Error if format is invalid or control characters are present
|
|
72
|
+
*/
|
|
73
|
+
export function validateUuid(id: string): string {
|
|
74
|
+
if (typeof id !== 'string') {
|
|
75
|
+
throw new Error('UUID must be a string');
|
|
76
|
+
}
|
|
77
|
+
rejectControlChars(id);
|
|
78
|
+
if (!UUID_REGEX.test(id)) {
|
|
79
|
+
throw new Error('Invalid UUID format');
|
|
80
|
+
}
|
|
81
|
+
return id;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Validates a slug: 1–256 chars, alphanumeric plus `.`, `_`, `-`.
|
|
86
|
+
* Rejects `.` / `..` (and embedded `..`) so path clients cannot normalize
|
|
87
|
+
* the identifier into a parent URL segment.
|
|
88
|
+
*
|
|
89
|
+
* @param id - Slug to validate
|
|
90
|
+
* @returns The input if valid
|
|
91
|
+
* @throws Error if length or character set is invalid
|
|
92
|
+
*/
|
|
93
|
+
export function validateSlug(id: string): string {
|
|
94
|
+
if (typeof id !== 'string') {
|
|
95
|
+
throw new Error('Slug must be a string');
|
|
96
|
+
}
|
|
97
|
+
rejectControlChars(id);
|
|
98
|
+
if (id.length < SLUG_MIN_LENGTH || id.length > SLUG_MAX_LENGTH) {
|
|
99
|
+
throw new Error(`Slug must be between ${SLUG_MIN_LENGTH} and ${SLUG_MAX_LENGTH} characters`);
|
|
100
|
+
}
|
|
101
|
+
if (id === '.' || id === '..' || id.includes('..')) {
|
|
102
|
+
throw new Error('Slug must not contain path traversal segments (. or ..)');
|
|
103
|
+
}
|
|
104
|
+
if (!SLUG_REGEX.test(id)) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
'Slug must contain only alphanumeric characters, dots, underscores, and hyphens',
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return id;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Validates an OpenAPI UuidOrSlug identifier: UUID when the string matches UUID form,
|
|
114
|
+
* otherwise a safe slug.
|
|
115
|
+
*
|
|
116
|
+
* @param id - UUID or slug to validate
|
|
117
|
+
* @returns The input if valid
|
|
118
|
+
* @throws Error if neither UUID nor slug rules pass
|
|
119
|
+
*/
|
|
120
|
+
export function validateUuidOrSlug(id: string): string {
|
|
121
|
+
if (typeof id !== 'string') {
|
|
122
|
+
throw new Error('Resource ID must be a string');
|
|
123
|
+
}
|
|
124
|
+
if (UUID_REGEX.test(id)) {
|
|
125
|
+
return validateUuid(id);
|
|
126
|
+
}
|
|
127
|
+
return validateSlug(id);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Validates a fingerprint identifier: 1–512 chars, no control characters.
|
|
132
|
+
*
|
|
133
|
+
* @param id - Fingerprint to validate
|
|
134
|
+
* @returns The input if valid
|
|
135
|
+
* @throws Error if length is invalid or control characters are present
|
|
136
|
+
*/
|
|
137
|
+
export function validateFingerprint(id: string): string {
|
|
138
|
+
if (typeof id !== 'string') {
|
|
139
|
+
throw new Error('Fingerprint must be a string');
|
|
140
|
+
}
|
|
141
|
+
rejectControlChars(id);
|
|
142
|
+
if (id.length < FINGERPRINT_MIN_LENGTH || id.length > FINGERPRINT_MAX_LENGTH) {
|
|
143
|
+
throw new Error(
|
|
144
|
+
`Fingerprint must be between ${FINGERPRINT_MIN_LENGTH} and ${FINGERPRINT_MAX_LENGTH} characters`,
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
return id;
|
|
148
|
+
}
|
|
149
|
+
|
|
55
150
|
/**
|
|
56
151
|
* Validates that a file path is safe for output within the current working directory.
|
|
57
152
|
* Rejects: .. traversal, absolute paths outside CWD.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-safe surface policy helpers (ADR-0004 / ADR-0013).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { listBannedMcpToolNames } from './registry';
|
|
6
|
+
|
|
7
|
+
/** Banned MCP tool names (without `lightdash_` prefix) for regression tests. */
|
|
8
|
+
export const IRRECOVERABLE_TOOL_DENYLIST = listBannedMcpToolNames();
|