@onlyflows/servicenow-mcp 2.3.0-dev.3 → 2.3.0-dev.5

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 (173) hide show
  1. package/CHANGELOG.md +165 -0
  2. package/README.md +177 -29
  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/config.d.ts +1 -1
  8. package/dist/config.d.ts.map +1 -1
  9. package/dist/credential-tables.d.ts +32 -0
  10. package/dist/credential-tables.d.ts.map +1 -0
  11. package/dist/credential-tables.js +58 -0
  12. package/dist/credential-tables.js.map +1 -0
  13. package/dist/encoded-query-policy.d.ts.map +1 -1
  14. package/dist/encoded-query-policy.js +8 -1
  15. package/dist/encoded-query-policy.js.map +1 -1
  16. package/dist/execution-context.d.ts +14 -0
  17. package/dist/execution-context.d.ts.map +1 -1
  18. package/dist/execution-context.js +8 -0
  19. package/dist/execution-context.js.map +1 -1
  20. package/dist/field-policy.d.ts +34 -1
  21. package/dist/field-policy.d.ts.map +1 -1
  22. package/dist/field-policy.js +308 -25
  23. package/dist/field-policy.js.map +1 -1
  24. package/dist/hidden-values.d.ts +225 -0
  25. package/dist/hidden-values.d.ts.map +1 -0
  26. package/dist/hidden-values.js +748 -0
  27. package/dist/hidden-values.js.map +1 -0
  28. package/dist/http-entrypoint.d.ts.map +1 -1
  29. package/dist/http-entrypoint.js +7 -0
  30. package/dist/http-entrypoint.js.map +1 -1
  31. package/dist/index.js +7 -0
  32. package/dist/index.js.map +1 -1
  33. package/dist/metadata-cache.d.ts +38 -0
  34. package/dist/metadata-cache.d.ts.map +1 -1
  35. package/dist/metadata-cache.js +76 -3
  36. package/dist/metadata-cache.js.map +1 -1
  37. package/dist/policy-card.d.ts +16 -1
  38. package/dist/policy-card.d.ts.map +1 -1
  39. package/dist/policy-card.js +13 -2
  40. package/dist/policy-card.js.map +1 -1
  41. package/dist/profile-admin.d.ts +18 -0
  42. package/dist/profile-admin.d.ts.map +1 -1
  43. package/dist/profile-admin.js +26 -1
  44. package/dist/profile-admin.js.map +1 -1
  45. package/dist/profile-manager.d.ts +13 -1
  46. package/dist/profile-manager.d.ts.map +1 -1
  47. package/dist/profile-manager.js +23 -1
  48. package/dist/profile-manager.js.map +1 -1
  49. package/dist/setup.d.ts +4 -0
  50. package/dist/setup.d.ts.map +1 -1
  51. package/dist/setup.js +150 -66
  52. package/dist/setup.js.map +1 -1
  53. package/dist/structured-query.d.ts.map +1 -1
  54. package/dist/structured-query.js +6 -1
  55. package/dist/structured-query.js.map +1 -1
  56. package/dist/table-policy.d.ts +34 -1
  57. package/dist/table-policy.d.ts.map +1 -1
  58. package/dist/table-policy.js +95 -10
  59. package/dist/table-policy.js.map +1 -1
  60. package/dist/tool-error.d.ts +8 -1
  61. package/dist/tool-error.d.ts.map +1 -1
  62. package/dist/tool-error.js +23 -0
  63. package/dist/tool-error.js.map +1 -1
  64. package/dist/tool-table-access.d.ts.map +1 -1
  65. package/dist/tool-table-access.js +25 -6
  66. package/dist/tool-table-access.js.map +1 -1
  67. package/dist/tools/aggregate.js +2 -2
  68. package/dist/tools/aggregate.js.map +1 -1
  69. package/dist/tools/all-fields-cap.d.ts.map +1 -1
  70. package/dist/tools/all-fields-cap.js +29 -7
  71. package/dist/tools/all-fields-cap.js.map +1 -1
  72. package/dist/tools/atf-author-module.d.ts +1 -7
  73. package/dist/tools/atf-author-module.d.ts.map +1 -1
  74. package/dist/tools/atf-author-module.js +16 -7
  75. package/dist/tools/atf-author-module.js.map +1 -1
  76. package/dist/tools/atf-contracts.d.ts +69 -4
  77. package/dist/tools/atf-contracts.d.ts.map +1 -1
  78. package/dist/tools/atf-contracts.js +32 -2
  79. package/dist/tools/atf-contracts.js.map +1 -1
  80. package/dist/tools/atf-renderers.js +2 -1
  81. package/dist/tools/atf-renderers.js.map +1 -1
  82. package/dist/tools/atf-results-module.d.ts.map +1 -1
  83. package/dist/tools/atf-results-module.js +5 -3
  84. package/dist/tools/atf-results-module.js.map +1 -1
  85. package/dist/tools/atf-run-module.js +3 -2
  86. package/dist/tools/atf-run-module.js.map +1 -1
  87. package/dist/tools/atf-shared.d.ts +6 -0
  88. package/dist/tools/atf-shared.d.ts.map +1 -1
  89. package/dist/tools/atf-shared.js +49 -10
  90. package/dist/tools/atf-shared.js.map +1 -1
  91. package/dist/tools/atf-step-catalog.d.ts +13 -8
  92. package/dist/tools/atf-step-catalog.d.ts.map +1 -1
  93. package/dist/tools/atf-step-catalog.js +169 -5
  94. package/dist/tools/atf-step-catalog.js.map +1 -1
  95. package/dist/tools/batch.d.ts.map +1 -1
  96. package/dist/tools/batch.js +4 -2
  97. package/dist/tools/batch.js.map +1 -1
  98. package/dist/tools/flow-view-contracts.d.ts +57 -1
  99. package/dist/tools/flow-view-contracts.d.ts.map +1 -1
  100. package/dist/tools/flow-view-contracts.js +34 -2
  101. package/dist/tools/flow-view-contracts.js.map +1 -1
  102. package/dist/tools/flow-view-graph.d.ts +14 -0
  103. package/dist/tools/flow-view-graph.d.ts.map +1 -1
  104. package/dist/tools/flow-view-graph.js +43 -1
  105. package/dist/tools/flow-view-graph.js.map +1 -1
  106. package/dist/tools/flow-view-module.js +1 -1
  107. package/dist/tools/flow-view-module.js.map +1 -1
  108. package/dist/tools/flow-view-policy.d.ts +3 -3
  109. package/dist/tools/flow-view-policy.d.ts.map +1 -1
  110. package/dist/tools/flow-view-policy.js +5 -4
  111. package/dist/tools/flow-view-policy.js.map +1 -1
  112. package/dist/tools/flow-view-renderers.d.ts.map +1 -1
  113. package/dist/tools/flow-view-renderers.js +9 -21
  114. package/dist/tools/flow-view-renderers.js.map +1 -1
  115. package/dist/tools/index.d.ts.map +1 -1
  116. package/dist/tools/index.js +80 -13
  117. package/dist/tools/index.js.map +1 -1
  118. package/dist/tools/platform-view-contracts.d.ts +189 -0
  119. package/dist/tools/platform-view-contracts.d.ts.map +1 -0
  120. package/dist/tools/platform-view-contracts.js +353 -0
  121. package/dist/tools/platform-view-contracts.js.map +1 -0
  122. package/dist/tools/platform-view-evaluate.d.ts +11 -0
  123. package/dist/tools/platform-view-evaluate.d.ts.map +1 -0
  124. package/dist/tools/platform-view-evaluate.js +19 -0
  125. package/dist/tools/platform-view-evaluate.js.map +1 -0
  126. package/dist/tools/platform-view-module.d.ts +28 -0
  127. package/dist/tools/platform-view-module.d.ts.map +1 -0
  128. package/dist/tools/platform-view-module.js +111 -0
  129. package/dist/tools/platform-view-module.js.map +1 -0
  130. package/dist/tools/platform-view-scan.d.ts +57 -0
  131. package/dist/tools/platform-view-scan.d.ts.map +1 -0
  132. package/dist/tools/platform-view-scan.js +375 -0
  133. package/dist/tools/platform-view-scan.js.map +1 -0
  134. package/dist/tools/platform-view-upgrades.d.ts +152 -0
  135. package/dist/tools/platform-view-upgrades.d.ts.map +1 -0
  136. package/dist/tools/platform-view-upgrades.js +545 -0
  137. package/dist/tools/platform-view-upgrades.js.map +1 -0
  138. package/dist/tools/profile.d.ts.map +1 -1
  139. package/dist/tools/profile.js +1 -0
  140. package/dist/tools/profile.js.map +1 -1
  141. package/dist/tools/query-module.js +1 -1
  142. package/dist/tools/query-module.js.map +1 -1
  143. package/dist/tools/record-write-shared.d.ts.map +1 -1
  144. package/dist/tools/record-write-shared.js +4 -3
  145. package/dist/tools/record-write-shared.js.map +1 -1
  146. package/dist/tools/result-envelope.d.ts +116 -36
  147. package/dist/tools/result-envelope.d.ts.map +1 -1
  148. package/dist/tools/result-envelope.js +38 -3
  149. package/dist/tools/result-envelope.js.map +1 -1
  150. package/dist/tools/syslog-cursor.d.ts +61 -0
  151. package/dist/tools/syslog-cursor.d.ts.map +1 -0
  152. package/dist/tools/syslog-cursor.js +146 -0
  153. package/dist/tools/syslog-cursor.js.map +1 -0
  154. package/dist/tools/syslog.d.ts +2 -0
  155. package/dist/tools/syslog.d.ts.map +1 -1
  156. package/dist/tools/syslog.js +126 -2
  157. package/dist/tools/syslog.js.map +1 -1
  158. package/dist/update-set-eval/secret-patterns.d.ts +75 -0
  159. package/dist/update-set-eval/secret-patterns.d.ts.map +1 -0
  160. package/dist/update-set-eval/secret-patterns.js +570 -0
  161. package/dist/update-set-eval/secret-patterns.js.map +1 -0
  162. package/dist/update-set-eval/xml-reader.d.ts +117 -0
  163. package/dist/update-set-eval/xml-reader.d.ts.map +1 -0
  164. package/dist/update-set-eval/xml-reader.js +561 -0
  165. package/dist/update-set-eval/xml-reader.js.map +1 -0
  166. package/dist/version.d.ts +1 -1
  167. package/dist/version.js +1 -1
  168. package/docs/CLIENT-SETUP.md +8 -6
  169. package/docs/FLOW-VIEW.md +14 -5
  170. package/docs/PRODUCTION-SECURITY.md +63 -0
  171. package/docs/PROFILE-CREDENTIALS.md +10 -4
  172. package/package.json +1 -1
  173. package/server.json +2 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,171 @@ All notable changes to this project are documented here.
