@onlyflows/servicenow-mcp 2.2.0 → 2.2.1

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 (102) hide show
  1. package/CHANGELOG.md +119 -1
  2. package/README.md +77 -4
  3. package/dist/atf-policy.d.ts +1 -1
  4. package/dist/atf-policy.d.ts.map +1 -1
  5. package/dist/atf-policy.js +2 -0
  6. package/dist/atf-policy.js.map +1 -1
  7. package/dist/credential-tables.d.ts +32 -0
  8. package/dist/credential-tables.d.ts.map +1 -0
  9. package/dist/credential-tables.js +58 -0
  10. package/dist/credential-tables.js.map +1 -0
  11. package/dist/encoded-query-policy.d.ts.map +1 -1
  12. package/dist/encoded-query-policy.js +8 -1
  13. package/dist/encoded-query-policy.js.map +1 -1
  14. package/dist/execution-context.d.ts +14 -0
  15. package/dist/execution-context.d.ts.map +1 -1
  16. package/dist/execution-context.js +8 -0
  17. package/dist/execution-context.js.map +1 -1
  18. package/dist/field-policy.d.ts +34 -1
  19. package/dist/field-policy.d.ts.map +1 -1
  20. package/dist/field-policy.js +308 -25
  21. package/dist/field-policy.js.map +1 -1
  22. package/dist/hidden-values.d.ts +225 -0
  23. package/dist/hidden-values.d.ts.map +1 -0
  24. package/dist/hidden-values.js +748 -0
  25. package/dist/hidden-values.js.map +1 -0
  26. package/dist/http-entrypoint.d.ts.map +1 -1
  27. package/dist/http-entrypoint.js +7 -0
  28. package/dist/http-entrypoint.js.map +1 -1
  29. package/dist/index.js +7 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/metadata-cache.d.ts +38 -0
  32. package/dist/metadata-cache.d.ts.map +1 -1
  33. package/dist/metadata-cache.js +90 -3
  34. package/dist/metadata-cache.js.map +1 -1
  35. package/dist/policy-card.d.ts +16 -1
  36. package/dist/policy-card.d.ts.map +1 -1
  37. package/dist/policy-card.js +13 -2
  38. package/dist/policy-card.js.map +1 -1
  39. package/dist/profile-manager.d.ts +12 -0
  40. package/dist/profile-manager.d.ts.map +1 -1
  41. package/dist/profile-manager.js +23 -1
  42. package/dist/profile-manager.js.map +1 -1
  43. package/dist/setup.d.ts.map +1 -1
  44. package/dist/setup.js +5 -1
  45. package/dist/setup.js.map +1 -1
  46. package/dist/structured-query.d.ts.map +1 -1
  47. package/dist/structured-query.js +6 -1
  48. package/dist/structured-query.js.map +1 -1
  49. package/dist/table-policy.d.ts +31 -0
  50. package/dist/table-policy.d.ts.map +1 -1
  51. package/dist/table-policy.js +81 -9
  52. package/dist/table-policy.js.map +1 -1
  53. package/dist/tool-error.d.ts +17 -1
  54. package/dist/tool-error.d.ts.map +1 -1
  55. package/dist/tool-error.js +40 -1
  56. package/dist/tool-error.js.map +1 -1
  57. package/dist/tool-table-access.js +3 -3
  58. package/dist/tool-table-access.js.map +1 -1
  59. package/dist/tools/aggregate.js +2 -2
  60. package/dist/tools/aggregate.js.map +1 -1
  61. package/dist/tools/all-fields-cap.d.ts.map +1 -1
  62. package/dist/tools/all-fields-cap.js +29 -7
  63. package/dist/tools/all-fields-cap.js.map +1 -1
  64. package/dist/tools/atf-author-module.d.ts +1 -7
  65. package/dist/tools/atf-author-module.d.ts.map +1 -1
  66. package/dist/tools/atf-author-module.js +7 -3
  67. package/dist/tools/atf-author-module.js.map +1 -1
  68. package/dist/tools/atf-contracts.d.ts +2 -2
  69. package/dist/tools/atf-step-catalog.d.ts +13 -8
  70. package/dist/tools/atf-step-catalog.d.ts.map +1 -1
  71. package/dist/tools/atf-step-catalog.js +169 -5
  72. package/dist/tools/atf-step-catalog.js.map +1 -1
  73. package/dist/tools/batch.d.ts.map +1 -1
  74. package/dist/tools/batch.js +25 -7
  75. package/dist/tools/batch.js.map +1 -1
  76. package/dist/tools/flow-view-policy.d.ts +3 -3
  77. package/dist/tools/flow-view-policy.d.ts.map +1 -1
  78. package/dist/tools/flow-view-policy.js +5 -4
  79. package/dist/tools/flow-view-policy.js.map +1 -1
  80. package/dist/tools/index.d.ts.map +1 -1
  81. package/dist/tools/index.js +76 -13
  82. package/dist/tools/index.js.map +1 -1
  83. package/dist/tools/profile.d.ts.map +1 -1
  84. package/dist/tools/profile.js +1 -0
  85. package/dist/tools/profile.js.map +1 -1
  86. package/dist/tools/query-module.d.ts.map +1 -1
  87. package/dist/tools/query-module.js +26 -5
  88. package/dist/tools/query-module.js.map +1 -1
  89. package/dist/tools/record-write-shared.d.ts.map +1 -1
  90. package/dist/tools/record-write-shared.js +4 -3
  91. package/dist/tools/record-write-shared.js.map +1 -1
  92. package/dist/tools/result-envelope.d.ts +30 -30
  93. package/dist/unknown-filter-fields.d.ts +52 -0
  94. package/dist/unknown-filter-fields.d.ts.map +1 -0
  95. package/dist/unknown-filter-fields.js +87 -0
  96. package/dist/unknown-filter-fields.js.map +1 -0
  97. package/dist/version.d.ts +1 -1
  98. package/dist/version.js +1 -1
  99. package/docs/PRODUCTION-SECURITY.md +64 -0
  100. package/package.json +3 -3
  101. package/server.json +2 -2
  102. package/tools/inspector/package-lock.json +6 -6
