@jupiterone/jupiterone-mcp 2.5.0 → 2.6.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.
Files changed (80) hide show
  1. package/README.md +25 -4
  2. package/dist/client/services/compliance-service.d.ts +0 -2
  3. package/dist/client/services/compliance-service.d.ts.map +1 -1
  4. package/dist/client/services/compliance-service.js +0 -2
  5. package/dist/client/services/compliance-service.js.map +1 -1
  6. package/dist/generated/description-map.d.ts.map +1 -1
  7. package/dist/generated/description-map.js +1677 -3610
  8. package/dist/generated/description-map.js.map +1 -1
  9. package/dist/server/mcp-server.d.ts.map +1 -1
  10. package/dist/server/mcp-server.js +6 -3
  11. package/dist/server/mcp-server.js.map +1 -1
  12. package/dist/server/tools/account.d.ts.map +1 -1
  13. package/dist/server/tools/account.js +53 -14
  14. package/dist/server/tools/account.js.map +1 -1
  15. package/dist/server/tools/compliance/attestations.d.ts +3 -0
  16. package/dist/server/tools/compliance/attestations.d.ts.map +1 -0
  17. package/dist/server/tools/compliance/attestations.js +560 -0
  18. package/dist/server/tools/compliance/attestations.js.map +1 -0
  19. package/dist/server/tools/compliance/controls.d.ts +46 -0
  20. package/dist/server/tools/compliance/controls.d.ts.map +1 -0
  21. package/dist/server/tools/compliance/controls.js +928 -0
  22. package/dist/server/tools/compliance/controls.js.map +1 -0
  23. package/dist/server/tools/compliance/index.d.ts +21 -0
  24. package/dist/server/tools/compliance/index.d.ts.map +1 -0
  25. package/dist/server/tools/compliance/index.js +45 -0
  26. package/dist/server/tools/compliance/index.js.map +1 -0
  27. package/dist/server/tools/compliance/schemas.d.ts +368 -0
  28. package/dist/server/tools/compliance/schemas.d.ts.map +1 -0
  29. package/dist/server/tools/compliance/schemas.js +295 -0
  30. package/dist/server/tools/compliance/schemas.js.map +1 -0
  31. package/dist/server/tools/compliance/shared.d.ts +141 -0
  32. package/dist/server/tools/compliance/shared.d.ts.map +1 -0
  33. package/dist/server/tools/compliance/shared.js +231 -0
  34. package/dist/server/tools/compliance/shared.js.map +1 -0
  35. package/dist/server/tools/compliance/summary.d.ts +11 -0
  36. package/dist/server/tools/compliance/summary.d.ts.map +1 -0
  37. package/dist/server/tools/compliance/summary.js +931 -0
  38. package/dist/server/tools/compliance/summary.js.map +1 -0
  39. package/dist/server/tools/dashboards.d.ts.map +1 -1
  40. package/dist/server/tools/dashboards.js +3 -1
  41. package/dist/server/tools/dashboards.js.map +1 -1
  42. package/dist/server/tools/errors.d.ts +9 -1
  43. package/dist/server/tools/errors.d.ts.map +1 -1
  44. package/dist/server/tools/errors.js +33 -3
  45. package/dist/server/tools/errors.js.map +1 -1
  46. package/dist/server/tools/index.d.ts.map +1 -1
  47. package/dist/server/tools/index.js +4 -2
  48. package/dist/server/tools/index.js.map +1 -1
  49. package/dist/server/tools/j1ql.d.ts.map +1 -1
  50. package/dist/server/tools/j1ql.js +33 -9
  51. package/dist/server/tools/j1ql.js.map +1 -1
  52. package/dist/server/tools/reference.d.ts +19 -0
  53. package/dist/server/tools/reference.d.ts.map +1 -0
  54. package/dist/server/tools/reference.js +62 -0
  55. package/dist/server/tools/reference.js.map +1 -0
  56. package/dist/server/tools/rules.d.ts.map +1 -1
  57. package/dist/server/tools/rules.js +81 -104
  58. package/dist/server/tools/rules.js.map +1 -1
  59. package/dist/server/tools/threat.d.ts.map +1 -1
  60. package/dist/server/tools/threat.js +54 -4
  61. package/dist/server/tools/threat.js.map +1 -1
  62. package/dist/server/tools/types.d.ts +12 -0
  63. package/dist/server/tools/types.d.ts.map +1 -1
  64. package/dist/server/tools/types.js +8 -1
  65. package/dist/server/tools/types.js.map +1 -1
  66. package/dist/server/tools/usage.d.ts +6 -0
  67. package/dist/server/tools/usage.d.ts.map +1 -1
  68. package/dist/server/tools/usage.js +53 -8
  69. package/dist/server/tools/usage.js.map +1 -1
  70. package/dist/server/tools/widget-render-contract.d.ts +1 -1
  71. package/dist/utils/expires-on.d.ts +24 -0
  72. package/dist/utils/expires-on.d.ts.map +1 -0
  73. package/dist/utils/expires-on.js +79 -0
  74. package/dist/utils/expires-on.js.map +1 -0
  75. package/node_modules/dtrace-provider/build/Makefile +1 -1
  76. package/package.json +1 -1
  77. package/dist/server/tools/compliance.d.ts +0 -107
  78. package/dist/server/tools/compliance.d.ts.map +0 -1
  79. package/dist/server/tools/compliance.js +0 -2886
  80. package/dist/server/tools/compliance.js.map +0 -1