5
5
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.3.0-dev.5] — 2026-11-16
9
+
10
+ ### Added
11
+
12
+ - **Read tools now hide `password`/`password2`-typed fields by dictionary type,
13
+ not only by name.** A field whose internal type is `password`, `password2`,
14
+ `masked` or `encrypted_text` is refused when named, left out of `fields=all`,
15
+ detailed and default reads, `"*"` responses and write echoes, refused as a
16
+ filter, order, aggregate, group-by or ATF step-condition field, and refused
17
+ as a write key, whatever it is called. A `sys_properties` row shows `value` only when its
18
+ `type` is a known non-secret type. The types come from one cached
19
+ `sys_dictionary` read per credential. While they cannot be read, field-policy
20
+ tools refuse with a message naming the access needed, unless the profile sets
21
+ `"fieldTypes": { "dictionary": "not_required" }`, which falls back to
22
+ name-only hiding and is flagged on the policy card. `tools/list` is unchanged.
23
+
24
+ - **`sn_syslog` can tail the system log.** `tail: true` returns the newest
25
+ entries, oldest first, with a `cursor`; each later call with `after_cursor`
26
+ returns only the entries created after it, oldest first, with a new `cursor`,
27
+ so a caller no longer re-reads a window and removes duplicates by hand. The
28
+ cursor holds the creation second and the row's `sys_id`, so entries that share
29
+ a second are neither skipped nor repeated, and it is bound to the `level`,
30
+ `source` and `message` filters it was issued for. A malformed, oversized or
31
+ altered cursor, or one used with other filters, is refused with a fixed message
32
+ that never repeats it. When more entries are waiting than `limit` allows (or the
33
+ response is cut to fit its size limit), the call returns `has_more: true` and a
34
+ cursor at the last entry returned. Tail reads never use the metadata cache,
35
+ carry no total count and no `next_offset`, and follow the same table and field
36
+ policy as any `sn_syslog` read; a call without `tail` or `after_cursor` is
37
+ unchanged. A cursor older than the longest `since` window (one year) is refused,
38
+ so a tail cannot reach further back than a plain read. The two new inputs and the `cursor` output add about 340 characters
39
+ to the `sn_syslog` entry in `tools/list`.
40
+
41
+ ### Changed
42
+
43
+ - **`sn_atf_author` checks the table, conditions and ACL setting of ATF steps
44
+ when it adds them.** A `record_query`, `record_validation`,
45
+ `field_values_validation` or `open_existing_record` step needs a read grant on
46
+ the table it names, and an `open_new_form` or `set_field_values` step a write
47
+ grant, with the same refusal as any table access (a named-only table such as
48
+ `sys_audit` must be named). The conditions of `record_query`,
49
+ `record_validation` and `field_values_validation` are checked against the
50
+ table's field policy: a field the profile may not read, a dot-walk (`a.b`), a
51
+ condition that is only a pasted step output, and a term the check does not
52
+ recognise are refused, and only the operators that compare a field with a
53
+ literal are allowed (`=`, `!=`, `<`, `<=`, `>`, `>=`, `LIKE`, `NOT LIKE`,
54
+ `STARTSWITH`, `ENDSWITH`, `IN`, `NOT IN`, `ISEMPTY`, `ISNOTEMPTY`, `BETWEEN`),
55
+ so an operator that takes a second field, such as `SAMEAS` or `GT_FIELD`, is
56
+ refused. `enforce_security: false` is refused on `record_query` and
57
+ `record_validation` with a fixed message (leave it out, or pass `true`; it
58
+ stays `true` by default). A refused step refuses the whole call, before any
59
+ write. A condition value, and a `set_field_values` value, may refer to an earlier
60
+ step's output only by record id or sys_id (`record_id`, `first_record`,
61
+ `sys_id`, `user`), and the fields a
62
+ `set_field_values` step sets must be writable on its table, as for `sn_update`.
63
+ The impersonated user's ACLs still apply on top; suites authored in the
64
+ instance are not checked by the server's table grants, and `atf.execute` stays
65
+ opt-in. The README and `docs/PRODUCTION-SECURITY.md` now also say that a
66
+ database view or extension table over one of the six named-only tables is not
67
+ covered by the name list.
68
+ - **A `"*"` write grant no longer covers `sys_atf_step`, `sys_variable_value`
69
+ and `sys_element_mapping` for the generic write tools.** These tables hold the
70
+ step types, input values and pill mappings that `sn_atf_author` checks when it
71
+ adds a step. Under `"*"`,
72
+ `sn_atf_author` still writes them, but `sn_create`, `sn_update`, `sn_delete`,
73
+ `sn_batch` and attachment uploads reach them only when the profile names the
74
+ table for write; the refusal names the table and the grant that allows it
75
+ (`servicenow-mcp-setup grant --profile <profile> --write sys_atf_step --tools
76
+ sn_update`). Reads are unchanged, and no other table's access changes.
77
+ `sys_variable_value` and `sys_element_mapping` also hold other variables'
78
+ values and mappings (catalog variables, for example), so a profile that writes
79
+ those with the generic tools must now name them. The policy card lists the
80
+ three tables as outside the wildcard row's write access.
81
+ - **`sys_audit` and `sys_journal_field` are no longer covered by a `"*"` table
82
+ grant; name them to read them.** A profile whose `readTables` (or
83
+ `writeTables`) holds `"*"` now reaches them only when it names them. Their rows
84
+ hold the old and new values of other tables' fields, comments and work notes,
85
+ so they are now granted by name only. With `"*"` alone, `sn_query`, `sn_get`,
86
+ `sn_aggregate`, `sn_schema`, `sn_batch` and the other tools refuse them, and
87
+ the message names the table and the grant that allows it:
88
+ `servicenow-mcp-setup grant --profile <profile> --read sys_audit --tools
89
+ sn_query`. A profile that already names a table is unaffected, and a `"*"`
90
+ grant beside the name still covers everything else. A read that names no
91
+ `fields` returns `sys_id`, `tablename`, `documentkey`, `fieldname`, `user` and
92
+ `sys_created_on` for `sys_audit`, and `sys_id`, `name`, `element_id`, `element`,
93
+ `sys_created_by` and `sys_created_on` for `sys_journal_field`; ask for
94
+ `oldvalue`, `newvalue` or `value` by name. No other table's access changes. The
95
+ policy card and the setup wizard's wildcard note say the same.
96
+ - **Four more tables are granted by name only, and a `"*"` field entry now
97
+ narrows all six.** `sys_history_line`, `sys_audit_delete`, `sys_attachment_doc`
98
+ and `sys_email` join `sys_audit` and `sys_journal_field`: a `"*"` table grant no
99
+ longer covers them, for read or write, and a profile reaches one only when
100
+ `tableAccess` names it. Their rows hold history built from audit, deleted
101
+ records, attachment content and email bodies. The refusal names the table and
102
+ the grant that allows it. A read that names no `fields` leaves out the value
103
+ columns (`old`, `new`, `old_value` and `new_value`; `payload`; `data`; `body`,
104
+ `body_text`, `subject`, `recipients`, `copied`, `blind_copied`, `reply_to`,
105
+ `headers` and `error_string`), so ask for them by name. For field policy
106
+ the six belong to the profile, as the ITSM tables do: once a profile names one,
107
+ its `"*"` field entry narrows it, and an entry for the table itself narrows or
108
+ widens it. The 24 system tables, which a `"*"` field entry never narrows, are
109
+ unchanged. `sn_attach` is unaffected: it uses the Attachment API and never
110
+ reads `sys_attachment_doc`.
111
+ A `relatedTables` list that reaches one of the six under a `"*"` grant still
112
+ stops the profile loading, and the message now names the table and says it
113
+ must be granted by name. `sn_profile` reports these tables with the class
114
+ `named_only`.
115
+
116
+ ### Fixed
117
+
118
+ - **`sn_atf_results` with action `get` no longer fails with an internal error on
119
+ a completed suite result whose rows have empty references.** Some result rows
120
+ carry an empty suite reference, and their test results an empty test
121
+ reference. The tool failed on the first one as soon as it had read the result
122
+ (and would have failed on the second), so every completed result of that kind
123
+ failed, while a running one that names its suite worked. Such a result now
124
+ returns normally: the run, its tests and its failures, without a `suite_id`,
125
+ with each test that has no reference identified by its test result's own id,
126
+ and with warnings that say so and that the result has no history or comparison
127
+ (the cache is kept per suite and per test). `run.suiteId` is therefore optional
128
+ in the output schema. A row of the wrong shape (a reference that is not a
129
+ sys_id, an unknown status) now ends the call with an upstream error instead of
130
+ an internal one.
131
+
132
+ - **A client that reads only `structuredContent` no longer loses what the text
133
+ carried.** Some MCP clients give the model the structured result and drop the
134
+ text, and a few tools kept information only in the text. They now carry it as
135
+ typed fields as well, and the text is unchanged. `sn_flow_view` adds `diagram`
136
+ (the Mermaid source, when `format` asks for one), `ref` (the flow record as
137
+ table and sys_id) and `warning_details` (each warning code with its
138
+ explanation). `sn_atf_run` and `sn_atf_results` add `result_ref` (the suite
139
+ result record) and `advice` (how to read a failed step in full).
140
+ `sn_atf_author` adds `advice` after an insert whose outcome could not be
141
+ confirmed; the records it created were already listed with their table and
142
+ sys_id. Record links stay out of `structuredContent`: it names a record by
143
+ table and sys_id, and the instance address stays in the text, so no result
144
+ gains an address. The diagram counts toward `max_response_bytes` and is the first
145
+ thing given up: if the graph and the diagram do not fit together the diagram
146
+ keeps only a note, and its source is never cut short. The published output
147
+ schemas grow by about 1.6 KB in total (1.3%), and the model-visible part of
148
+ `tools/list` by 18 characters.
149
+
150
+ ## [2.3.0-dev.4] — 2026-11-15
151
+
152
+ ### Changed
153
+
154
+ - **The setup wizard defaults to OAuth client credentials.** The authentication
155
+ prompt now lists `oauth` first and offers it by default, then `apikey`, then
156
+ `basic`, which is marked legacy because ServiceNow is retiring Basic Auth for
157
+ REST calls. Choosing OAuth prints a short note on what the instance needs (an
158
+ Application Registry entry with a client ID and secret, the client credentials
159
+ grant, and an OAuth Application User with only the roles it needs, not an
160
+ administrator) and where the README explains it. When a Basic credential gets a
161
+ 401, the wizard now asks what next: retry with the same settings, switch to
162
+ OAuth (keeping the profile name and instance, and discarding the Basic
163
+ credential), or stop; its 401 advice points at that menu, while `doctor --live`
164
+ tells the operator to re-run setup and choose oauth. Nothing else changes for scripts:
165
+ `servicenow-mcp-profile create` without `--auth-type` still creates a Basic
166
+ profile, now with a deprecation notice shown only in an interactive terminal,
167
+ never in captured output (a future release may require the flag), and
168
+ `SN_AUTH_TYPE` still defaults to `basic`. Saved
169
+ profiles are never changed, and a saved profile with no `authType` is still
170
+ read as Basic. The README quick start, the profile and client setup guides and
171
+ their examples now show OAuth first.
172
+
8
173
  ## [2.3.0-dev.3] — 2026-11-15