@@ -19,8 +19,8 @@ export declare const resultPaginationSchema: z.ZodUnion<readonly [z.ZodObject<{
19
19
  }, z.core.$strict>]>;
20
20
  export declare const resultMetadataSchema: z.ZodObject<{
21
21
  kind: z.ZodEnum<{
22
- collection: "collection";
23
22
  operation: "operation";
23
+ collection: "collection";
24
24
  single: "single";
25
25
  }>;
26
26
  record_count: z.ZodNumber;
@@ -53,8 +53,8 @@ export declare function withStructuredResultEnvelope<TSchema extends z.ZodType>(
53
53
  data: TSchema;
54
54
  metadata: z.ZodObject<{
55
55
  kind: z.ZodEnum<{
56
- collection: "collection";
57
56
  operation: "operation";
57
+ collection: "collection";
58
58
  single: "single";
59
59
  }>;
60
60
  record_count: z.ZodNumber;
@@ -214,9 +214,9 @@ declare const productionDataSchemas: Readonly<{
214
214
  }, z.core.$strict>;
215
215
  sn_atf_run: z.ZodObject<{
216
216
  outcome: z.ZodEnum<{
217
+ unavailable: "unavailable";
217
218
  running: "running";
218
219
  completed: "completed";
219
- unavailable: "unavailable";
220
220
  }>;
221
221
  progress_id: z.ZodOptional<z.ZodString>;
222
222
  result_id: z.ZodOptional<z.ZodString>;
@@ -314,9 +314,9 @@ declare const productionDataSchemas: Readonly<{
314
314
  }, z.core.$strict>>;
315
315
  execution: z.ZodOptional<z.ZodObject<{
316
316
  outcome: z.ZodEnum<{
317
+ unavailable: "unavailable";
317
318
  running: "running";
318
319
  completed: "completed";
319
- unavailable: "unavailable";
320
320
  }>;
321
321
  progress_id: z.ZodOptional<z.ZodString>;
322
322
  result_id: z.ZodOptional<z.ZodString>;
@@ -846,8 +846,8 @@ export declare const productionToolOutputSchemas: Readonly<{
846
846
  }, z.core.$strict>;
847
847
  metadata: z.ZodObject<{
848
848
  kind: z.ZodEnum<{
849
- collection: "collection";
850
849
  operation: "operation";
850
+ collection: "collection";
851
851
  single: "single";
852
852
  }>;
853
853
  record_count: z.ZodNumber;
@@ -888,8 +888,8 @@ export declare const productionToolOutputSchemas: Readonly<{
888
888
  }, z.core.$strict>;
889
889
  metadata: z.ZodObject<{
890
890
  kind: z.ZodEnum<{
891
- collection: "collection";
892
891
  operation: "operation";
892
+ collection: "collection";
893
893
  single: "single";
894
894
  }>;
895
895
  record_count: z.ZodNumber;
@@ -932,8 +932,8 @@ export declare const productionToolOutputSchemas: Readonly<{
932
932
  }, z.core.$strict>;
933
933
  metadata: z.ZodObject<{
934
934
  kind: z.ZodEnum<{
935
- collection: "collection";
936
935
  operation: "operation";
936
+ collection: "collection";
937
937
  single: "single";
938
938
  }>;
939
939
  record_count: z.ZodNumber;
@@ -974,8 +974,8 @@ export declare const productionToolOutputSchemas: Readonly<{
974
974
  }, z.core.$strict>;
975
975
  metadata: z.ZodObject<{
976
976
  kind: z.ZodEnum<{
977
- collection: "collection";
978
977
  operation: "operation";
978
+ collection: "collection";
979
979
  single: "single";
980
980
  }>;
981
981
  record_count: z.ZodNumber;
@@ -1020,8 +1020,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1020
1020
  }, z.core.$strict>;
1021
1021
  metadata: z.ZodObject<{
1022
1022
  kind: z.ZodEnum<{
1023
- collection: "collection";
1024
1023
  operation: "operation";
1024
+ collection: "collection";
1025
1025
  single: "single";
1026
1026
  }>;
1027
1027
  record_count: z.ZodNumber;
@@ -1066,8 +1066,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1066
1066
  }, z.core.$strict>;
1067
1067
  metadata: z.ZodObject<{
1068
1068
  kind: z.ZodEnum<{
1069
- collection: "collection";
1070
1069
  operation: "operation";
1070
+ collection: "collection";
1071
1071
  single: "single";
1072
1072
  }>;
1073
1073
  record_count: z.ZodNumber;
@@ -1109,8 +1109,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1109
1109
  }, z.core.$strict>;
1110
1110
  metadata: z.ZodObject<{
1111
1111
  kind: z.ZodEnum<{
1112
- collection: "collection";
1113
1112
  operation: "operation";
1113
+ collection: "collection";
1114
1114
  single: "single";
1115
1115
  }>;
1116
1116
  record_count: z.ZodNumber;
@@ -1165,8 +1165,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1165
1165
  }, z.core.$strict>;
1166
1166
  metadata: z.ZodObject<{
1167
1167
  kind: z.ZodEnum<{
1168
- collection: "collection";
1169
1168
  operation: "operation";
1169
+ collection: "collection";
1170
1170
  single: "single";
1171
1171
  }>;
1172
1172
  record_count: z.ZodNumber;
@@ -1206,8 +1206,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1206
1206
  }, z.core.$strict>;
1207
1207
  metadata: z.ZodObject<{
1208
1208
  kind: z.ZodEnum<{
1209
- collection: "collection";
1210
1209
  operation: "operation";
1210
+ collection: "collection";
1211
1211
  single: "single";
1212
1212
  }>;
1213
1213
  record_count: z.ZodNumber;
@@ -1247,8 +1247,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1247
1247
  }, z.core.$strict>;
1248
1248
  metadata: z.ZodObject<{
1249
1249
  kind: z.ZodEnum<{
1250
- collection: "collection";
1251
1250
  operation: "operation";
1251
+ collection: "collection";
1252
1252
  single: "single";
1253
1253
  }>;
1254
1254
  record_count: z.ZodNumber;
@@ -1288,8 +1288,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1288
1288
  }, z.core.$strict>;
1289
1289
  metadata: z.ZodObject<{
1290
1290
  kind: z.ZodEnum<{
1291
- collection: "collection";
1292
1291
  operation: "operation";
1292
+ collection: "collection";
1293
1293
  single: "single";
1294
1294
  }>;
1295
1295
  record_count: z.ZodNumber;
@@ -1334,8 +1334,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1334
1334
  }, z.core.$strict>;
1335
1335
  metadata: z.ZodObject<{
1336
1336
  kind: z.ZodEnum<{
1337
- collection: "collection";
1338
1337
  operation: "operation";
1338
+ collection: "collection";
1339
1339
  single: "single";
1340
1340
  }>;
1341
1341
  record_count: z.ZodNumber;
@@ -1378,8 +1378,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1378
1378
  }, z.core.$strict>;
1379
1379
  metadata: z.ZodObject<{
1380
1380
  kind: z.ZodEnum<{
1381
- collection: "collection";
1382
1381
  operation: "operation";
1382
+ collection: "collection";
1383
1383
  single: "single";
1384
1384
  }>;
1385
1385
  record_count: z.ZodNumber;
@@ -1426,8 +1426,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1426
1426
  }, z.core.$strict>;
1427
1427
  metadata: z.ZodObject<{
1428
1428
  kind: z.ZodEnum<{
1429
- collection: "collection";
1430
1429
  operation: "operation";
1430
+ collection: "collection";
1431
1431
  single: "single";
1432
1432
  }>;
1433
1433
  record_count: z.ZodNumber;
@@ -1468,8 +1468,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1468
1468
  }, z.core.$strict>;
1469
1469
  metadata: z.ZodObject<{
1470
1470
  kind: z.ZodEnum<{
1471
- collection: "collection";
1472
1471
  operation: "operation";
1472
+ collection: "collection";
1473
1473
  single: "single";
1474
1474
  }>;
1475
1475
  record_count: z.ZodNumber;
@@ -1510,8 +1510,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1510
1510
  }, z.core.$strict>;
1511
1511
  metadata: z.ZodObject<{
1512
1512
  kind: z.ZodEnum<{
1513
- collection: "collection";
1514
1513
  operation: "operation";
1514
+ collection: "collection";
1515
1515
  single: "single";
1516
1516
  }>;
1517
1517
  record_count: z.ZodNumber;
@@ -1558,8 +1558,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1558
1558
  }, z.core.$strict>;
1559
1559
  metadata: z.ZodObject<{
1560
1560
  kind: z.ZodEnum<{
1561
- collection: "collection";
1562
1561
  operation: "operation";
1562
+ collection: "collection";
1563
1563
  single: "single";
1564
1564
  }>;
1565
1565
  record_count: z.ZodNumber;
@@ -1596,9 +1596,9 @@ export declare const productionToolOutputSchemas: Readonly<{
1596
1596
  sn_atf_run: z.ZodObject<Omit<{
1597
1597
  data: z.ZodObject<{
1598
1598
  outcome: z.ZodEnum<{
1599
+ unavailable: "unavailable";
1599
1600
  running: "running";
1600
1601
  completed: "completed";
1601
- unavailable: "unavailable";
1602
1602
  }>;
1603
1603
  progress_id: z.ZodOptional<z.ZodString>;
1604
1604
  result_id: z.ZodOptional<z.ZodString>;
@@ -1674,8 +1674,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1674
1674
  }, z.core.$strict>;
1675
1675
  metadata: z.ZodObject<{
1676
1676
  kind: z.ZodEnum<{
1677
- collection: "collection";
1678
1677
  operation: "operation";
1678
+ collection: "collection";
1679
1679
  single: "single";
1680
1680
  }>;
1681
1681
  record_count: z.ZodNumber;
@@ -1734,9 +1734,9 @@ export declare const productionToolOutputSchemas: Readonly<{
1734
1734
  }, z.core.$strict>>;
1735
1735
  execution: z.ZodOptional<z.ZodObject<{
1736
1736
  outcome: z.ZodEnum<{
1737
+ unavailable: "unavailable";
1737
1738
  running: "running";
1738
1739
  completed: "completed";
1739
- unavailable: "unavailable";
1740
1740
  }>;
1741
1741
  progress_id: z.ZodOptional<z.ZodString>;
1742
1742
  result_id: z.ZodOptional<z.ZodString>;
@@ -1862,8 +1862,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1862
1862
  }, z.core.$strict>;
1863
1863
  metadata: z.ZodObject<{
1864
1864
  kind: z.ZodEnum<{
1865
- collection: "collection";
1866
1865
  operation: "operation";
1866
+ collection: "collection";
1867
1867
  single: "single";
1868
1868
  }>;
1869
1869
  record_count: z.ZodNumber;
@@ -1916,8 +1916,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1916
1916
  }, z.core.$strict>;
1917
1917
  metadata: z.ZodObject<{
1918
1918
  kind: z.ZodEnum<{
1919
- collection: "collection";
1920
1919
  operation: "operation";
1920
+ collection: "collection";
1921
1921
  single: "single";
1922
1922
  }>;
1923
1923
  record_count: z.ZodNumber;
@@ -1982,8 +1982,8 @@ export declare const productionToolOutputSchemas: Readonly<{
1982
1982
  }, z.core.$strict>;
1983
1983
  metadata: z.ZodObject<{
1984
1984
  kind: z.ZodEnum<{
1985
- collection: "collection";
1986
1985
  operation: "operation";
1986
+ collection: "collection";
1987
1987
  single: "single";
1988
1988
  }>;
1989
1989
  record_count: z.ZodNumber;
@@ -2352,8 +2352,8 @@ export declare const productionToolOutputSchemas: Readonly<{
2352
2352
  }, z.core.$strict>;
2353
2353
  metadata: z.ZodObject<{
2354
2354
  kind: z.ZodEnum<{
2355
- collection: "collection";
2356
2355
  operation: "operation";
2356
+ collection: "collection";
2357
2357
  single: "single";
2358
2358
  }>;
2359
2359
  record_count: z.ZodNumber;
@@ -2393,8 +2393,8 @@ export declare const productionToolOutputSchemas: Readonly<{
2393
2393
  }, z.core.$strict>;
2394
2394
  metadata: z.ZodObject<{
2395
2395
  kind: z.ZodEnum<{
2396
- collection: "collection";
2397
2396
  operation: "operation";
2397
+ collection: "collection";
2398
2398
  single: "single";
2399
2399
  }>;
2400
2400
  record_count: z.ZodNumber;
@@ -2442,8 +2442,8 @@ export declare const productionToolOutputSchemas: Readonly<{
2442
2442
  }, z.core.$strict>;
2443
2443
  metadata: z.ZodObject<{
2444
2444
  kind: z.ZodEnum<{
2445
- collection: "collection";
2446
2445
  operation: "operation";
2446
+ collection: "collection";
2447
2447
  single: "single";
2448
2448
  }>;
2449
2449
  record_count: z.ZodNumber;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Refuse a filter or order on a field the table does not have.
3
+ *
4
+ * ServiceNow drops a condition on a column it does not know, unless the
5
+ * instance sets glide.invalid_query.returns_no_rows (off by default and not a
6
+ * setting this server can rely on). A misspelt field therefore does not match
7
+ * nothing: the rest of the query runs and unrelated rows come back.
8
+ *
9
+ * The check costs no request. A column named in sysparm_fields that the table
10
+ * does not have, or that the integration user may not read, is left out of
11
+ * every row, so the filter's own fields are asked for on the read that is
12
+ * made anyway and the rows that come back show which of them exist.
13
+ *
14
+ * - A field counts as present when any returned row carries the key, not only
15
+ * the first: a field-level rule that depends on the record can hide a real
16
+ * column on some rows, never on a column that is absent from the table.
17
+ * - An existing column with no value is still returned (as an empty string),
18
+ * so an empty field is never mistaken for a missing one.
19
+ * - With no rows there is nothing to check. That is harmless: a read returns
20
+ * nothing, and a step that acts on the rows has nothing to act on.
21
+ * - Raw encoded queries are not parsed. They are only accepted through an
22
+ * owner-written policy rule that pins the query and its field names, so
23
+ * there is no caller-typed field to verify.
24
+ *
25
+ * The extra columns are asked for only when the caller's own field list does
26
+ * not already hold them, and callers drop them from the result.
27
+ */
28
+ export interface FilterFieldEcho {
29
+ /** The sysparm_fields value to send; undefined keeps "every column". */
30
+ readonly sysparmFields: string | undefined;
31
+ /** The fields whose presence in the returned rows is checked. */
32
+ readonly probe: readonly string[];
33
+ /** True when the request asks for columns the caller did not select. */
34
+ readonly extended: boolean;
35
+ }
36
+ /**
37
+ * The sysparm_fields to send, and the fields to look for in the rows.
38
+ *
39
+ * `requested` is the caller's own selection, comma separated, or undefined
40
+ * when the read asks for every column. A read for every column already
41
+ * returns each column of the table, so nothing is added; a dot-walked name is
42
+ * not returned by such a read, so it cannot be checked there and is skipped.
43
+ */
44
+ export declare function echoFilterFields(requested: string | undefined, referenced: readonly string[]): FilterFieldEcho;
45
+ /**
46
+ * The first probed field that no returned row carries, or undefined when
47
+ * every field is present or there is no row to look at.
48
+ */
49
+ export declare function firstMissingFilterField(rows: unknown, probe: readonly string[]): string | undefined;
50
+ /** True when the request was extended for the check and then came back too large. */
51
+ export declare function isFilterEchoTooLarge(error: unknown, echo: FilterFieldEcho): boolean;
52
+ //# sourceMappingURL=unknown-filter-fields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unknown-filter-fields.d.ts","sourceRoot":"","sources":["../src/unknown-filter-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAOH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3C,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,eAAe,CAkBjB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,GAAG,SAAS,CAcpB;AAED,qFAAqF;AACrF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAEnF"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ /**
3
+ * Refuse a filter or order on a field the table does not have.
4
+ *
5
+ * ServiceNow drops a condition on a column it does not know, unless the
6
+ * instance sets glide.invalid_query.returns_no_rows (off by default and not a
7
+ * setting this server can rely on). A misspelt field therefore does not match
8
+ * nothing: the rest of the query runs and unrelated rows come back.
9
+ *
10
+ * The check costs no request. A column named in sysparm_fields that the table
11
+ * does not have, or that the integration user may not read, is left out of
12
+ * every row, so the filter's own fields are asked for on the read that is
13
+ * made anyway and the rows that come back show which of them exist.
14
+ *
15
+ * - A field counts as present when any returned row carries the key, not only
16
+ * the first: a field-level rule that depends on the record can hide a real
17
+ * column on some rows, never on a column that is absent from the table.
18
+ * - An existing column with no value is still returned (as an empty string),
19
+ * so an empty field is never mistaken for a missing one.
20
+ * - With no rows there is nothing to check. That is harmless: a read returns
21
+ * nothing, and a step that acts on the rows has nothing to act on.
22
+ * - Raw encoded queries are not parsed. They are only accepted through an
23
+ * owner-written policy rule that pins the query and its field names, so
24
+ * there is no caller-typed field to verify.
25
+ *
26
+ * The extra columns are asked for only when the caller's own field list does
27
+ * not already hold them, and callers drop them from the result.
28
+ */
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.echoFilterFields = echoFilterFields;
31
+ exports.firstMissingFilterField = firstMissingFilterField;
32
+ exports.isFilterEchoTooLarge = isFilterEchoTooLarge;
33
+ const client_js_1 = require("./client.js");
34
+ const tool_error_js_1 = require("./tool-error.js");
35
+ const CANONICAL_FIELD = tool_error_js_1.CANONICAL_FIELD_PATTERN;
36
+ /**
37
+ * The sysparm_fields to send, and the fields to look for in the rows.
38
+ *
39
+ * `requested` is the caller's own selection, comma separated, or undefined
40
+ * when the read asks for every column. A read for every column already
41
+ * returns each column of the table, so nothing is added; a dot-walked name is
42
+ * not returned by such a read, so it cannot be checked there and is skipped.
43
+ */
44
+ function echoFilterFields(requested, referenced) {
45
+ const names = [...new Set(referenced)].filter((field) => CANONICAL_FIELD.test(field));
46
+ if (requested === undefined) {
47
+ return {
48
+ sysparmFields: undefined,
49
+ probe: Object.freeze(names.filter((field) => !field.includes("."))),
50
+ extended: false,
51
+ };
52
+ }
53
+ const listed = new Set(requested.split(","));
54
+ const extra = names.filter((field) => !listed.has(field));
55
+ return {
56
+ sysparmFields: extra.length === 0 ? requested : `${requested},${extra.join(",")}`,
57
+ probe: Object.freeze(names),
58
+ extended: extra.length > 0,
59
+ };
60
+ }
61
+ /**
62
+ * The first probed field that no returned row carries, or undefined when
63
+ * every field is present or there is no row to look at.
64
+ */
65
+ function firstMissingFilterField(rows, probe) {
66
+ if (!Array.isArray(rows) || rows.length === 0 || probe.length === 0) {
67
+ return undefined;
68
+ }
69
+ const pending = new Set(probe);
70
+ for (const row of rows) {
71
+ if (typeof row !== "object" || row === null)
72
+ continue;
73
+ for (const field of pending) {
74
+ if (Object.hasOwn(row, field))
75
+ pending.delete(field);
76
+ }
77
+ if (pending.size === 0)
78
+ return undefined;
79
+ }
80
+ // Set order is insertion order, so this is the first field in probe order.
81
+ return pending.values().next().value;
82
+ }
83
+ /** True when the request was extended for the check and then came back too large. */
84
+ function isFilterEchoTooLarge(error, echo) {
85
+ return echo.extended && (0, client_js_1.isServiceNowResponseTooLarge)(error);
86
+ }
87
+ //# sourceMappingURL=unknown-filter-fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unknown-filter-fields.js","sourceRoot":"","sources":["../src/unknown-filter-fields.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;AAwBH,4CAqBC;AAMD,0DAiBC;AAGD,oDAEC;AAvED,2CAA2D;AAC3D,mDAA0D;AAE1D,MAAM,eAAe,GAAG,uCAAuB,CAAC;AAWhD;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAC9B,SAA6B,EAC7B,UAA6B;IAE7B,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CACtD,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAC5B,CAAC;IACF,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO;YACL,aAAa,EAAE,SAAS;YACxB,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YACnE,QAAQ,EAAE,KAAK;SAChB,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1D,OAAO;QACL,aAAa,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACjF,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,QAAQ,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC;KAC3B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CACrC,IAAa,EACb,KAAwB;IAExB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;YAAE,SAAS;QACtD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC;gBAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvD,CAAC;QACD,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;IAC3C,CAAC;IACD,2EAA2E;IAC3E,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;AACvC,CAAC;AAED,qFAAqF;AACrF,SAAgB,oBAAoB,CAAC,KAAc,EAAE,IAAqB;IACxE,OAAO,IAAI,CAAC,QAAQ,IAAI,IAAA,wCAA4B,EAAC,KAAK,CAAC,CAAC;AAC9D,CAAC"}
package/dist/version.d.ts CHANGED
@@ -6,5 +6,5 @@
6
6
  *
7
7
  * @module version
8
8
  */
9
- export declare const VERSION = "2.2.0";
9
+ export declare const VERSION = "2.2.1";
10
10
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -9,5 +9,5 @@
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.VERSION = void 0;
12
- exports.VERSION = "2.2.0";
12
+ exports.VERSION = "2.2.1";
13
13
  //# sourceMappingURL=version.js.map
@@ -447,6 +447,35 @@ client's ordinary retry on 502, 503, 504 and connection errors, so a gateway
447
447
  failure after the instance applied such a write can append the entry twice.
448
448
  Where a duplicate would matter, withhold such fields with field policy.
449
449
 
450
+ ## Password-type fields
451
+
452
+ Read and write tools hide a field by its dictionary type as well as by its
453
+ name. A field of internal type `password`, `password2`, `masked` or
454
+ `encrypted_text` never leaves the server and is never asked for, whatever it
455
+ is called (`ssh_passphrase`, `key`, `answer`): it is refused when named,
456
+ dropped from `fields=all`, detailed, default and `"*"` reads and from write
457
+ echoes, and refused as a filter, order, aggregate, group-by or write field.
458
+ The whole field goes in every display shape, display values included. A
459
+ `sys_properties` row shows `value` only when its
460
+ `type` is a known non-secret type, and `value` is never a filter, order or
461
+ group field there.
462
+
463
+ - **Grant the integration user read access to `sys_dictionary` and
464
+ `sys_db_object`** (and `sys_db_view_table` for database views). The types
465
+ come from one `sys_dictionary` read per credential, kept for an hour (or the
466
+ profile's metadata-cache TTL, if shorter), and concurrent calls share one
467
+ read; no table grant is needed. While
468
+ ServiceNow refuses or fails that read, every field-policy tool refuses with a
469
+ message naming this access.
470
+ - **`"fieldTypes": { "dictionary": "not_required" }`** on a profile (or
471
+ `SN_FIELD_TYPES_DICTIONARY=not_required` for the environment profile) lets
472
+ those calls run with name-only hiding instead. The server warns at startup
473
+ and each time it falls back, and the policy card flags the profile. Approve it only
474
+ where the granted tables hold no password-type field.
475
+ - A value whose secrecy is set per record, rather than by the field's
476
+ dictionary type, is not recognised by type. Where a granted table holds such
477
+ values, narrow the field with field policy.
478
+
450
479
  ## Flow views
451
480
 
452
481
  `sn_flow_view` is read-only. It reads 15 tables through the Table API and
@@ -472,6 +501,41 @@ flow read creates a Workflow Studio history record. Approve it on these terms:
472
501
  [docs/FLOW-VIEW.md](FLOW-VIEW.md) lists every table, required field and
473
502
  field-policy switch.
474
503
 
504
+ ## Tables a `"*"` grant does not cover
505
+
506
+ `sys_audit`, `sys_journal_field`, `sys_history_line`, `sys_audit_delete`,
507
+ `sys_attachment_doc` and `sys_email` hold old and new field values, comments and
508
+ work notes, deleted records, attachment content and email bodies. A `"*"` entry
509
+ in `readTables` or `writeTables` never covers them: approve one only when the
510
+ profile names it, bound to the tools that need it.
511
+
512
+ - A database view built over one of them, or a custom table that extends one, has
513
+ a different table name, so a `"*"` grant reaches it. Do not grant such a view or
514
+ table unless those rows are meant to be exposed, and review database views on
515
+ the instance before approving a `"*"` profile. A profile with an explicit table
516
+ list never reaches a view it does not name.
517
+ - Declare a view as a `view` target with every table it reads in
518
+ `relatedTables`. The profile then fails to load unless it also names each of
519
+ those tables, for a named-only table by name.
520
+ - A `"*"` write grant does not cover `sys_atf_step`, `sys_variable_value` or
521
+ `sys_element_mapping`, which hold what `sn_atf_author` checks when it adds a
522
+ step. Under `"*"` only
523
+ `sn_atf_author` writes them; the generic write tools need the table named for
524
+ write. Reads are unchanged.
525
+ - A `"*"` field-policy entry narrows these six once the profile names them, as it
526
+ does the ITSM tables; a value column is left out of a default read.
527
+ - `sn_atf_author` checks each ATF step that names a table: `record_query`,
528
+ `record_validation`, `field_values_validation` and `open_existing_record` need a
529
+ read grant on it, `open_new_form` and `set_field_values` a write grant, and a
530
+ named-only table must be named for either. Step conditions may use only the
531
+ operators that compare a field with a literal, over fields the field policy
532
+ lets the profile read, and `record_query` and `record_validation` refuse
533
+ `enforce_security: false`. A condition value (and a `set_field_values` value) may refer to an
534
+ earlier step's output only by record id or sys_id, and the fields a `set_field_values` step
535
+ sets must be writable on its table. The impersonated user's ACLs still apply
536
+ on top. Suites authored in the instance are not checked by the server's table grants,
537
+ and `atf.execute` stays opt-in.
538
+
475
539
  ## Denied exposure patterns
476
540
 
477
541
  Do not approve a deployment that has any of these properties:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@onlyflows/servicenow-mcp",
3
3
  "mcpName": "io.github.onlyflowstech/servicenow-mcp",
4
- "version": "2.2.0",
4
+ "version": "2.2.1",
5
5
  "description": "Governed stdio ServiceNow MCP server for production: 24 tools with per-profile table and field policy, dry-run bulk changes, activity events, multi-instance profiles, CMDB traversal, ATF testing and read-only Flow Designer flow views.",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -69,13 +69,13 @@
69
69
  "node": ">=20"
70
70
  },
71
71
  "dependencies": {
72
- "@hono/node-server": "2.1.3",
72
+ "@hono/node-server": "2.1.7",
73
73
  "@modelcontextprotocol/sdk": "1.32.2",
74
74
  "parse5": "7.3.0",
75
75
  "zod": "4.6.7"
76
76
  },
77
77
  "overrides": {
78
- "@hono/node-server": "2.1.3"
78
+ "@hono/node-server": "2.1.7"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@eslint/js": "9.39.5",
package/server.json CHANGED
@@ -7,12 +7,12 @@
7
7
  "url": "https://github.com/onlyflowstech/servicenow-mcp",
8
8
  "source": "github"
9
9
  },
10
- "version": "2.2.0",
10
+ "version": "2.2.1",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "npm",
14
14
  "identifier": "@onlyflows/servicenow-mcp",
15
- "version": "2.2.0",
15
+ "version": "2.2.1",
16
16
  "runtimeHint": "npx",
17
17
  "transport": {
18
18
  "type": "stdio"
@@ -29,9 +29,9 @@
29
29
  }
30
30
  },
31
31
  "node_modules/@hono/node-server": {
32
- "version": "2.1.5",
33
- "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.5.tgz",
34
- "integrity": "sha512-MgP/I06GdvsilDspMk/qmRzpk8LOUStP6jFAbSRi40W09DhoyUn+Mj7eyKICPqeYKybOjVFLVIAQzvu1bfIa7Q==",
32
+ "version": "2.1.8",
33
+ "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-2.1.8.tgz",
34
+ "integrity": "sha512-jdf7FHh6A1lzjpHHQUgxsg2GeER2vMetnAOfeActzcoli6jamlK+NAwL6Dsr5Fl3BS3tYUQzCdtZjU8Qxv7bEA==",
35
35
  "license": "MIT",
36
36
  "engines": {
37
37
  "node": ">=20"
@@ -1935,9 +1935,9 @@
1935
1935
  }
1936
1936
  },
1937
1937
  "node_modules/hono": {
1938
- "version": "4.13.13",
1939
- "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.13.tgz",
1940
- "integrity": "sha512-CQ46U0ZkAGmbT/4UxdzzGJpacP2IeKgY4a5/tOI9AABbpOMfK739wfDXmv1usCk+3RkKj1hQy4/fjhiwa2xlrA==",
1938
+ "version": "4.13.18",
1939
+ "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.18.tgz",
1940
+ "integrity": "sha512-H9q/E1XizaWstJxUW881dmLxEj+t/TrGGnyxINkm4+sK0qUwsMtFdo2BWI9Vs3cIS19MU6b6iCijoUoEf4f3DA==",
1941
1941
  "license": "MIT",
1942
1942
  "engines": {
1943
1943
  "node": ">=16.9.0"