@@ -0,0 +1,560 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.attestationTools = void 0;
4
+ const zod_1 = require("zod");
5
+ const sanitize_error_js_1 = require("../../../client/sanitize-error.js");
6
+ const expires_on_js_1 = require("../../../utils/expires-on.js");
7
+ const load_description_js_1 = require("../../../utils/load-description.js");
8
+ const result_js_1 = require("../result.js");
9
+ const types_js_1 = require("../types.js");
10
+ const controls_js_1 = require("./controls.js");
11
+ const schemas_js_1 = require("./schemas.js");
12
+ const shared_js_1 = require("./shared.js");
13
+ /**
14
+ * create-attestation, update-attestation and revoke-attestation, and what each write does to its
15
+ * control's status.
16
+ */
17
+ const NOTE_CREATED = '`attestations` and `get-control` can lag this write by a few seconds, occasionally up to a ' +
18
+ 'minute — re-read before assuming it failed; do not create it again.';
19
+ const NOTE_ALREADY_EXISTS = 'This control already has an active attestation with this subject, so nothing was created. To ' +
20
+ 'extend or edit it, call `update-attestation` with its `id`.';
21
+ const NOTE_SEVERAL_MATCHES = 'Several active attestations on this control share this subject, all listed in `matches`: ' +
22
+ '`attestation` is the one whose subject matches yours exactly, or the most recently created ' +
23
+ 'when none or several do.';
24
+ const NOTE_UPDATED = '`attestations` and `get-control` can lag this write by a few seconds, occasionally up to a ' +
25
+ 'minute — re-read before assuming it failed.';
26
+ const NOTE_ATTESTATION_NOT_FOUND = "No attestation has this id, and nothing changed. Read the control's current attestation ids " +
27
+ 'from `get-control` (`attestations`).';
28
+ const NOTE_UPDATE_NOT_FOUND = `${NOTE_ATTESTATION_NOT_FOUND} A revoked attestation is gone for good; attest again with ` +
29
+ '`create-attestation`.';
30
+ const NOTE_REVOKE_NOT_FOUND = `${NOTE_ATTESTATION_NOT_FOUND} An attestation that is already revoked is not found either, so ` +
31
+ 'there is nothing left to revoke.';
32
+ const NOTE_REVOKED = 'Revocation is permanent. `attestations` and `get-control` can lag this write by a few ' +
33
+ 'seconds, occasionally up to a minute — re-read before assuming it failed.';
34
+ function expiresOnError(operation, reason) {
35
+ return (0, shared_js_1.validationError)(`Attestation not ${operation} — \`expiresOn\` ${reason}. Pass "YYYY-MM-DD", ` +
36
+ '"YYYY-MM-DDThh:mm:ssZ", "YYYY-MM-DDThh:mm:ss+hh:mm" or epoch milliseconds.');
37
+ }
38
+ function sameSubject(a, b) {
39
+ return (a ?? '').trim().toLowerCase() === b.trim().toLowerCase();
40
+ }
41
+ /** An unknown creation time sorts as the oldest. */
42
+ function createdMs(attestation) {
43
+ const ms = attestation.createdOn ? Date.parse(attestation.createdOn) : Number.NaN;
44
+ return Number.isFinite(ms) ? ms : 0;
45
+ }
46
+ /** The ACTIVE attestations whose subject matches `subject`, trimmed and folded, newest first. */
47
+ function activeWithSubject(attestations, subject) {
48
+ return attestations
49
+ .filter((attestation) => attestation.state === 'ACTIVE' && sameSubject(attestation.subject, subject))
50
+ .sort((a, b) => createdMs(b) - createdMs(a));
51
+ }
52
+ /**
53
+ * Which of the matching attestations a create answers with: the one whose subject is exactly the
54
+ * one asked for, when exactly one is, else the most recently created. CCM accepts a rename onto
55
+ * another attestation's subject, and on j1dev `already_exists` then returned the renamed one
56
+ * rather than the exact original (2026-10-14).
57
+ */
58
+ function pickDuplicate(matches, subject) {
59
+ const exact = matches.filter((attestation) => attestation.subject?.trim() === subject.trim());
60
+ return exact.length === 1 ? exact[0] : matches[0];
61
+ }
62
+ function expiryNotAppliedNote(requestedMs, existing) {
63
+ return (`The requested expiry (${(0, shared_js_1.toIso)(requestedMs)}) was not applied: this attestation expires ` +
64
+ `${(0, shared_js_1.toIso)(existing.expiresOn) ?? 'at an unknown time'}. Change it with \`update-attestation\`.`);
65
+ }
66
+ function duplicateMatch(attestation) {
67
+ return {
68
+ id: attestation.id,
69
+ subject: attestation.subject,
70
+ expiresOnIso: (0, shared_js_1.toIso)(attestation.expiresOn),
71
+ createdOn: attestation.createdOn,
72
+ };
73
+ }
74
+ /**
75
+ * The note sentence for an update that left two ACTIVE attestations on one control with the same
76
+ * subject. It names the other attestation by id only.
77
+ */
78
+ function subjectCollisionNote(otherId) {
79
+ return (`Active attestation \`${otherId}\` on this control has the same subject. CCM allows that, ` +
80
+ 'but `create-attestation` finds an existing attestation by its subject, so give each one a ' +
81
+ 'distinct subject.');
82
+ }
83
+ /** The control an attestation is for, or null when the gateway says it does not exist. */
84
+ async function findControl(client, controlId) {
85
+ try {
86
+ return await client.getControl(controlId);
87
+ }
88
+ catch (error) {
89
+ if ((0, shared_js_1.isNotFound)(error))
90
+ return null;
91
+ throw error;
92
+ }
93
+ }
94
+ /**
95
+ * The refusal texts name no control. The chokepoint copies the first 200 characters of error text
96
+ * into telemetry, and UPLOAD and JSON control ids embed the customer's control titles
97
+ * (`ccm_c_JSON_A.5.1 Policies`), which is why `controlId` is not logged either. The id stays in
98
+ * `structuredContent`.
99
+ */
100
+ function controlNotFound(controlId) {
101
+ return (0, shared_js_1.refusal)('not_found', 'Attestation not created — no control has this id. Resolve the control with `get-control` ' +
102
+ '(by `identifier` or `controlName`) and retry with the `id` it returns.', { controlId });
103
+ }
104
+ /** The API rejects an attestation on a control that is not LIVE; refused here before the write. */
105
+ function controlNotLive(control) {
106
+ return (0, shared_js_1.refusal)('not_live', `Attestation not created — this control is ${control.state ?? 'in no state'}, and ` +
107
+ 'attestations apply only to LIVE controls. No tool on this connection can change a ' +
108
+ "control's state, so the control has to be promoted to LIVE in JupiterOne Compliance " +
109
+ 'before it can be attested; retrying will not help.', { controlId: control.id, control: { id: control.id, name: control.name, state: control.state } });
110
+ }
111
+ /**
112
+ * What an attestation does to its control's stored status, by CCM's own order: a failing test or
113
+ * an expired, unrevoked attestation fails the control whatever else is attested, a passing test
114
+ * already passes it, and only a control with neither passes because of the attestation. In the
115
+ * 2026-10-14 live run two attestations came back `created` on controls that stayed FAIL — one with
116
+ * a failing test, one with an older expired attestation nobody had revoked — and nothing said so.
117
+ *
118
+ * `written` is the attestation just created or updated. Its state comes from the write's own
119
+ * response, not from `attestations`, which can lag the write.
120
+ */
121
+ function statusImpact(control, attestations, written) {
122
+ const tests = control.controlTests ?? [];
123
+ const current = [...attestations.filter((attestation) => attestation.id !== written.id), written];
124
+ const blockers = [
125
+ ...(control.state === 'LIVE'
126
+ ? []
127
+ : [{ type: 'not_live', id: control.id, state: control.state }]),
128
+ ...(0, controls_js_1.failureCauses)(tests, current),
129
+ ];
130
+ if (blockers.length > 0)
131
+ return { statusImpact: 'blocked', blockers };
132
+ const passing = tests.some((test) => !test.deleted && test.status === 'PASS');
133
+ return { statusImpact: passing ? 'already_passing' : 'passes_by_attestation', blockers };
134
+ }
135
+ /** One sentence per kind of blocker, naming what holds the control where it is. */
136
+ function blockerNotes(blockers) {
137
+ const notes = [];
138
+ const notLive = blockers.find((blocker) => blocker.type === 'not_live');
139
+ if (notLive) {
140
+ notes.push(`The control is ${notLive.state ?? 'in no state'} and CCM evaluates only LIVE controls, so ` +
141
+ 'the attestation does not change its status.');
142
+ }
143
+ const failing = blockers.flatMap((blocker) => blocker.type === 'failing_test' ? [`'${blocker.name}'`] : []);
144
+ if (failing.length > 0) {
145
+ notes.push(`This control has ${failing.length === 1 ? 'a failing test' : 'failing tests'} ` +
146
+ `(${failing.join(', ')}), so the attestation does not change its status.`);
147
+ }
148
+ for (const blocker of blockers) {
149
+ if (blocker.type !== 'expired_attestation')
150
+ continue;
151
+ notes.push(`Expired attestation '${blocker.subject}' (\`${blocker.id}\`) fails the control until it ` +
152
+ 'is renewed with `update-attestation` or revoked.');
153
+ }
154
+ return notes;
155
+ }
156
+ function withBlockerNotes(note, impact) {
157
+ return [note, ...blockerNotes(impact.blockers)].join(' ');
158
+ }
159
+ /**
160
+ * The control a written attestation belongs to and its attestations, read after the write. The
161
+ * write has already succeeded, so a failed read is null, reported as `statusImpact: 'unknown'`
162
+ * rather than failing the call, which would invite a repeat of a write that went through.
163
+ */
164
+ async function readAfterWrite(client, controlId, deadlineAt) {
165
+ if (!controlId || Date.now() >= deadlineAt)
166
+ return null;
167
+ try {
168
+ const read = await (0, shared_js_1.withDeadline)(Promise.all([client.getControl(controlId), client.listAttestations({ controlId })]), deadlineAt);
169
+ if (read === shared_js_1.DEADLINE_PASSED)
170
+ return null;
171
+ const [control, attestations] = read;
172
+ return { control, attestations };
173
+ }
174
+ catch (error) {
175
+ console.error('Error reading the control after an attestation write:', error);
176
+ return null;
177
+ }
178
+ }
179
+ /** The note sentence for a write whose control could not be read back in time, or at all. */
180
+ function unreadAfterWrite(write) {
181
+ return (`The control could not be re-read in time after the ${write}, so its effect on the ` +
182
+ `control's status is unknown; the ${write} went through and does not need repeating.`);
183
+ }
184
+ /**
185
+ * Whether a request was cut off by the host's abort signal: the remote's 55 s deadline. A write
186
+ * cut off this way may have landed, so it is answered as `interrupted`, never as a failure.
187
+ */
188
+ function isAborted(error) {
189
+ return error instanceof sanitize_error_js_1.JupiterOneApiError
190
+ ? error.code === sanitize_error_js_1.ABORTED_CODE
191
+ : error?.name === 'AbortError';
192
+ }
193
+ const INTERRUPTED_RECOVERY = {
194
+ // Not "create it again": the duplicate check reads CCM, whose reads lag its writes by up to a
195
+ // minute, so a retry inside that minute can make a second attestation (PR #55 review).
196
+ create: 'it may have been created. Before deciding whether to create it again, read the control ' +
197
+ 'with `get-control`: its `attestations` lists the subject once CCM can read it, which can ' +
198
+ 'take up to a minute, so wait a minute if it is not there yet.',
199
+ update: 'the update may have been applied. Read the attestation with `get-control` before repeating ' +
200
+ 'the update.',
201
+ revoke: 'it may have been revoked. To confirm, call `revoke-attestation` again: `not_found` means ' +
202
+ 'it was revoked.',
203
+ };
204
+ /**
205
+ * A write the request's deadline cut off. On j1dev every create and revoke that aborted had been
206
+ * written, and the caller hunted for the new id through reads that were timing out too
207
+ * (2026-10-15). The text names the write and how to confirm it, never the input.
208
+ */
209
+ function interrupted(write) {
210
+ const verb = { create: 'created', update: 'updated', revoke: 'revoked' }[write];
211
+ return (0, shared_js_1.refusal)('interrupted', `The request was cut off while the attestation was being ${verb}, so ` +
212
+ INTERRUPTED_RECOVERY[write]);
213
+ }
214
+ async function updateImpact(client, updated, subdomain, deadlineAt) {
215
+ const link = { id: updated.controlId, url: (0, shared_js_1.controlUrl)(updated.controlId, subdomain) };
216
+ const read = await readAfterWrite(client, updated.controlId, deadlineAt);
217
+ if (!read) {
218
+ return {
219
+ control: link,
220
+ statusImpact: 'unknown',
221
+ note: `${NOTE_UPDATED} ${unreadAfterWrite('update')}`,
222
+ };
223
+ }
224
+ const { control, attestations } = read;
225
+ const impact = statusImpact(control, attestations, updated);
226
+ // CCM accepts a rename onto another attestation's subject (04067953 onto 2f508829 on j1dev,
227
+ // 2026-10-14), after which create's duplicate check can answer with either one.
228
+ const [collision] = activeWithSubject(attestations.filter((attestation) => attestation.id !== updated.id), updated.subject);
229
+ const note = withBlockerNotes(NOTE_UPDATED, impact);
230
+ return {
231
+ control: { ...link, name: control.name, state: control.state },
232
+ ...impact,
233
+ ...(collision ? { subjectCollision: { id: collision.id, subject: collision.subject } } : {}),
234
+ note: collision ? `${note} ${subjectCollisionNote(collision.id)}` : note,
235
+ };
236
+ }
237
+ function revokeImpact(control, attestations, revoked, now) {
238
+ const tests = control.controlTests ?? [];
239
+ const others = attestations.filter((attestation) => attestation.id !== revoked.id);
240
+ const causes = (0, controls_js_1.failureCauses)(tests, others);
241
+ const blockers = [
242
+ ...(control.state === 'LIVE'
243
+ ? []
244
+ : [{ type: 'not_live', id: control.id, state: control.state }]),
245
+ ...causes,
246
+ ];
247
+ const passesBy = tests.some((test) => !test.deleted && test.status === 'PASS')
248
+ ? 'tests'
249
+ : others.some((attestation) => attestation.state === 'ACTIVE')
250
+ ? 'attestation'
251
+ : null;
252
+ if (causes.length > 0)
253
+ return { statusImpact: 'still_failing', blockers, passesBy };
254
+ const wasFailing = Number.isFinite(revoked.expiresOn) && revoked.expiresOn <= now;
255
+ if (wasFailing) {
256
+ return { statusImpact: passesBy ? 'now_passing' : 'no_longer_failing', blockers, passesBy };
257
+ }
258
+ return { statusImpact: passesBy ? 'still_passing' : 'no_longer_passing', blockers, passesBy };
259
+ }
260
+ const REVOKE_PASSES_BY = {
261
+ tests: 'a passing test',
262
+ attestation: 'another valid attestation',
263
+ };
264
+ /** The sentence naming what now decides the control's status after a revoke. */
265
+ function revokeNote(impact) {
266
+ const by = impact.passesBy ? REVOKE_PASSES_BY[impact.passesBy] : '';
267
+ switch (impact.statusImpact) {
268
+ case 'still_failing':
269
+ return `The control still fails. ${blockerNotes(impact.blockers).join(' ')}`;
270
+ case 'still_passing':
271
+ return `The control still passes: ${by} keeps it passing.`;
272
+ case 'now_passing':
273
+ return ('The revoked attestation had expired, so a failure is cleared: once CCM re-scores the ' +
274
+ `control, ${by} passes it.`);
275
+ case 'no_longer_failing':
276
+ return ('The revoked attestation had expired, so a failure is cleared, and nothing else passes ' +
277
+ 'the control: once CCM re-scores it, it is not evaluated.');
278
+ default:
279
+ return ('No passing test and no other valid attestation remain, so the control no longer ' +
280
+ 'passes: once CCM re-scores it, it is not evaluated.');
281
+ }
282
+ }
283
+ async function revokeEffect(client, revoked, subdomain, deadlineAt) {
284
+ const link = { id: revoked.controlId, url: (0, shared_js_1.controlUrl)(revoked.controlId, subdomain) };
285
+ const read = await readAfterWrite(client, revoked.controlId, deadlineAt);
286
+ if (!read) {
287
+ return {
288
+ control: link,
289
+ statusImpact: 'unknown',
290
+ note: `${NOTE_REVOKED} ${unreadAfterWrite('revoke')}`,
291
+ };
292
+ }
293
+ const impact = revokeImpact(read.control, read.attestations, revoked, Date.now());
294
+ const notLive = impact.blockers.find((blocker) => blocker.type === 'not_live');
295
+ return {
296
+ control: { ...link, name: read.control.name, state: read.control.state },
297
+ statusImpact: impact.statusImpact,
298
+ blockers: impact.blockers,
299
+ note: [
300
+ NOTE_REVOKED,
301
+ revokeNote(impact),
302
+ ...(notLive && impact.statusImpact !== 'still_failing' ? blockerNotes([notLive]) : []),
303
+ ].join(' '),
304
+ };
305
+ }
306
+ /** `null` clears a field; an empty or blank string is sent as that clear, never as "". */
307
+ function clearable(value) {
308
+ return typeof value === 'string' && value.trim() === '' ? null : value;
309
+ }
310
+ function nonEmpty(value) {
311
+ return value?.trim() ? value : undefined;
312
+ }
313
+ // The tester got "expected string to have >=1 characters" for a subject of three spaces
314
+ // (2026-10-14); the SDK prefixes the parameter, so this reads "subject: Must not be blank."
315
+ const BLANK_SUBJECT = 'Must not be blank.';
316
+ // http(s) only, as the API requires; zod's `protocol` option matches the scheme without its colon.
317
+ // The message replaces zod's "Invalid URL", which the tester got for an ftp:// link (2026-10-14).
318
+ const evidenceLink = () => zod_1.z.url({ protocol: /^https?$/, error: 'Must be an http or https URL.' });
319
+ const expiresOnInput = () => zod_1.z.union([zod_1.z.string(), zod_1.z.number()]);
320
+ const attestationIdInput = () => zod_1.z.string().min(1).describe("The attestation's `id`, from `get-control` or `create-attestation`.");
321
+ exports.attestationTools = [
322
+ (0, types_js_1.defineTool)({
323
+ name: 'create-attestation',
324
+ title: 'Create Attestation',
325
+ description: (0, load_description_js_1.loadDescription)('create-attestation.md'),
326
+ inputSchema: {
327
+ controlId: zod_1.z
328
+ .string()
329
+ .trim()
330
+ .min(1)
331
+ .refine((value) => !shared_js_1.CONTROL_ID_FORBIDDEN.test(value), {
332
+ message: 'A control id never contains a quote or a backslash.',
333
+ })
334
+ .describe('The exact control id — resolve it with `get-control` first. Attestations apply only ' +
335
+ 'to LIVE controls.'),
336
+ subject: zod_1.z
337
+ .string()
338
+ .trim()
339
+ .min(1, { error: BLANK_SUBJECT })
340
+ .describe('What is attested, e.g. "Annual penetration test 2026". An active attestation with the ' +
341
+ 'same subject on this control is returned instead of creating a duplicate.'),
342
+ expiresOn: expiresOnInput().describe('When the attestation expires: "YYYY-MM-DD" (the end of that day, UTC), a date-time ' +
343
+ 'with Z or an offset ("YYYY-MM-DDThh:mm:ssZ", "YYYY-MM-DDThh:mm:ss+hh:mm"), or epoch ' +
344
+ 'milliseconds. ' +
345
+ 'Must be in the future.'),
346
+ description: zod_1.z.string().optional().describe('Optional detail, in markdown.'),
347
+ owner: (0, shared_js_1.ownerEmail)().optional().describe("Optional email address of the attestation's owner."),
348
+ documentLink: evidenceLink()
349
+ .optional()
350
+ .describe('Optional http(s) link to the supporting evidence.'),
351
+ },
352
+ outputSchema: schemas_js_1.createAttestationOutput,
353
+ // CREATE keeps idempotentHint false: inside the read-back lag a repeat would not see the first
354
+ // attestation and would make a second one.
355
+ annotations: types_js_1.CREATE,
356
+ accessDeniedHint: shared_js_1.ACCESS_DENIED_HINT,
357
+ errorContext: 'Error creating attestation',
358
+ handler: async (params, client) => {
359
+ const expiresOn = (0, expires_on_js_1.parseExpiresOn)(params.expiresOn);
360
+ if (!expiresOn.ok)
361
+ return expiresOnError('created', expiresOn.reason);
362
+ const startedAt = Date.now();
363
+ const subdomainRead = (0, shared_js_1.readSubdomain)(client);
364
+ // Implan's agent re-submitted the attestation form after reads that lagged the write. Any
365
+ // failure of this read fails the call: a create without it could be that duplicate. Every
366
+ // state but revoked comes back, so the same read finds the expired attestations that would
367
+ // keep this control failing; the duplicate check still looks at ACTIVE ones only. It keys on
368
+ // the id the caller passed, so it runs beside the control read: on j1dev each took 18-30 s
369
+ // (2026-10-15).
370
+ const attestationsRead = client.listAttestations({ controlId: params.controlId });
371
+ // Awaited once the control is known to be LIVE; a refusal before then leaves it behind.
372
+ attestationsRead.catch(() => undefined);
373
+ const control = await findControl(client, params.controlId);
374
+ if (!control)
375
+ return controlNotFound(params.controlId);
376
+ if (control.state !== 'LIVE')
377
+ return controlNotLive(control);
378
+ const attestations = await attestationsRead;
379
+ const duplicates = activeWithSubject(attestations, params.subject);
380
+ const controlSummary = {
381
+ id: control.id,
382
+ name: control.name,
383
+ state: control.state,
384
+ url: (0, shared_js_1.controlUrl)(control.id, await (0, shared_js_1.subdomainBy)(subdomainRead, startedAt + shared_js_1.WRITE_READ_DEADLINE_MS)),
385
+ };
386
+ if (duplicates.length > 0) {
387
+ const existing = pickDuplicate(duplicates, params.subject);
388
+ const impact = statusImpact(control, attestations, existing);
389
+ const several = duplicates.length > 1;
390
+ // On j1dev a retry asking for 2027-02-28 got back an attestation expiring three minutes
391
+ // later, with nothing saying the requested date was dropped (2026-10-14).
392
+ const applied = existing.expiresOn === expiresOn.ms;
393
+ const notes = [
394
+ NOTE_ALREADY_EXISTS,
395
+ ...(several ? [NOTE_SEVERAL_MATCHES] : []),
396
+ ...(applied ? [] : [expiryNotAppliedNote(expiresOn.ms, existing)]),
397
+ ];
398
+ return (0, result_js_1.structuredResult)({
399
+ outcome: 'already_exists',
400
+ attestation: (0, shared_js_1.projectAttestation)(existing),
401
+ requestedExpiresOnIso: (0, shared_js_1.toIso)(expiresOn.ms),
402
+ ...(applied ? {} : { requestedExpiresOnApplied: false }),
403
+ ...(several ? { matches: duplicates.map(duplicateMatch) } : {}),
404
+ control: controlSummary,
405
+ ...impact,
406
+ note: withBlockerNotes(notes.join(' '), impact),
407
+ });
408
+ }
409
+ let created;
410
+ try {
411
+ created = await client.createAttestation({
412
+ controlId: control.id,
413
+ subject: params.subject,
414
+ expiresOn: expiresOn.ms,
415
+ description: nonEmpty(params.description),
416
+ owner: params.owner,
417
+ documentLink: params.documentLink,
418
+ });
419
+ }
420
+ catch (error) {
421
+ if (isAborted(error))
422
+ return interrupted('create');
423
+ throw error;
424
+ }
425
+ const impact = statusImpact(control, attestations, created);
426
+ return (0, result_js_1.structuredResult)({
427
+ outcome: 'created',
428
+ attestation: (0, shared_js_1.projectAttestation)(created),
429
+ control: controlSummary,
430
+ ...impact,
431
+ note: withBlockerNotes(NOTE_CREATED, impact),
432
+ });
433
+ },
434
+ }),
435
+ (0, types_js_1.defineTool)({
436
+ name: 'update-attestation',
437
+ title: 'Update Attestation',
438
+ description: (0, load_description_js_1.loadDescription)('update-attestation.md'),
439
+ inputSchema: {
440
+ attestationId: attestationIdInput(),
441
+ subject: zod_1.z
442
+ .string()
443
+ .trim()
444
+ .min(1, { error: BLANK_SUBJECT })
445
+ .optional()
446
+ .describe('A new subject.'),
447
+ description: zod_1.z
448
+ .string()
449
+ .nullable()
450
+ .optional()
451
+ .describe('New detail, in markdown; null clears it.'),
452
+ expiresOn: expiresOnInput()
453
+ .optional()
454
+ .describe('A new expiry — how an attestation is renewed: "YYYY-MM-DD" (the end of that day, ' +
455
+ 'UTC), a date-time with Z or an offset, or epoch milliseconds. Must be in the future.'),
456
+ owner: (0, shared_js_1.ownerEmail)()
457
+ .nullable()
458
+ .optional()
459
+ .describe("A new owner's email address; null clears it."),
460
+ documentLink: evidenceLink()
461
+ .nullable()
462
+ .optional()
463
+ .describe('A new http(s) evidence link; null clears it.'),
464
+ },
465
+ outputSchema: schemas_js_1.updateAttestationOutput,
466
+ annotations: types_js_1.MUTATE,
467
+ accessDeniedHint: shared_js_1.ACCESS_DENIED_HINT,
468
+ errorContext: 'Error updating attestation',
469
+ handler: async ({ attestationId, ...changes }, client) => {
470
+ const startedAt = Date.now();
471
+ if (Object.values(changes).every((value) => value === undefined)) {
472
+ return (0, shared_js_1.validationError)('Attestation not updated — pass at least one field to change: `subject`, ' +
473
+ '`description`, `expiresOn`, `owner` or `documentLink`.');
474
+ }
475
+ let expiresOn;
476
+ if (changes.expiresOn !== undefined) {
477
+ const parsed = (0, expires_on_js_1.parseExpiresOn)(changes.expiresOn);
478
+ if (!parsed.ok)
479
+ return expiresOnError('updated', parsed.reason);
480
+ expiresOn = parsed.ms;
481
+ }
482
+ const subdomainRead = (0, shared_js_1.readSubdomain)(client);
483
+ let updated;
484
+ try {
485
+ updated = await client.updateAttestation({
486
+ id: attestationId,
487
+ subject: changes.subject,
488
+ description: clearable(changes.description),
489
+ expiresOn,
490
+ owner: changes.owner,
491
+ documentLink: changes.documentLink,
492
+ });
493
+ }
494
+ catch (error) {
495
+ if ((0, shared_js_1.isNotFound)(error)) {
496
+ return (0, result_js_1.structuredResult)({
497
+ outcome: 'not_found',
498
+ attestationId,
499
+ note: NOTE_UPDATE_NOT_FOUND,
500
+ });
501
+ }
502
+ if (isAborted(error))
503
+ return interrupted('update');
504
+ throw error;
505
+ }
506
+ // The update has landed: nothing after it may turn the answer into an error.
507
+ const deadlineAt = startedAt + shared_js_1.WRITE_READ_DEADLINE_MS;
508
+ const subdomain = await (0, shared_js_1.subdomainBy)(subdomainRead, deadlineAt);
509
+ return (0, result_js_1.structuredResult)({
510
+ outcome: 'updated',
511
+ attestation: (0, shared_js_1.projectAttestation)(updated),
512
+ note: NOTE_UPDATED,
513
+ ...(await updateImpact(client, updated, subdomain, deadlineAt)),
514
+ });
515
+ },
516
+ }),
517
+ (0, types_js_1.defineTool)({
518
+ name: 'revoke-attestation',
519
+ title: 'Revoke Attestation',
520
+ description: (0, load_description_js_1.loadDescription)('revoke-attestation.md'),
521
+ inputSchema: {
522
+ attestationId: attestationIdInput(),
523
+ },
524
+ outputSchema: schemas_js_1.revokeAttestationOutput,
525
+ // Confirmed on dev (2026-10-14): a second revoke of the same id gets the backend's not-found,
526
+ // returned as outcome not_found, and changes nothing, so repeating the call is harmless.
527
+ annotations: { ...types_js_1.MUTATE, idempotentHint: true },
528
+ accessDeniedHint: shared_js_1.ACCESS_DENIED_HINT,
529
+ errorContext: 'Error revoking attestation',
530
+ handler: async ({ attestationId }, client) => {
531
+ const startedAt = Date.now();
532
+ const subdomainRead = (0, shared_js_1.readSubdomain)(client);
533
+ let revoked;
534
+ try {
535
+ revoked = await client.revokeAttestation({ id: attestationId });
536
+ }
537
+ catch (error) {
538
+ if ((0, shared_js_1.isNotFound)(error)) {
539
+ return (0, result_js_1.structuredResult)({
540
+ outcome: 'not_found',
541
+ attestationId,
542
+ note: NOTE_REVOKE_NOT_FOUND,
543
+ });
544
+ }
545
+ if (isAborted(error))
546
+ return interrupted('revoke');
547
+ throw error;
548
+ }
549
+ // The revoke has landed: nothing after it may turn the answer into an error.
550
+ const deadlineAt = startedAt + shared_js_1.WRITE_READ_DEADLINE_MS;
551
+ const subdomain = await (0, shared_js_1.subdomainBy)(subdomainRead, deadlineAt);
552
+ return (0, result_js_1.structuredResult)({
553
+ outcome: 'revoked',
554
+ attestation: (0, shared_js_1.projectAttestation)(revoked),
555
+ ...(await revokeEffect(client, revoked, subdomain, deadlineAt)),
556
+ });
557
+ },
558
+ }),
559
+ ];
560
+ //# sourceMappingURL=attestations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attestations.js","sourceRoot":"","sources":["../../../../src/server/tools/compliance/attestations.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,yEAAqF;AAErF,gEAA8D;AAC9D,4EAAqE;AACrE,4CAAgD;AAChD,0CAA+F;AAC/F,+CAA4D;AAC5D,6CAIsB;AACtB,2CAeqB;AAErB;;;GAGG;AAEH,MAAM,YAAY,GAChB,6FAA6F;IAC7F,qEAAqE,CAAC;AACxE,MAAM,mBAAmB,GACvB,+FAA+F;IAC/F,6DAA6D,CAAC;AAChE,MAAM,oBAAoB,GACxB,2FAA2F;IAC3F,6FAA6F;IAC7F,0BAA0B,CAAC;AAC7B,MAAM,YAAY,GAChB,6FAA6F;IAC7F,6CAA6C,CAAC;AAEhD,MAAM,0BAA0B,GAC9B,8FAA8F;IAC9F,sCAAsC,CAAC;AACzC,MAAM,qBAAqB,GACzB,GAAG,0BAA0B,6DAA6D;IAC1F,uBAAuB,CAAC;AAC1B,MAAM,qBAAqB,GACzB,GAAG,0BAA0B,kEAAkE;IAC/F,kCAAkC,CAAC;AACrC,MAAM,YAAY,GAChB,wFAAwF;IACxF,2EAA2E,CAAC;AAE9E,SAAS,cAAc,CAAC,SAAgC,EAAE,MAAc;IACtE,OAAO,IAAA,2BAAe,EACpB,mBAAmB,SAAS,oBAAoB,MAAM,uBAAuB;QAC3E,4EAA4E,CAC/E,CAAC;AAC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,EAAE;QAChD,gBAAgB,EAAE,8BAAkB;QACpC,YAAY,EAAE,4BAA4B;QAC1C,OAAO,EAAE,KAAK,EAAE,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,EAAE;YAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC7B,MAAM,aAAa,GAAG,IAAA,yBAAa,EAAC,MAAM,CAAC,CAAC;YAC5C,IAAI,OAAoB,CAAC;YACzB,IAAI,CAAC;gBACH,OAAO,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;YAClE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,IAAA,sBAAU,EAAC,KAAK,CAAC,EAAE,CAAC;oBACtB,OAAO,IAAA,4BAAgB,EAAC;wBACtB,OAAO,EAAE,WAAW;wBACpB,aAAa;wBACb,IAAI,EAAE,qBAAqB;qBAC5B,CAAC,CAAC;gBACL,CAAC;gBACD,IAAI,SAAS,CAAC,KAAK,CAAC;oBAAE,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;gBACnD,MAAM,KAAK,CAAC;YACd,CAAC;YACD,6EAA6E;YAC7E,MAAM,UAAU,GAAG,SAAS,GAAG,kCAAsB,CAAC;YACtD,MAAM,SAAS,GAAG,MAAM,IAAA,uBAAW,EAAC,aAAa,EAAE,UAAU,CAAC,CAAC;YAC/D,OAAO,IAAA,4BAAgB,EAAC;gBACtB,OAAO,EAAE,SAAS;gBAClB,WAAW,EAAE,IAAA,8BAAkB,EAAC,OAAO,CAAC;gBACxC,GAAG,CAAC,MAAM,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;aAChE,CAAC,CAAC;QACL,CAAC;KACF,CAAC;CACH,CAAC"}
@@ -0,0 +1,46 @@
1
+ import type { Attestation, ControlEffectiveness, ControlState, ControlStatus, ControlTest } from '../../../types/jupiterone.js';
2
+ import { type ToolDefinition } from '../types.js';
3
+ /** Units an `org_unit_not_found` lists per searched namespace, to offer by name. */
4
+ export declare const ORG_UNIT_SUGGESTIONS = 10;
5
+ export declare const STATUS_EXPLANATIONS: readonly ["not_live", "failing_test", "failing_expired_attestation", "undetermined", "passing_by_tests", "passing_by_attestation", "no_tests", "no_datapoints"];
6
+ export type StatusExplanation = (typeof STATUS_EXPLANATIONS)[number];
7
+ /**
8
+ * What each explanation means for the answer, sent with the value: the description used to carry
9
+ * this table, 700 characters past the point where Claude Code cuts descriptions, and a tester
10
+ * reading `passing_by_tests` on a no-data pass reported the control as met (2026-10-14).
11
+ */
12
+ export declare const STATUS_MEANING: Record<StatusExplanation, string>;
13
+ type TestVerdict = Pick<ControlTest, 'status' | 'deleted'>;
14
+ type AttestationVerdict = Pick<Attestation, 'state'>;
15
+ export interface ControlStatusFacts {
16
+ state: ControlState | null;
17
+ status: ControlStatus | null;
18
+ effectiveStatus: ControlEffectiveness | null;
19
+ hasValidAttestation: boolean | null;
20
+ tests: TestVerdict[];
21
+ attestations: AttestationVerdict[] | 'unavailable';
22
+ }
23
+ /** Why a control has the status it has, as one of STATUS_EXPLANATIONS. */
24
+ export declare function explainControlStatus(facts: ControlStatusFacts): StatusExplanation;
25
+ export type Blocker = {
26
+ type: 'failing_test';
27
+ id: string;
28
+ name: string;
29
+ } | {
30
+ type: 'expired_attestation';
31
+ id: string;
32
+ subject: string;
33
+ expiresOnIso: string | null;
34
+ } | {
35
+ type: 'not_live';
36
+ id: string;
37
+ state: string | null;
38
+ };
39
+ /**
40
+ * Everything that fails a control by CCM's rules: each test that fails and is not deleted, and each
41
+ * expired attestation (the API's EXPIRED state is `revoked != true AND expiresOn <= now`).
42
+ */
43
+ export declare function failureCauses(tests: ControlTest[], attestations: Attestation[]): Blocker[];
44
+ export declare const controlTools: ToolDefinition[];
45
+ export {};
46
+ //# sourceMappingURL=controls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controls.d.ts","sourceRoot":"","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