9
174
 
10
175
  ### Added
package/README.md CHANGED
@@ -65,8 +65,11 @@ and **Codex** automatically; **Claude Desktop**, **Cursor**, **VS Code** and
65
65
  2. **Set up a connection:** `servicenow-mcp-setup`. It asks for your instance
66
66
  and credential, checks them against the instance, asks which tables to
67
67
  allow, and registers Claude Code and Codex if their CLIs are installed.
68
- Choose **OAuth** when the wizard asks for the authentication type; Basic
69
- is the wizard's default but is [deprecated by ServiceNow](#basic-default-deprecated-by-servicenow).
68
+ The wizard's authentication type defaults to **OAuth client credentials**,
69
+ so you can press Enter at that prompt. You need an Application Registry
70
+ entry on the instance first: see [OAuth 2.0](#oauth-20-recommended). Basic
71
+ is still offered, marked legacy, because ServiceNow is
72
+ [retiring it for REST calls](#basic-legacy-deprecated-by-servicenow).
70
73
  3. **Open your client and ask.** There is no server to start; the client
71
74
  launches `servicenow-mcp` itself.
72
75
 
@@ -114,19 +117,32 @@ instance. Press Ctrl+C at any point to stop; nothing will be saved.
114
117
  Profile name [dev]: dev
115
118
  ServiceNow instance (for example dev12345.service-now.com): dev12345.service-now.com
116
119
  Authentication:
117
- 1) basic (default)
118
- 2) oauth
119
- 3) apikey
120
+ 1) oauth (default) - client credentials, recommended
121
+ 2) apikey - inbound API key
122
+ 3) basic - legacy, not recommended: ServiceNow is retiring it
123
+ Choice [1]: 1
124
+
125
+ OAuth client credentials need these on the instance:
126
+ - an Application Registry entry (System OAuth > Application Registry)
127
+ with a client ID and client secret
128
+ - the client credentials grant enabled for it
129
+ - an OAuth Application User: the integration user this server acts as,
130
+ with only the roles it needs, not an administrator
131
+ Steps: README, section Authentication > OAuth 2.0.
132
+
133
+ OAuth grant type:
134
+ 1) client_credentials (default)
135
+ 2) password
120
136
  Choice [1]: 1
121
137
  How should the credential be stored?:
122
138
  1) encrypted (default)
123
139
  2) reference
124
140
  Choice [1]: 1
125
- ServiceNow username: integration.user
141
+ OAuth client id (not a secret): <your-client-id>
126
142
 
127
143
  Enter each secret now. Input is hidden — nothing you type from here
128
144
  is displayed.
129
- credential:
145
+ clientSecret:
130
146
 
131
147
  Verifying against the instance...
132
148
  ok https://dev12345.service-now.com accepted the credential.
@@ -161,7 +177,7 @@ ok node: v22.11.0
161
177
  ok server command: servicenow-mcp resolves on PATH; clients spawn it over stdio
162
178
  ok config directory: ~/.servicenow-mcp (0700)
163
179
  ok profile dev: instance: https://dev12345.service-now.com
164
- ok profile dev: credential: basic credential resolves from its encrypted source
180
+ ok profile dev: credential: oauth clientSecret resolves from its encrypted source
165
181
  ok profile dev: table access: 1 read, 1 write, 1 target(s)
166
182
 
167
183
  All checks passed.
@@ -191,11 +207,23 @@ servicenow-mcp-setup doctor --profile dev
191
207
  global install, and `servicenow-mcp setup` is an alias for
192
208
  `servicenow-mcp-setup`.
193
209
 
210
+ If you choose Basic and the instance answers 401, the wizard explains the
211
+ Basic Auth restriction and asks what next: `retry` with the same settings,
212
+ switch to `oauth` (it discards the Basic credential and asks the OAuth
213
+ questions, keeping the profile name and instance), or `stop`. Nothing is
214
+ saved until a credential verifies.
215
+
194
216
  ### Scripted setup
195
217
 
196
218
  Pass any flag, or run without a terminal, and the wizard steps aside for the
197
219
  original non-interactive behavior — so CI and provisioning scripts are
198
- unaffected. `--non-interactive` forces it explicitly:
220
+ unaffected. `--non-interactive` forces it explicitly. Only the interactive
221
+ wizard defaults to OAuth. `servicenow-mcp-profile create` has no default you
222
+ should rely on: pass `--auth-type oauth` (recommended) or `--auth-type basic`.
223
+ Left out, it still creates a Basic profile, as it always has, so existing
224
+ scripts keep working, and it prints a deprecation notice only when standard
225
+ error is an interactive terminal, so output a script captures is unchanged. A
226
+ future release may require the flag.
199
227
 
200
228
  ```bash
201
229
  servicenow-mcp-setup --non-interactive --clients none --json
@@ -334,7 +362,8 @@ MCP_OWNER_ID=local-owner \
334
362
  MCP_CLIENT_ID=local-client \
335
363
  SN_PROFILE_NAME=dev \
336
364
  SN_INSTANCE=https://yourinstance.service-now.com \
337
- SN_USER=your_user \
365
+ SN_AUTH_TYPE=oauth \
366
+ SN_CLIENT_ID=your-non-secret-client-id \
338
367
  SN_ALLOWED_READ_TABLES=incident,problem,change_request \
339
368
  SN_ALLOWED_WRITE_TABLES=incident,change_request \
340
369
  SN_TABLE_ACCESS_TARGETS='[{"table":"incident","kind":"canonical","tools":["sn_query","sn_get","sn_create","sn_update","sn_incident_add_comment","sn_incident_add_work_note","sn_delete","sn_batch"],"closureComplete":true,"relatedTables":["incident"]},{"table":"problem","kind":"canonical","tools":["sn_query","sn_get"],"closureComplete":true,"relatedTables":["problem"]},{"table":"change_request","kind":"canonical","tools":["sn_query","sn_get"],"closureComplete":true,"relatedTables":["change_request"]}]' \
@@ -379,8 +408,8 @@ without putting them in argv, and it writes the file with the right ownership
379
408
  and mode:
380
409
 
381
410
  ```bash
382
- servicenow-mcp-profile create --name dev --instance https://mydev.service-now.com --auth-type basic --username admin --source reference --provider env
383
- servicenow-mcp-profile create --name prod --instance https://myprod.service-now.com --auth-type basic --username api.user --source reference --provider env
411
+ servicenow-mcp-profile create --name dev --instance https://mydev.service-now.com --auth-type oauth --client-id <dev-client-id> --source reference --provider env
412
+ servicenow-mcp-profile create --name prod --instance https://myprod.service-now.com --auth-type oauth --client-id <prod-client-id> --source reference --provider env
384
413
 
385
414
  servicenow-mcp-setup grant --profile dev --read incident,problem --write incident
386
415
  servicenow-mcp-setup grant --profile prod --read incident
@@ -395,8 +424,9 @@ The resulting `~/.servicenow-mcp/config.json` looks like this. Note
395
424
  "profiles": {
396
425
  "dev": {
397
426
  "instance": "https://mydev.service-now.com",
398
- "username": "admin",
399
- "credential": { "type": "secret_ref", "provider": "env", "reference": "SN_PASSWORD_DEV" },
427
+ "authType": "oauth",
428
+ "clientId": "your-dev-client-id",
429
+ "clientSecret": { "type": "secret_ref", "provider": "env", "reference": "SN_CLIENT_SECRET_DEV" },
400
430
  "description": "Development instance",
401
431
  "tableAccess": {
402
432
  "readTables": ["incident", "problem"],
@@ -428,7 +458,7 @@ The resulting `~/.servicenow-mcp/config.json` looks like this. Note
428
458
  ```
429
459
 
430
460
  Have the approved supervisor, orchestrator, keychain, or secret manager provide
431
- the values referenced by `SN_PASSWORD_DEV` and `SN_PASSWORD_PROD` in the
461
+ the values referenced by `SN_CLIENT_SECRET_DEV` and `SN_CLIENT_SECRET_PROD` in the
432
462
  environment the server is spawned with, or in `~/.servicenow-mcp/server.env`,
433
463
  which the server falls back to. Do not type either value into a shell command,
434
464
  command argument, dotenv file, or command history.
@@ -492,8 +522,10 @@ administrative write; the MCP boundary never consults it.
492
522
 
493
523
  If no config file exists, canonical `SN_*` connection values are exposed only
494
524
  through an explicit `SN_PROFILE_NAME` mapping. For example, set
495
- `SN_PROFILE_NAME=dev` with `SN_INSTANCE`, `SN_USER`, and `SN_PASSWORD`, then
496
- call tools with `profile: "dev"`. Without `SN_PROFILE_NAME`, bare connection
525
+ `SN_PROFILE_NAME=dev` with `SN_INSTANCE`, `SN_AUTH_TYPE=oauth`, `SN_CLIENT_ID`
526
+ and `SN_CLIENT_SECRET`, then call tools with `profile: "dev"`. Without
527
+ `SN_AUTH_TYPE` the environment profile is Basic (`SN_USER` and `SN_PASSWORD`),
528
+ as it has always been; set `SN_AUTH_TYPE` explicitly. Without `SN_PROFILE_NAME`, bare connection
497
529
  variables create no profile and cannot route a request. Secret values remain
498
530
  runtime-only environment references and are never persisted as plaintext.
499
531
 
@@ -501,13 +533,19 @@ runtime-only environment references and are never persisted as plaintext.
501
533
 
502
534
  ## Authentication
503
535
 
504
- Three ServiceNow auth types are available per profile, selected with `authType` (default: `basic`). Profile configuration is managed out of band by the service operator. This is the only authentication involved: the transport is stdio, so there is no endpoint in front of the server to protect.
536
+ Three ServiceNow auth types are available per profile, selected with `authType`. The setup wizard and every example here use OAuth client credentials. A saved profile that has no `authType` is read as Basic, because that is what such a profile has always meant; saved profiles are never rewritten. Profile configuration is managed out of band by the service operator. This is the only authentication involved: the transport is stdio, so there is no endpoint in front of the server to protect.
505
537
 
506
538
  > **Heads up:** ServiceNow's [inbound Basic Auth restriction program](https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB3096078) is phasing out basic auth for API requests — instances can start hard-rejecting it at any time (exemptions: Web-Service-Access-Only accounts or the `snc_basic_auth_api_access` role). **OAuth is the recommended auth type.** The server prints a startup warning for basic-auth profiles.
507
539
 
508
540
  ### OAuth 2.0 (recommended)
509
541
 
510
- `client_credentials` grant (default) — create an OAuth API endpoint client in ServiceNow (**System OAuth → Application Registry**) and reference the secret via `env:` indirection:
542
+ `client_credentials` grant (default). On the instance you need three things:
543
+
544
+ 1. An **Application Registry** entry, an OAuth API endpoint for external clients (**System OAuth → Application Registry**), which gives you a client ID and a client secret.
545
+ 2. The **client credentials grant enabled** for it: on current releases the system property `glide.oauth.inbound.client.credential.grant_type.enabled` must be `true`.
546
+ 3. An **OAuth Application User** set on that entry: the integration user the server acts as. Give it the least roles that do the job, not an administrator.
547
+
548
+ Then create the profile with the wizard (`servicenow-mcp-setup`, press Enter at the authentication prompt) or `servicenow-mcp-profile create --auth-type oauth --client-id <client-id>`, or reference the secret via `env:` indirection:
511
549
 
512
550
  ```json
513
551
  {
@@ -553,7 +591,9 @@ For instances using Inbound Authentication Profiles with API keys. The header na
553
591
  }
554
592
  ```
555
593
 
556
- ### Basic (default, deprecated by ServiceNow)
594
+ ### Basic (legacy, deprecated by ServiceNow)
595
+
596
+ Basic is no longer the wizard's default. Use it only for an instance that still accepts it.
557
597
 
558
598
  ```json
559
599
  {
@@ -626,7 +666,8 @@ export SN_ALLOWED_WRITE_TABLES="incident,change_request"
626
666
  export SN_TABLE_ACCESS_TARGETS='[{"table":"incident","kind":"canonical","tools":["sn_query","sn_get","sn_create","sn_update","sn_incident_add_comment","sn_incident_add_work_note","sn_delete","sn_batch"],"closureComplete":true,"relatedTables":["incident"]},{"table":"problem","kind":"canonical","tools":["sn_query","sn_get"],"closureComplete":true,"relatedTables":["problem"]},{"table":"change_request","kind":"canonical","tools":["sn_query","sn_get"],"closureComplete":true,"relatedTables":["change_request"]}]'
627
667
  export SN_PROFILE_NAME="dev"
628
668
  export SN_INSTANCE="https://yourinstance.service-now.com"
629
- export SN_USER="your_username"
669
+ export SN_AUTH_TYPE="oauth"
670
+ export SN_CLIENT_ID="your-non-secret-oauth-client-id"
630
671
  npm run build
631
672
  npm start
632
673
  ```
@@ -715,10 +756,42 @@ in this section is needed to use this server.
715
756
  |------|-------------|
716
757
  | `sn_relationships` | CMDB CI graph traversal — upstream/downstream/both, configurable depth |
717
758
  | `sn_attach` | List attachments, return downloads as inline base64, and upload inline base64 content; never touches a host filesystem path |
718
- | `sn_syslog` | Query system logs with severity/source/time filters |
759
+ | `sn_syslog` | Query system logs with severity/source/time filters, newest first. `tail: true` starts a tail (the newest entries, oldest first, plus a `cursor`); each later call with `after_cursor` returns only the entries after it, oldest first, plus a new `cursor` ([Tailing the system log](#tailing-the-system-log)) |
719
760
  | `sn_codesearch` | Search business rules, script includes, client scripts, etc., with a snippet around each match ([Code search](#code-search)). Part of the default read grant, so a plain read grant on a code table allows it |
720
761
  | `sn_discover` | Discover tables, scoped apps, store apps, plugins |
721
762
 
763
+ #### Tailing the system log
764
+
765
+ `sn_syslog` can follow the log without re-reading it. The first call sends
766
+ `tail: true` and gets the newest `limit` entries (inside the `since` window),
767
+ oldest first, and a `cursor`. Each later call sends that cursor as
768
+ `after_cursor` and gets only the entries created after it, oldest first, and a
769
+ new `cursor`; poll no faster than every few seconds.
770
+
771
+ - **No skips, no repeats.** Many log rows share one `sys_created_on` second, so
772
+ the cursor holds the second and the row's `sys_id`, and a call returns the
773
+ rows after that pair. It is an opaque token: pass it back as given.
774
+ - **`has_more`.** If more than `limit` entries are waiting, the call returns
775
+ `limit` of them with `has_more: true` and a cursor at the last one; call again
776
+ with it. A response cut to fit the byte budget does the same, and the cursor
777
+ always names the last entry actually returned. Tail pages carry no `total` and
778
+ no `next_offset`, and `offset` cannot be combined with a tail.
779
+ - **Same filters on every call.** The cursor is bound to the `level`, `source`
780
+ and `message` it was issued for. A call that changes them is refused (so is a
781
+ malformed, oversized or altered cursor) with a fixed message that does not
782
+ repeat the cursor. `since` applies to the first call only, but a cursor older
783
+ than the longest `since` (525,600 minutes, one year) is refused with a fixed
784
+ message: start a new tail. With nothing to return, the call gives the same
785
+ position back, so keep polling with it. If the first call finds no entries in
786
+ its window it returns no cursor; call it again.
787
+ - **Reads go straight to the instance**, never through the metadata cache, and
788
+ use the same table and field policy as an ordinary `sn_syslog` read. A tail
789
+ also reads `sys_id` and `sys_created_on` to place the cursor, so a field policy
790
+ that withholds either refuses it.
791
+ - **Limits.** Order is by creation second, then `sys_id`. A row the instance
792
+ stores late with a creation time at or before the cursor's second is not seen
793
+ by a tail that has already moved past it.
794
+
722
795
  ### Testing & Automation
723
796
 
724
797
  | Tool | Description |
@@ -1218,8 +1291,8 @@ and must be valid ServiceNow identifiers.
1218
1291
 
1219
1292
  | Variable | Required | Default | Description |
1220
1293
  |----------|----------|---------|-------------|
1221
- | `SN_ALLOWED_READ_TABLES` | ❌ | deny all | Tables permitted for read operations on the explicit `SN_PROFILE_NAME` environment profile only. Use `*` to allow every readable table. |
1222
- | `SN_ALLOWED_WRITE_TABLES` | ❌ | deny all | Tables permitted for create, update, incident journal append, delete, upload, and confirmed batch operations on the explicit `SN_PROFILE_NAME` environment profile only. Use `*` to allow every writable table. Write permission never implies read permission. |
1294
+ | `SN_ALLOWED_READ_TABLES` | ❌ | deny all | Tables permitted for read operations on the explicit `SN_PROFILE_NAME` environment profile only. Use `*` to allow every readable table except `sys_audit`, `sys_journal_field`, `sys_history_line`, `sys_audit_delete`, `sys_attachment_doc` and `sys_email`, which are covered only when named (see [Field policy](#field-policy)). |
1295
+ | `SN_ALLOWED_WRITE_TABLES` | ❌ | deny all | Tables permitted for create, update, incident journal append, delete, upload, and confirmed batch operations on the explicit `SN_PROFILE_NAME` environment profile only. Use `*` to allow every writable table except the same six named-only tables. Write permission never implies read permission. |
1223
1296
  | `SN_TABLE_ACCESS_TARGETS` | Required for exact allowlisted caller-addressable tables; optional with `*` | `[]` | Trusted JSON classification with `table`, exact permitted `tools`, `kind` (`canonical`, `alias`, `view`, or `extension`), literal `closureComplete: true`, and `relatedTables`: the target itself plus any backing or parent tables the operator declares. The loader checks that every related table has the target's operation permission; it does not derive the list from the instance, and the list grants no access. A self-only list is valid for a `canonical` target; `alias`, `view` and `extension` targets must name at least one backing table, and a view or alias should declare every table it reads, because it returns data from each of them whatever the list says. With `*`, omitted target entries use the wildcard operation grant; explicit target entries can still narrow tools and check their related tables. |
1224
1297
  | `SN_FIELD_POLICY_DEFINITIONS` | ❌ | no narrowing | Field policy for the explicit `SN_PROFILE_NAME` environment profile only, like the `SN_ALLOWED_*` variables. **If `~/.servicenow-mcp/config.json` exists, setting this variable stops startup**; give those profiles their own `fieldPolicy` instead. The value is trusted JSON, at most 65,536 characters: either a table map keyed by table name or `*`, the same shape as a profile's `fieldPolicy`, or an object holding the profile keys (`fieldPolicy`, or `readableTableFields` / `writableTableFields`), not both. Each field set is a list of exact field names or `"*"`; `["*"]` means `"*"` in that exact form only, and patterns such as `"u_*"` are rejected. A malformed value stops startup with the key named. Sensitive field names are always denied. See [Field policy](#field-policy). |
1225
1298
  | `SN_ENCODED_QUERY_READ_POLICY` | ❌ | deny all | Trusted JSON object containing bounded `rules` for an exact `sn_query`/table pair. Each rule requires `maxLength`, `maxTerms`, readable `fields`, supported `operators`, `maxLimit`, `maxOffset`, and `maxResponseBytes`. No rule can authorize a write or another tool. |
@@ -1246,8 +1319,9 @@ startup configuration. File-backed profile example:
1246
1319
  "profiles": {
1247
1320
  "dev": {
1248
1321
  "instance": "https://dev.service-now.com",
1249
- "username": "integration.user",
1250
- "credential": "env:SN_PASSWORD",
1322
+ "authType": "oauth",
1323
+ "clientId": "your-oauth-client-id",
1324
+ "clientSecret": "env:SN_CLIENT_SECRET",
1251
1325
  "tableAccess": {
1252
1326
  "readTables": ["incident", "sys_dictionary"],
1253
1327
  "writeTables": ["incident"],
@@ -1269,7 +1343,23 @@ startup configuration. File-backed profile example:
1269
1343
  `run`/`run-suite` return migration guidance; use `sn_atf_run` with an explicit
1270
1344
  `atf.execute` profile grant. Typed ATF steps use the authenticated native form
1271
1345
  to save and verify inputs and output references without ACL changes or an
1272
- installed application. See [ATF workflow](docs/ATF-WORKFLOW.md).
1346
+ installed application. `sn_atf_author` checks each step that names a table
1347
+ against the profile's grants: a `record_query`, `record_validation`,
1348
+ `field_values_validation` or `open_existing_record` step needs a read grant on its
1349
+ table, and an `open_new_form` or `set_field_values` step a write grant (a
1350
+ named-only table must be named, for either). The conditions of the three steps
1351
+ that have them may use only the operators that compare a field with a literal
1352
+ (`=`, `!=`, `<`, `<=`, `>`, `>=`, `LIKE`, `NOT LIKE`, `STARTSWITH`, `ENDSWITH`,
1353
+ `IN`, `NOT IN`, `ISEMPTY`, `ISNOTEMPTY`, `BETWEEN`), name plain fields the field
1354
+ policy lets the profile read (no dot-walks), and may refer to an earlier step's
1355
+ output only by its record id or sys_id (`record_id`, `first_record`, `sys_id`
1356
+ or `user`), as may the values a `set_field_values` step sets; a refused term
1357
+ refuses the whole call. The fields a `set_field_values` step sets must be
1358
+ writable on its table under the profile's field policy, as for `sn_update`. `record_query` and `record_validation` also refuse
1359
+ `enforce_security: false`; leave it out and it stays `true`. The impersonated
1360
+ user's ACLs still apply on top of all this. Suites authored in the instance are
1361
+ not checked by the server's table grants, and `atf.execute` stays opt-in. See
1362
+ [ATF workflow](docs/ATF-WORKFLOW.md).
1273
1363
 
1274
1364
  #### Field policy
1275
1365
 
@@ -1279,6 +1369,13 @@ denies a table the profile grants. A profile with no field policy may read and
1279
1369
  write every field of a granted table, except that sensitive-looking names
1280
1370
  (`password`, `token`, `secret`, `api_key` and similar) are always denied, and
1281
1371
  the class and domain fields below must be listed before they can be written.
1372
+ Fields of type `password`, `password2`, `masked` or `encrypted_text` are denied
1373
+ the same way, whatever their name, and a `sys_properties` value shows only for
1374
+ a known non-secret `type`. The types come from a cached `sys_dictionary` read,
1375
+ so the integration user needs read access to `sys_dictionary` and
1376
+ `sys_db_object`; without it the tools refuse, unless the profile sets
1377
+ `"fieldTypes": { "dictionary": "not_required" }` to hide by name only (see
1378
+ [Production security](docs/PRODUCTION-SECURITY.md#password-type-fields)).
1282
1379
 
1283
1380
  State it on a profile in `~/.servicenow-mcp/config.json`, beside
1284
1381
  `tableAccess`, in one of two forms. A profile that states both fails to load.
@@ -1367,7 +1464,7 @@ The same policy in the list form:
1367
1464
  }
1368
1465
  ```
1369
1466
 
1370
- **Which tables a `"*"` entry reaches.** Tables fall into three groups:
1467
+ **Which tables a `"*"` entry reaches.** Tables fall into four groups:
1371
1468
 
1372
1469
  - **ITSM tables:** `incident`, `change_request`, `problem`, `sc_request`,
1373
1470
  `sc_req_item`, `sc_task`, `task`, `cmdb_ci`, `cmdb_ci_server`,
@@ -1381,6 +1478,9 @@ The same policy in the list form:
1381
1478
  `sys_atf_test_suite_test`, `sys_atf_test_result`, `sys_atf_step`,
1382
1479
  `sys_element_mapping`, `sys_variable_value`, `sys_atf_test_suite_result`,
1383
1480
  `sys_atf_test_result_step`, `sys_atf_agent`, `syslog`.
1481
+ - **The 6 named-only tables:** `sys_audit`, `sys_journal_field`,
1482
+ `sys_history_line`, `sys_audit_delete`, `sys_attachment_doc`, `sys_email`. A
1483
+ `"*"` entry reaches them once the profile names them in `tableAccess` (below).
1384
1484
 
1385
1485
  On an ITSM table or a table without a built-in entry, named in the policy or
1386
1486
  not, `readable` and `writable` each resolve from the table's own entry, then
@@ -1397,6 +1497,54 @@ client-side code, and the user and group tables (`sys_user`,
1397
1497
  `sys_user_group`, `sys_user_grmember`). Name a system table to narrow it, and
1398
1498
  grant it in `tableAccess` only deliberately.
1399
1499
 
1500
+ **Six tables are granted by name.** A `"*"` entry in `readTables` or
1501
+ `writeTables` covers every other table, but not `sys_audit`, `sys_journal_field`,
1502
+ `sys_history_line`, `sys_audit_delete`, `sys_attachment_doc` or `sys_email`.
1503
+ Their rows hold the old and new values of other tables' fields, comments and
1504
+ work notes, the history built from them, deleted records, attachment content
1505
+ and email bodies. A profile reaches one only when `tableAccess` names it, for
1506
+ example
1507
+ `servicenow-mcp-setup grant --profile <profile> --read sys_audit --tools sn_query`.
1508
+ Without that, every tool refuses it, `sn_query`, `sn_get`, `sn_aggregate`,
1509
+ `sn_schema` and `sn_batch` included, and the message names the table and the
1510
+ grant that allows it. A `relatedTables` list that reaches one of them under a
1511
+ `"*"` grant stops the profile loading, and the message names the table and says
1512
+ to grant it by name.
1513
+
1514
+ Once named, these tables follow the profile's field policy like an ITSM table:
1515
+ a `"*"` field entry narrows them, and an entry for the table narrows or widens
1516
+ them. A read that names no `fields` leaves out the value columns, which are asked
1517
+ for by name: `oldvalue` and `newvalue` for `sys_audit`; `value` for
1518
+ `sys_journal_field`; `old`, `new`, `old_value` and `new_value` for
1519
+ `sys_history_line`; `payload` for `sys_audit_delete`; `data` for
1520
+ `sys_attachment_doc`; and `body`, `body_text`, `subject`, `recipients`,
1521
+ `copied`, `blind_copied`, `reply_to`, `headers` and `error_string` for
1522
+ `sys_email`. `sn_attach` is unchanged: it uses the Attachment API, under the
1523
+ grants for `sys_attachment` and the record's table, and never reads
1524
+ `sys_attachment_doc`.
1525
+
1526
+ **A `"*"` write grant does not cover three ATF tables.** `sys_atf_step`,
1527
+ `sys_variable_value` and `sys_element_mapping` hold the step types, input values
1528
+ and pill mappings that `sn_atf_author` checks when it adds a step. Under a `"*"`
1529
+ write grant they are written by `sn_atf_author` only; `sn_create`, `sn_update`, `sn_delete`, `sn_batch` and
1530
+ attachment uploads reach them only when `tableAccess` names the table for write,
1531
+ and the refusal names the table and the grant that allows it. Reads are
1532
+ unchanged. `sys_variable_value` and `sys_element_mapping` also hold other
1533
+ variables' values and mappings (catalog variables, for example), so a profile
1534
+ that writes those with the generic tools needs to name them.
1535
+
1536
+ **Database views and extension tables are not covered by the name list.** The
1537
+ six tables are matched by table name. A database view built over one of them (a
1538
+ `sys_db_view` that joins any of the six) has a different name, so a `"*"` grant
1539
+ reaches the view and, through it, the columns of the joined table. The same holds
1540
+ for a custom table that extends one of the six. Do not grant such a view or table
1541
+ unless you mean to expose those rows, and on a profile with a `"*"` grant ask
1542
+ your instance administrator to review database views first; a profile with an
1543
+ explicit table list never reaches a view it does not name. To have the loader
1544
+ check it, declare the view as a `view` target with every table it reads in
1545
+ `relatedTables`: the profile then fails to load unless it also names each of
1546
+ those tables (for a named-only table, by name).
1547
+
1400
1548
  **Code tables list without their scripts.** A read of `sys_script`,
1401
1549
  `sys_script_include`, `sys_ui_script`, `sys_script_client` or `sys_ws_operation`
1402
1550
  that names no `fields` returns identifiers and metadata, not the script body, so
@@ -1586,7 +1734,7 @@ smaller.
1586
1734
  | `SN_INSTANCE` | ✅* | — | Instance URL (e.g. `https://yourinstance.service-now.com`) |
1587
1735
  | `SN_USER` | ✅* | — | ServiceNow username (basic auth / OAuth password grant) |
1588
1736
  | `SN_PASSWORD` | ✅* | — | ServiceNow password (basic auth / OAuth password grant) |
1589
- | `SN_AUTH_TYPE` | ❌ | `basic` | Auth scheme: `basic`, `oauth`, or `apikey` |
1737
+ | `SN_AUTH_TYPE` | ❌ | `basic` (legacy; set `oauth` explicitly) | Auth scheme: `basic`, `oauth`, or `apikey` |
1590
1738
  | `SN_CLIENT_ID` | ❌ | — | OAuth client id (`SN_AUTH_TYPE=oauth`) |
1591
1739
  | `SN_CLIENT_SECRET` | ❌ | — | OAuth client secret (`SN_AUTH_TYPE=oauth`) |
1592
1740
  | `SN_GRANT_TYPE` | ❌ | `client_credentials` | OAuth grant: `client_credentials` or `password` |
@@ -27,7 +27,7 @@ export declare const DENY_ALL_ATF_EXECUTION: AtfExecutionPolicy;
27
27
  * non-boolean value is a provider defect, so it fails context creation.
28
28
  */
29
29
  export declare function createAtfExecutionPolicy(candidate: AtfExecutionPolicyInput | undefined): AtfExecutionPolicy;
30
- export type AtfPolicyFailureReason = "execution_not_enabled" | "script_steps_not_enabled";
30
+ export type AtfPolicyFailureReason = "execution_not_enabled" | "script_steps_not_enabled" | "acl_enforcement_required";
31
31
  export declare class AtfPolicyError extends Error {
32
32
  readonly reason: AtfPolicyFailureReason;
33
33
  constructor(reason: AtfPolicyFailureReason);
@@ -1 +1 @@
1
- {"version":3,"file":"atf-policy.d.ts","sourceRoot":"","sources":["../src/atf-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAE/E,0DAA0D;AAC1D,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,0DAA0D;AAC1D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;CACpC;AAED,eAAO,MAAM,sBAAsB,EAAE,kBAGnC,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,uBAAuB,GAAG,SAAS,GAC7C,kBAAkB,CAiBpB;AAED,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,GAAG,0BAA0B,CAAC;AAI1F,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;gBAE5B,MAAM,EAAE,sBAAsB;CAO3C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAMxE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,CAWR;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,IAAI,CAAC,gCAAgC,EAAE,KAAK,CAAC,GACpD,IAAI,CAIN"}
1
+ {"version":3,"file":"atf-policy.d.ts","sourceRoot":"","sources":["../src/atf-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAE/E,0DAA0D;AAC1D,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,0DAA0D;AAC1D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;CACpC;AAED,eAAO,MAAM,sBAAsB,EAAE,kBAGnC,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,uBAAuB,GAAG,SAAS,GAC7C,kBAAkB,CAiBpB;AAED,MAAM,MAAM,sBAAsB,GAC9B,uBAAuB,GACvB,0BAA0B,GAC1B,0BAA0B,CAAC;AAI/B,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;gBAE5B,MAAM,EAAE,sBAAsB;CAO3C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAMxE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,CAYR;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,IAAI,CAAC,gCAAgC,EAAE,KAAK,CAAC,GACpD,IAAI,CAIN"}
@@ -66,6 +66,8 @@ function isAtfPolicyError(error) {
66
66
  function atfPolicyDenialMessage(_error, tool) {
67
67
  if (_error.reason === "script_steps_not_enabled")
68
68
  return "ATF script-step authoring denied by policy. Set atf.allowScriptSteps=true on this profile to permit code-executing steps.";
69
+ if (_error.reason === "acl_enforcement_required")
70
+ return "ATF step denied by policy: record_query and record_validation steps always enforce ACLs. Leave enforce_security out, or set it to true.";
69
71
  const subject = typeof tool === "string" && tool.trim() !== "" ? tool.trim() : "This tool";
70
72
  return (`ATF execution denied by policy: ${subject} runs ATF tests, and this profile ` +
71
73
  `does not enable ATF execution. Running a suite executes its steps on the ` +
@@ -1 +1 @@
1
- {"version":3,"file":"atf-policy.js","sourceRoot":"","sources":["../src/atf-policy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AA0BH,4DAmBC;AAkBD,4CAMC;AAMD,wDAcC;AAMD,kDAMC;AArFY,QAAA,sBAAsB,GAAuB,MAAM,CAAC,MAAM,CAAC;IACtE,OAAO,EAAE,KAAK;IACd,gBAAgB,EAAE,KAAK;CACxB,CAAC,CAAC;AAEH;;;;GAIG;AACH,SAAgB,wBAAwB,CACtC,SAA8C;IAE9C,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,8BAAsB,CAAC;IAC3D,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACxD,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC,CAAC;IAChE,CAAC;IACD,MAAM,OAAO,GAAY,SAAS,CAAC,OAAO,CAAC;IAC3C,MAAM,gBAAgB,GAAY,SAAS,CAAC,gBAAgB,CAAC;IAC7D,IACE,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,OAAO,KAAK,SAAS,CAAC;QACvD,CAAC,gBAAgB,KAAK,SAAS,IAAI,OAAO,gBAAgB,KAAK,SAAS,CAAC,EACzE,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,KAAK,IAAI;QACzB,gBAAgB,EAAE,gBAAgB,KAAK,IAAI;KAC5C,CAAC,CAAC;AACL,CAAC;AAID,MAAM,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C;IACtB,CAAC;CACF;AAVD,wCAUC;AAED,SAAgB,gBAAgB,CAAC,KAAc;IAC7C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,wBAAwB,CAAC,GAAG,CAAC,KAAK,CAAC,CACpC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CACpC,MAAsB,EACtB,IAAa;IAEb,IAAI,MAAM,CAAC,MAAM,KAAK,0BAA0B;QAAE,OAAO,2HAA2H,CAAC;IACrL,IAAI,MAAM,CAAC,MAAM,KAAK,0BAA0B;QAAE,OAAO,yIAAyI,CAAC;IACnM,MAAM,OAAO,GACX,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;IAC7E,OAAO,CACL,mCAAmC,OAAO,oCAAoC;QAC9E,2EAA2E;QAC3E,uEAAuE;QACvE,2EAA2E;QAC3E,yDAAyD,CAC1D,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,MAAqD;IAErD,IAAI,MAAM,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;QACjC,MAAM,IAAI,cAAc,CAAC,uBAAuB,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
package/dist/config.d.ts CHANGED
@@ -15,7 +15,7 @@ export interface ServiceNowConfig {
15
15
  password: string;
16
16
  displayValue: string;
17
17
  relDepth: number;
18
- /** Auth scheme (default "basic"). */
18
+ /** Auth scheme. When absent it is read as "basic", for profiles saved before OAuth existed. */
19
19
  authType?: AuthType;
20
20
  /** OAuth client id (authType "oauth"). */
21
21
  clientId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAA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