@onlyflows/servicenow-mcp 2.3.0-rc.1 → 2.3.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +732 -3
- package/README.md +418 -40
- package/dist/atf-policy.d.ts +1 -1
- package/dist/atf-policy.d.ts.map +1 -1
- package/dist/atf-policy.js +2 -0
- package/dist/atf-policy.js.map +1 -1
- package/dist/call-metrics.d.ts +42 -0
- package/dist/call-metrics.d.ts.map +1 -0
- package/dist/call-metrics.js +89 -0
- package/dist/call-metrics.js.map +1 -0
- package/dist/client.d.ts +18 -14
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +51 -36
- package/dist/client.js.map +1 -1
- package/dist/code-search-snippet.d.ts +25 -0
- package/dist/code-search-snippet.d.ts.map +1 -0
- package/dist/code-search-snippet.js +67 -0
- package/dist/code-search-snippet.js.map +1 -0
- package/dist/code-search-targets.d.ts +66 -0
- package/dist/code-search-targets.d.ts.map +1 -0
- package/dist/code-search-targets.js +82 -0
- package/dist/code-search-targets.js.map +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/credential-tables.d.ts +32 -0
- package/dist/credential-tables.d.ts.map +1 -0
- package/dist/credential-tables.js +58 -0
- package/dist/credential-tables.js.map +1 -0
- package/dist/encoded-query-policy.d.ts +9 -0
- package/dist/encoded-query-policy.d.ts.map +1 -1
- package/dist/encoded-query-policy.js +27 -2
- package/dist/encoded-query-policy.js.map +1 -1
- package/dist/execution-context.d.ts +14 -0
- package/dist/execution-context.d.ts.map +1 -1
- package/dist/execution-context.js +8 -0
- package/dist/execution-context.js.map +1 -1
- package/dist/field-policy.d.ts +34 -1
- package/dist/field-policy.d.ts.map +1 -1
- package/dist/field-policy.js +325 -30
- package/dist/field-policy.js.map +1 -1
- package/dist/hidden-values.d.ts +225 -0
- package/dist/hidden-values.d.ts.map +1 -0
- package/dist/hidden-values.js +748 -0
- package/dist/hidden-values.js.map +1 -0
- package/dist/http-entrypoint.d.ts.map +1 -1
- package/dist/http-entrypoint.js +7 -0
- package/dist/http-entrypoint.js.map +1 -1
- package/dist/http-observability.js +1 -0
- package/dist/http-observability.js.map +1 -1
- package/dist/http-runtime.js +16 -0
- package/dist/http-runtime.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/metadata-cache.d.ts +135 -7
- package/dist/metadata-cache.d.ts.map +1 -1
- package/dist/metadata-cache.js +357 -21
- package/dist/metadata-cache.js.map +1 -1
- package/dist/policy-card.d.ts +16 -1
- package/dist/policy-card.d.ts.map +1 -1
- package/dist/policy-card.js +13 -2
- package/dist/policy-card.js.map +1 -1
- package/dist/profile-admin.d.ts +18 -0
- package/dist/profile-admin.d.ts.map +1 -1
- package/dist/profile-admin.js +26 -1
- package/dist/profile-admin.js.map +1 -1
- package/dist/profile-manager.d.ts +13 -1
- package/dist/profile-manager.d.ts.map +1 -1
- package/dist/profile-manager.js +23 -1
- package/dist/profile-manager.js.map +1 -1
- package/dist/response-too-large.d.ts +23 -0
- package/dist/response-too-large.d.ts.map +1 -0
- package/dist/response-too-large.js +42 -0
- package/dist/response-too-large.js.map +1 -0
- package/dist/risky-grants.d.ts.map +1 -1
- package/dist/risky-grants.js +1 -0
- package/dist/risky-grants.js.map +1 -1
- package/dist/setup-prompts.js +1 -1
- package/dist/setup-prompts.js.map +1 -1
- package/dist/setup.d.ts +4 -0
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +176 -68
- package/dist/setup.js.map +1 -1
- package/dist/structured-query.d.ts +61 -2
- package/dist/structured-query.d.ts.map +1 -1
- package/dist/structured-query.js +382 -36
- package/dist/structured-query.js.map +1 -1
- package/dist/table-policy.d.ts +75 -2
- package/dist/table-policy.d.ts.map +1 -1
- package/dist/table-policy.js +184 -15
- package/dist/table-policy.js.map +1 -1
- package/dist/tool-error.d.ts +47 -4
- package/dist/tool-error.d.ts.map +1 -1
- package/dist/tool-error.js +104 -4
- package/dist/tool-error.js.map +1 -1
- package/dist/tool-table-access.d.ts +9 -2
- package/dist/tool-table-access.d.ts.map +1 -1
- package/dist/tool-table-access.js +118 -36
- package/dist/tool-table-access.js.map +1 -1
- package/dist/tools/aggregate.js +2 -2
- package/dist/tools/aggregate.js.map +1 -1
- package/dist/tools/all-fields-cap.d.ts.map +1 -1
- package/dist/tools/all-fields-cap.js +29 -7
- package/dist/tools/all-fields-cap.js.map +1 -1
- package/dist/tools/atf-author-module.d.ts +1 -7
- package/dist/tools/atf-author-module.d.ts.map +1 -1
- package/dist/tools/atf-author-module.js +16 -7
- package/dist/tools/atf-author-module.js.map +1 -1
- package/dist/tools/atf-contracts.d.ts +69 -4
- package/dist/tools/atf-contracts.d.ts.map +1 -1
- package/dist/tools/atf-contracts.js +32 -2
- package/dist/tools/atf-contracts.js.map +1 -1
- package/dist/tools/atf-renderers.js +2 -1
- package/dist/tools/atf-renderers.js.map +1 -1
- package/dist/tools/atf-results-module.d.ts.map +1 -1
- package/dist/tools/atf-results-module.js +5 -3
- package/dist/tools/atf-results-module.js.map +1 -1
- package/dist/tools/atf-run-module.js +3 -2
- package/dist/tools/atf-run-module.js.map +1 -1
- package/dist/tools/atf-shared.d.ts +6 -0
- package/dist/tools/atf-shared.d.ts.map +1 -1
- package/dist/tools/atf-shared.js +49 -10
- package/dist/tools/atf-shared.js.map +1 -1
- package/dist/tools/atf-step-catalog.d.ts +13 -8
- package/dist/tools/atf-step-catalog.d.ts.map +1 -1
- package/dist/tools/atf-step-catalog.js +169 -5
- package/dist/tools/atf-step-catalog.js.map +1 -1
- package/dist/tools/batch.d.ts.map +1 -1
- package/dist/tools/batch.js +25 -7
- package/dist/tools/batch.js.map +1 -1
- package/dist/tools/catalog.d.ts.map +1 -1
- package/dist/tools/catalog.js +2 -1
- package/dist/tools/catalog.js.map +1 -1
- package/dist/tools/codesearch.d.ts +2 -2
- package/dist/tools/codesearch.d.ts.map +1 -1
- package/dist/tools/codesearch.js +536 -67
- package/dist/tools/codesearch.js.map +1 -1
- package/dist/tools/flow-view-contracts.d.ts +59 -3
- package/dist/tools/flow-view-contracts.d.ts.map +1 -1
- package/dist/tools/flow-view-contracts.js +34 -2
- package/dist/tools/flow-view-contracts.js.map +1 -1
- package/dist/tools/flow-view-graph.d.ts +14 -0
- package/dist/tools/flow-view-graph.d.ts.map +1 -1
- package/dist/tools/flow-view-graph.js +43 -1
- package/dist/tools/flow-view-graph.js.map +1 -1
- package/dist/tools/flow-view-module.js +2 -2
- package/dist/tools/flow-view-module.js.map +1 -1
- package/dist/tools/flow-view-policy.d.ts +3 -3
- package/dist/tools/flow-view-policy.d.ts.map +1 -1
- package/dist/tools/flow-view-policy.js +5 -4
- package/dist/tools/flow-view-policy.js.map +1 -1
- package/dist/tools/flow-view-renderers.d.ts.map +1 -1
- package/dist/tools/flow-view-renderers.js +9 -21
- package/dist/tools/flow-view-renderers.js.map +1 -1
- package/dist/tools/get-module.js +1 -1
- package/dist/tools/get-module.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +116 -25
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/platform-view-contracts.d.ts +189 -0
- package/dist/tools/platform-view-contracts.d.ts.map +1 -0
- package/dist/tools/platform-view-contracts.js +353 -0
- package/dist/tools/platform-view-contracts.js.map +1 -0
- package/dist/tools/platform-view-evaluate.d.ts +11 -0
- package/dist/tools/platform-view-evaluate.d.ts.map +1 -0
- package/dist/tools/platform-view-evaluate.js +19 -0
- package/dist/tools/platform-view-evaluate.js.map +1 -0
- package/dist/tools/platform-view-module.d.ts +28 -0
- package/dist/tools/platform-view-module.d.ts.map +1 -0
- package/dist/tools/platform-view-module.js +111 -0
- package/dist/tools/platform-view-module.js.map +1 -0
- package/dist/tools/platform-view-scan.d.ts +57 -0
- package/dist/tools/platform-view-scan.d.ts.map +1 -0
- package/dist/tools/platform-view-scan.js +375 -0
- package/dist/tools/platform-view-scan.js.map +1 -0
- package/dist/tools/platform-view-upgrades.d.ts +152 -0
- package/dist/tools/platform-view-upgrades.d.ts.map +1 -0
- package/dist/tools/platform-view-upgrades.js +545 -0
- package/dist/tools/platform-view-upgrades.js.map +1 -0
- package/dist/tools/profile.d.ts.map +1 -1
- package/dist/tools/profile.js +1 -0
- package/dist/tools/profile.js.map +1 -1
- package/dist/tools/query-module.d.ts.map +1 -1
- package/dist/tools/query-module.js +231 -64
- package/dist/tools/query-module.js.map +1 -1
- package/dist/tools/record-write-shared.d.ts.map +1 -1
- package/dist/tools/record-write-shared.js +4 -3
- package/dist/tools/record-write-shared.js.map +1 -1
- package/dist/tools/result-envelope.d.ts +429 -38
- package/dist/tools/result-envelope.d.ts.map +1 -1
- package/dist/tools/result-envelope.js +372 -36
- package/dist/tools/result-envelope.js.map +1 -1
- package/dist/tools/schema-module.d.ts.map +1 -1
- package/dist/tools/schema-module.js +1 -1
- package/dist/tools/schema-module.js.map +1 -1
- package/dist/tools/syslog-cursor.d.ts +61 -0
- package/dist/tools/syslog-cursor.d.ts.map +1 -0
- package/dist/tools/syslog-cursor.js +146 -0
- package/dist/tools/syslog-cursor.js.map +1 -0
- package/dist/tools/syslog.d.ts +2 -0
- package/dist/tools/syslog.d.ts.map +1 -1
- package/dist/tools/syslog.js +126 -2
- package/dist/tools/syslog.js.map +1 -1
- package/dist/tools/truncation-hint.d.ts +125 -0
- package/dist/tools/truncation-hint.d.ts.map +1 -0
- package/dist/tools/truncation-hint.js +298 -0
- package/dist/tools/truncation-hint.js.map +1 -0
- package/dist/unknown-filter-fields.d.ts +52 -0
- package/dist/unknown-filter-fields.d.ts.map +1 -0
- package/dist/unknown-filter-fields.js +87 -0
- package/dist/unknown-filter-fields.js.map +1 -0
- package/dist/update-set-eval/secret-patterns.d.ts +75 -0
- package/dist/update-set-eval/secret-patterns.d.ts.map +1 -0
- package/dist/update-set-eval/secret-patterns.js +570 -0
- package/dist/update-set-eval/secret-patterns.js.map +1 -0
- package/dist/update-set-eval/xml-reader.d.ts +117 -0
- package/dist/update-set-eval/xml-reader.d.ts.map +1 -0
- package/dist/update-set-eval/xml-reader.js +561 -0
- package/dist/update-set-eval/xml-reader.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/CLIENT-SETUP.md +30 -7
- package/docs/FLOW-VIEW.md +14 -5
- package/docs/PRODUCTION-SECURITY.md +84 -1
- package/docs/PROFILE-CREDENTIALS.md +10 -4
- package/docs/V2-MIGRATION.md +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/field-policy.js
CHANGED
|
@@ -29,14 +29,21 @@ exports.filterReadableRecord = filterReadableRecord;
|
|
|
29
29
|
exports.filterSchemaEntries = filterSchemaEntries;
|
|
30
30
|
exports.filterAggregateResult = filterAggregateResult;
|
|
31
31
|
exports.runWithFieldPolicyConfiguration = runWithFieldPolicyConfiguration;
|
|
32
|
+
exports.currentFieldPolicyConfiguration = currentFieldPolicyConfiguration;
|
|
32
33
|
exports.isAllFieldSelection = isAllFieldSelection;
|
|
33
34
|
exports.fieldSelectionToSysparmFields = fieldSelectionToSysparmFields;
|
|
34
35
|
exports.isSensitiveFieldName = isSensitiveFieldName;
|
|
36
|
+
exports.typeHiddenFieldNames = typeHiddenFieldNames;
|
|
37
|
+
exports.queryDeniedFields = queryDeniedFields;
|
|
38
|
+
exports.queryDeniedForSelection = queryDeniedForSelection;
|
|
39
|
+
exports.readableSelectionForTable = readableSelectionForTable;
|
|
35
40
|
exports.describeFieldPolicy = describeFieldPolicy;
|
|
36
41
|
exports.validateFieldPolicyConfiguration = validateFieldPolicyConfiguration;
|
|
37
42
|
exports.fieldPolicyInputFromEnvironment = fieldPolicyInputFromEnvironment;
|
|
38
43
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
39
44
|
const node_util_1 = require("node:util");
|
|
45
|
+
const hidden_values_js_1 = require("./hidden-values.js");
|
|
46
|
+
const table_policy_js_1 = require("./table-policy.js");
|
|
40
47
|
const FIELD_NAME = /^[a-z][a-z0-9_]{0,79}$/u;
|
|
41
48
|
/** @deprecated Field authorization no longer caps the number of selected fields. */
|
|
42
49
|
exports.MAX_FIELDS_PER_OPERATION = 10_000;
|
|
@@ -513,31 +520,42 @@ const POLICY_DEFINITIONS = {
|
|
|
513
520
|
],
|
|
514
521
|
writable: [],
|
|
515
522
|
},
|
|
523
|
+
// The code tables list by identity and metadata, never by script body. A body
|
|
524
|
+
// runs to kilobytes, so a default read that carried it filled the response
|
|
525
|
+
// budget after a handful of rows. `script` stays readable: name it in
|
|
526
|
+
// `fields` (or ask for `fields: "all"`) to read it.
|
|
516
527
|
sys_script: {
|
|
517
|
-
defaults: ["sys_id", "name", "
|
|
528
|
+
defaults: ["sys_id", "name", "collection", "when", "active", "sys_updated_on"],
|
|
518
529
|
readable: ["sys_id", "name", "script", "active", "collection", "filter", "when", "order", "sys_updated_on"],
|
|
519
530
|
writable: [],
|
|
520
531
|
},
|
|
521
532
|
sys_script_include: {
|
|
522
|
-
defaults: ["sys_id", "name", "
|
|
533
|
+
defaults: ["sys_id", "name", "api_name", "active", "sys_updated_on"],
|
|
523
534
|
readable: ["sys_id", "name", "script", "active", "api_name", "client_callable", "access", "sys_updated_on"],
|
|
524
535
|
writable: [],
|
|
525
536
|
},
|
|
526
537
|
sys_ui_script: {
|
|
527
|
-
defaults: ["sys_id", "name", "
|
|
538
|
+
defaults: ["sys_id", "name", "global", "active", "sys_updated_on"],
|
|
528
539
|
readable: ["sys_id", "name", "script", "active", "global", "sys_updated_on"],
|
|
529
540
|
writable: [],
|
|
530
541
|
},
|
|
531
542
|
sys_script_client: {
|
|
532
|
-
defaults: ["sys_id", "name", "
|
|
543
|
+
defaults: ["sys_id", "name", "table", "type", "active", "sys_updated_on"],
|
|
533
544
|
readable: ["sys_id", "name", "script", "active", "table", "type", "condition", "sys_updated_on"],
|
|
534
545
|
writable: [],
|
|
535
546
|
},
|
|
536
547
|
sys_ws_operation: {
|
|
537
|
-
defaults: ["sys_id", "name", "
|
|
548
|
+
defaults: ["sys_id", "name", "http_method", "relative_path", "active", "sys_updated_on"],
|
|
538
549
|
readable: ["sys_id", "name", "operation_script", "active", "http_method", "relative_path", "sys_updated_on"],
|
|
539
550
|
writable: [],
|
|
540
551
|
},
|
|
552
|
+
// ES modules: the script is `content`, and a module is named by its `path`
|
|
553
|
+
// (the table has no `name` column of its own).
|
|
554
|
+
sys_module: {
|
|
555
|
+
defaults: ["sys_id", "path", "sys_updated_on"],
|
|
556
|
+
readable: ["sys_id", "path", "content", "sys_updated_on"],
|
|
557
|
+
writable: [],
|
|
558
|
+
},
|
|
541
559
|
sys_db_object: {
|
|
542
560
|
defaults: ["sys_id", "name", "label", "super_class", "sys_scope", "is_extendable"],
|
|
543
561
|
readable: ["sys_id", "name", "label", "super_class", "sys_scope", "is_extendable"],
|
|
@@ -625,6 +643,58 @@ const POLICY_DEFINITIONS = {
|
|
|
625
643
|
readable: ["sys_id", "name", "status", "browser_name", "browser_version", "os_name", "os_version", "sys_updated_on"],
|
|
626
644
|
writable: [],
|
|
627
645
|
},
|
|
646
|
+
// The named-only tables (NAMED_ONLY_TABLES in table-policy.ts). A "*" table
|
|
647
|
+
// grant never covers them: a profile reaches them only by naming them in
|
|
648
|
+
// tableAccess. For field policy they belong to the profile, like the ITSM
|
|
649
|
+
// tables, so a profile's "*" field entry narrows them. Each default
|
|
650
|
+
// projection names the record and field a row is about and leaves the value
|
|
651
|
+
// columns to be asked for by name.
|
|
652
|
+
//
|
|
653
|
+
// The audit and journal tables hold the old and new values of other tables'
|
|
654
|
+
// fields, and their comments and work notes (oldvalue, newvalue, value).
|
|
655
|
+
sys_audit: {
|
|
656
|
+
defaults: ["sys_id", "tablename", "documentkey", "fieldname", "user", "sys_created_on"],
|
|
657
|
+
readable: ["sys_id", "tablename", "documentkey", "fieldname", "oldvalue", "newvalue", "user", "reason", "sys_created_on"],
|
|
658
|
+
writable: [],
|
|
659
|
+
},
|
|
660
|
+
sys_journal_field: {
|
|
661
|
+
defaults: ["sys_id", "name", "element_id", "element", "sys_created_by", "sys_created_on"],
|
|
662
|
+
readable: ["sys_id", "name", "element_id", "element", "value", "sys_created_by", "sys_created_on"],
|
|
663
|
+
writable: [],
|
|
664
|
+
},
|
|
665
|
+
// The history built from audit for a record's history view. Value columns:
|
|
666
|
+
// old, new, old_value, new_value. user_id and email name the actor and stay
|
|
667
|
+
// out of the default projection.
|
|
668
|
+
sys_history_line: {
|
|
669
|
+
defaults: ["sys_id", "set", "field", "label", "update", "update_time", "type"],
|
|
670
|
+
readable: ["sys_id", "set", "field", "label", "update", "update_time", "type", "user_name", "old", "new", "old_value", "new_value", "sys_created_on"],
|
|
671
|
+
writable: [],
|
|
672
|
+
},
|
|
673
|
+
// A deleted record, kept whole. Value column: payload (the record's XML).
|
|
674
|
+
sys_audit_delete: {
|
|
675
|
+
defaults: ["sys_id", "tablename", "documentkey", "display_value", "sys_created_on", "sys_created_by"],
|
|
676
|
+
readable: ["sys_id", "tablename", "documentkey", "display_value", "payload", "sys_created_on", "sys_created_by"],
|
|
677
|
+
writable: [],
|
|
678
|
+
},
|
|
679
|
+
// Attachment content, in chunks. Value column: data. sn_attach does not read
|
|
680
|
+
// this table: it uses the Attachment API, under the grants of sys_attachment
|
|
681
|
+
// and the parent table.
|
|
682
|
+
sys_attachment_doc: {
|
|
683
|
+
defaults: ["sys_id", "sys_attachment", "position", "length", "sys_created_on"],
|
|
684
|
+
readable: ["sys_id", "sys_attachment", "position", "length", "data", "sys_created_on"],
|
|
685
|
+
writable: [],
|
|
686
|
+
},
|
|
687
|
+
// Notification copies. Content columns: body, body_text, subject,
|
|
688
|
+
// recipients, copied, blind_copied, reply_to, headers, error_string.
|
|
689
|
+
sys_email: {
|
|
690
|
+
defaults: ["sys_id", "type", "state", "target_table", "instance", "sys_created_on"],
|
|
691
|
+
readable: [
|
|
692
|
+
"sys_id", "type", "state", "notification_type", "target_table", "instance", "mailbox",
|
|
693
|
+
"subject", "body", "body_text", "recipients", "copied", "blind_copied", "reply_to",
|
|
694
|
+
"headers", "error_string", "sys_created_on",
|
|
695
|
+
],
|
|
696
|
+
writable: [],
|
|
697
|
+
},
|
|
628
698
|
};
|
|
629
699
|
/**
|
|
630
700
|
* The policy base.
|
|
@@ -641,9 +711,9 @@ const POLICY_DEFINITIONS = {
|
|
|
641
711
|
* a granted custom table needs no field-policy entry to be usable.
|
|
642
712
|
*
|
|
643
713
|
* A profile's own "*" entry reaches further: it also covers the ITSM tables
|
|
644
|
-
* (ITSM_TABLES)
|
|
645
|
-
* table's own entry is silent.
|
|
646
|
-
* never covered by a "*" entry.
|
|
714
|
+
* (ITSM_TABLES), the named-only tables (NAMED_ONLY_BUILT_INS) and every table
|
|
715
|
+
* the profile names, key by key, wherever the table's own entry is silent.
|
|
716
|
+
* Only the system tables (SYSTEM_TABLES) are never covered by a "*" entry.
|
|
647
717
|
*/
|
|
648
718
|
const FIELD_POLICY_BASE = Object.freeze({
|
|
649
719
|
...Object.fromEntries(Object.entries(POLICY_DEFINITIONS).map(([table, definition]) => [
|
|
@@ -689,8 +759,9 @@ const ITSM_TABLES = new Set([
|
|
|
689
759
|
*
|
|
690
760
|
* This list is written out rather than derived as "built-in minus ITSM", so
|
|
691
761
|
* a new built-in entry never escapes every profile's "*" entry by default.
|
|
692
|
-
* Each built-in entry must be in exactly one of ITSM_TABLES
|
|
693
|
-
*
|
|
762
|
+
* Each built-in entry must be in exactly one of ITSM_TABLES, SYSTEM_TABLES
|
|
763
|
+
* and NAMED_ONLY_BUILT_INS; a test enforces this through
|
|
764
|
+
* BUILT_IN_TABLE_CLASSES.
|
|
694
765
|
*/
|
|
695
766
|
const SYSTEM_TABLES = new Set([
|
|
696
767
|
"sys_user",
|
|
@@ -702,6 +773,7 @@ const SYSTEM_TABLES = new Set([
|
|
|
702
773
|
"sys_ui_script",
|
|
703
774
|
"sys_script_client",
|
|
704
775
|
"sys_ws_operation",
|
|
776
|
+
"sys_module",
|
|
705
777
|
"sys_db_object",
|
|
706
778
|
"sys_app",
|
|
707
779
|
"sys_store_app",
|
|
@@ -717,6 +789,16 @@ const SYSTEM_TABLES = new Set([
|
|
|
717
789
|
"sys_atf_test_result_step",
|
|
718
790
|
"sys_atf_agent",
|
|
719
791
|
]);
|
|
792
|
+
/**
|
|
793
|
+
* Built-in tables that a "*" table grant never covers (NAMED_ONLY_TABLES, in
|
|
794
|
+
* table-policy.ts, the one list). For field policy they are profile-owned like
|
|
795
|
+
* the ITSM tables: `readable` and `writable` resolve from the profile's own
|
|
796
|
+
* entry for the table, then its "*" entry, then the built-in "*" (open), so a
|
|
797
|
+
* profile that narrows reads with "*" narrows these too. Their built-in
|
|
798
|
+
* `defaults` leave out the value columns and are clamped to the effective
|
|
799
|
+
* readable set. A table's own entry still narrows or widens it.
|
|
800
|
+
*/
|
|
801
|
+
const NAMED_ONLY_BUILT_INS = new Set(table_policy_js_1.NAMED_ONLY_TABLES);
|
|
720
802
|
/**
|
|
721
803
|
* The built-in tables and how each is classified for a profile's "*" entry.
|
|
722
804
|
* Frozen copies for tests; the policy reads the sets above.
|
|
@@ -725,6 +807,7 @@ exports.BUILT_IN_TABLE_CLASSES = Object.freeze({
|
|
|
725
807
|
builtIn: Object.freeze(Object.keys(POLICY_DEFINITIONS)),
|
|
726
808
|
itsm: Object.freeze([...ITSM_TABLES]),
|
|
727
809
|
system: Object.freeze([...SYSTEM_TABLES]),
|
|
810
|
+
namedOnly: Object.freeze([...NAMED_ONLY_BUILT_INS]),
|
|
728
811
|
});
|
|
729
812
|
const GENERIC_RECORD_TABLES = new Set([
|
|
730
813
|
"incident",
|
|
@@ -806,7 +889,11 @@ function fieldPolicyDenialMessage(error) {
|
|
|
806
889
|
`fieldPolicy.${table}, or a fieldPolicy."*" fallback, to allow it.`
|
|
807
890
|
: "Access denied by policy: the requested table has no field policy entry.";
|
|
808
891
|
case "sensitive_field":
|
|
892
|
+
// The same text for a name and a type denial: saying which would tell
|
|
893
|
+
// the caller a field's type, which is what the type rule keeps back.
|
|
809
894
|
return "Access denied by policy: a requested field is denied by name as sensitive and cannot be granted by configuration.";
|
|
895
|
+
case "field_types_unavailable":
|
|
896
|
+
return hidden_values_js_1.FIELD_TYPES_UNAVAILABLE_MESSAGE;
|
|
810
897
|
case "explicit_field_required":
|
|
811
898
|
// Only the EXPLICIT_WRITE_FIELDS names reach this case; each is a fixed
|
|
812
899
|
// name that passed FIELD_NAME.
|
|
@@ -865,15 +952,17 @@ function resolveReadableFields(tableCandidate, input = {}) {
|
|
|
865
952
|
const canonicalInput = snapshotPlainDataArguments(input);
|
|
866
953
|
const responseFormat = normalizeResponseFormat(canonicalInput.responseFormat);
|
|
867
954
|
const requested = canonicalInput.fields;
|
|
955
|
+
const hidden = typeHiddenFields(policy.table);
|
|
956
|
+
const queryDenied = canonicalInput.purpose === "query" ? (0, hidden_values_js_1.rowValueRule)(policy.table)?.queryDenied : undefined;
|
|
868
957
|
if (requested === undefined) {
|
|
869
|
-
return requireNonEmptySelection(responseFormat === "detailed" ? readableSelection(policy) : policy.defaults);
|
|
958
|
+
return visibleSelection(policy.table, requireNonEmptySelection(responseFormat === "detailed" ? readableSelection(policy) : policy.defaults));
|
|
870
959
|
}
|
|
871
960
|
if (typeof requested !== "string") {
|
|
872
961
|
throw new FieldPolicyError("invalid_field_selection");
|
|
873
962
|
}
|
|
874
963
|
const trimmed = requested.trim();
|
|
875
964
|
if (trimmed.toLowerCase() === "all") {
|
|
876
|
-
return requireNonEmptySelection(readableSelection(policy));
|
|
965
|
+
return visibleSelection(policy.table, requireNonEmptySelection(readableSelection(policy)));
|
|
877
966
|
}
|
|
878
967
|
if (!trimmed)
|
|
879
968
|
throw new FieldPolicyError("invalid_field_selection");
|
|
@@ -883,7 +972,10 @@ function resolveReadableFields(tableCandidate, input = {}) {
|
|
|
883
972
|
const field = normalizeFieldName(candidate);
|
|
884
973
|
if (seen.has(field))
|
|
885
974
|
throw new FieldPolicyError("invalid_field_selection");
|
|
886
|
-
|
|
975
|
+
// A hidden-typed field is refused exactly like a sensitive name, with the
|
|
976
|
+
// same message, before the readable check, so the refusal says nothing
|
|
977
|
+
// about the field's type or whether a configuration could grant it.
|
|
978
|
+
if (isSensitiveFieldName(field) || hidden.has(field) || queryDenied?.has(field)) {
|
|
887
979
|
throw new FieldPolicyError("sensitive_field", { table: policy.table });
|
|
888
980
|
}
|
|
889
981
|
if (!fieldSetAllows(policy.readable, policy.allowAnyReadable, field)) {
|
|
@@ -892,7 +984,7 @@ function resolveReadableFields(tableCandidate, input = {}) {
|
|
|
892
984
|
seen.add(field);
|
|
893
985
|
selected.push(field);
|
|
894
986
|
}
|
|
895
|
-
return
|
|
987
|
+
return boundSelection(policy.table, selected);
|
|
896
988
|
}
|
|
897
989
|
/** Validate and clone one Table API write map using the separate write set. */
|
|
898
990
|
function validateWritableFields(tableCandidate, payloadCandidate) {
|
|
@@ -920,7 +1012,7 @@ function validateWritableFields(tableCandidate, payloadCandidate) {
|
|
|
920
1012
|
if (Object.hasOwn(output, field)) {
|
|
921
1013
|
throw new FieldPolicyError("invalid_write_payload");
|
|
922
1014
|
}
|
|
923
|
-
if (isSensitiveFieldName(field)) {
|
|
1015
|
+
if (isSensitiveFieldName(field) || typeHiddenFields(policy.table).has(field)) {
|
|
924
1016
|
throw new FieldPolicyError("sensitive_field", { table: policy.table });
|
|
925
1017
|
}
|
|
926
1018
|
// policy.writable holds only explicitly listed names; it is empty when
|
|
@@ -1012,7 +1104,8 @@ function preparedReadableFields(args, tableCandidate) {
|
|
|
1012
1104
|
if (!Array.isArray(fields) || !Object.isFrozen(fields))
|
|
1013
1105
|
return undefined;
|
|
1014
1106
|
if (isAllFieldSelection(fields)) {
|
|
1015
|
-
|
|
1107
|
+
// The entry's own wildcard, which carries its table's hidden fields.
|
|
1108
|
+
return policy.allowAnyReadable ? fields : undefined;
|
|
1016
1109
|
}
|
|
1017
1110
|
if (fields.some((field) => typeof field !== "string" ||
|
|
1018
1111
|
!fieldSetAllows(policy.readable, policy.allowAnyReadable, field))) {
|
|
@@ -1028,12 +1121,12 @@ function preparedReadableFields(args, tableCandidate) {
|
|
|
1028
1121
|
function filterReadableRecord(candidate, readableFields) {
|
|
1029
1122
|
if (node_util_1.types.isProxy(readableFields))
|
|
1030
1123
|
return null;
|
|
1124
|
+
const context = selectionContext(readableFields);
|
|
1031
1125
|
const state = responseTraversalState();
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
return filterRecordNode(candidate, approved, state, 0);
|
|
1126
|
+
const filtered = isAllFieldSelection(readableFields)
|
|
1127
|
+
? sanitizeNestedValue(candidate, state, 0)
|
|
1128
|
+
: filterRecordNode(candidate, new Set(readableFields.map(normalizeFieldName)), state, 0);
|
|
1129
|
+
return context === undefined ? filtered : applyHiddenRules(filtered, context);
|
|
1037
1130
|
}
|
|
1038
1131
|
/** Remove metadata entries for fields the caller is not permitted to discover. */
|
|
1039
1132
|
function filterSchemaEntries(candidate, readableFields) {
|
|
@@ -1094,15 +1187,26 @@ function filterSchemaEntries(candidate, readableFields) {
|
|
|
1094
1187
|
function filterAggregateResult(candidate, readableFields) {
|
|
1095
1188
|
if (node_util_1.types.isProxy(readableFields))
|
|
1096
1189
|
return null;
|
|
1190
|
+
const hidden = selectionContext(readableFields)?.hidden ?? EMPTY_FIELDS;
|
|
1097
1191
|
const state = responseTraversalState();
|
|
1098
1192
|
if (isAllFieldSelection(readableFields)) {
|
|
1099
|
-
|
|
1193
|
+
const sanitized = sanitizeNestedValue(candidate, state, 0);
|
|
1194
|
+
return hidden.size === 0 ? sanitized : withoutAggregateFields(sanitized, hidden, 0);
|
|
1100
1195
|
}
|
|
1101
|
-
const approved = new Set(readableFields.map(normalizeFieldName));
|
|
1196
|
+
const approved = new Set(readableFields.map(normalizeFieldName).filter((field) => !hidden.has(field)));
|
|
1102
1197
|
return filterAggregateNode(candidate, approved, state, 0);
|
|
1103
1198
|
}
|
|
1104
1199
|
function runWithFieldPolicyConfiguration(configuration, callback) {
|
|
1105
|
-
return FIELD_POLICY_CONFIGURATION_SCOPE.run(configuration ??
|
|
1200
|
+
return FIELD_POLICY_CONFIGURATION_SCOPE.run(configuration ?? NO_FIELD_POLICY_CONFIGURATION, callback);
|
|
1201
|
+
}
|
|
1202
|
+
const NO_FIELD_POLICY_CONFIGURATION = Object.freeze({});
|
|
1203
|
+
/**
|
|
1204
|
+
* The field-policy configuration in force, as an identity: two preparations
|
|
1205
|
+
* that see the same object were checked against the same policy. Undefined
|
|
1206
|
+
* outside a configuration scope.
|
|
1207
|
+
*/
|
|
1208
|
+
function currentFieldPolicyConfiguration() {
|
|
1209
|
+
return FIELD_POLICY_CONFIGURATION_SCOPE.getStore();
|
|
1106
1210
|
}
|
|
1107
1211
|
/** True when a field selection means ServiceNow should return all fields. */
|
|
1108
1212
|
function isAllFieldSelection(selection) {
|
|
@@ -1122,6 +1226,194 @@ function isSensitiveFieldName(candidate) {
|
|
|
1122
1226
|
return (/(?:^|_)(?:password|passwd|credential|credentials|secret|token|api_key|private_key|encryption_key|ssn)(?:_|$)/u.test(normalized) ||
|
|
1123
1227
|
normalized === "social_security_number");
|
|
1124
1228
|
}
|
|
1229
|
+
const EMPTY_FIELDS = Object.freeze(new Set());
|
|
1230
|
+
/**
|
|
1231
|
+
* Type hiding. The dispatcher resolves each table's hidden-typed fields
|
|
1232
|
+
* (`hidden-values.ts`) before a call's plan is prepared and runs the plan and
|
|
1233
|
+
* the handler inside that scope. Every check above then treats a hidden-typed
|
|
1234
|
+
* field like a sensitive name: refused when named (with the same message),
|
|
1235
|
+
* dropped from a wildcard or configured projection, never written, and never
|
|
1236
|
+
* used to filter, order or group. Outside a dispatched call there is no scope
|
|
1237
|
+
* and only names are checked.
|
|
1238
|
+
*/
|
|
1239
|
+
function typeHiddenFields(table) {
|
|
1240
|
+
const scope = (0, hidden_values_js_1.currentHiddenFieldScope)();
|
|
1241
|
+
if (scope === undefined)
|
|
1242
|
+
return EMPTY_FIELDS;
|
|
1243
|
+
const hidden = scope.tables.get(table);
|
|
1244
|
+
if (hidden !== undefined)
|
|
1245
|
+
return hidden;
|
|
1246
|
+
if (scope.unresolved === "names_only")
|
|
1247
|
+
return EMPTY_FIELDS;
|
|
1248
|
+
// A table outside the call's resolved plan has unknown types: refuse.
|
|
1249
|
+
throw new FieldPolicyError("field_types_unavailable", { table });
|
|
1250
|
+
}
|
|
1251
|
+
/** The hidden-typed fields of `table` in the running call; empty outside one. */
|
|
1252
|
+
function typeHiddenFieldNames(tableCandidate) {
|
|
1253
|
+
return typeHiddenFields(normalizeTableName(tableCandidate));
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Fields of `table` that may never filter, order, group or aggregate a read:
|
|
1257
|
+
* its hidden-typed fields and its row rule's value field. The sensitive-name
|
|
1258
|
+
* check applies on top, wherever a caller checks names.
|
|
1259
|
+
*/
|
|
1260
|
+
function queryDeniedFields(tableCandidate) {
|
|
1261
|
+
const table = normalizeTableName(tableCandidate);
|
|
1262
|
+
const hidden = typeHiddenFields(table);
|
|
1263
|
+
const rule = (0, hidden_values_js_1.rowValueRule)(table);
|
|
1264
|
+
return rule === undefined ? hidden : new Set([...hidden, ...rule.queryDenied]);
|
|
1265
|
+
}
|
|
1266
|
+
/** {@link queryDeniedFields} for the table a selection was resolved on. */
|
|
1267
|
+
function queryDeniedForSelection(selection) {
|
|
1268
|
+
const context = selectionContext(selection);
|
|
1269
|
+
if (context === undefined)
|
|
1270
|
+
return EMPTY_FIELDS;
|
|
1271
|
+
return context.rule === undefined
|
|
1272
|
+
? context.hidden
|
|
1273
|
+
: new Set([...context.hidden, ...context.rule.queryDenied]);
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Bind a projection the caller built itself (the bounded all-fields list) to
|
|
1277
|
+
* its table, without its hidden-typed fields, so the response filter applies
|
|
1278
|
+
* the table's rules to it.
|
|
1279
|
+
*/
|
|
1280
|
+
function readableSelectionForTable(tableCandidate, fields,
|
|
1281
|
+
/** A selection this one extends; fields it added to fetch a type stay removed. */
|
|
1282
|
+
extending) {
|
|
1283
|
+
const table = normalizeTableName(tableCandidate);
|
|
1284
|
+
const inherited = extending === undefined ? undefined : SELECTION_CONTEXTS.get(extending)?.companions;
|
|
1285
|
+
return preparedSelection(table, fields, typeHiddenFields(table), inherited);
|
|
1286
|
+
}
|
|
1287
|
+
const SELECTION_CONTEXTS = new WeakMap();
|
|
1288
|
+
/** A frozen selection that remembers its table's hidden fields and row rule. */
|
|
1289
|
+
function boundSelection(table, fields, hidden = typeHiddenFields(table), companions = EMPTY_FIELDS) {
|
|
1290
|
+
const selection = Object.freeze([...fields]);
|
|
1291
|
+
const rule = (0, hidden_values_js_1.rowValueRule)(table);
|
|
1292
|
+
SELECTION_CONTEXTS.set(selection, Object.freeze({ hidden, ...(rule === undefined ? {} : { rule }), companions }));
|
|
1293
|
+
return selection;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Bound copies of policy-chosen projections, per source list, table and
|
|
1297
|
+
* hidden set, so repeated resolutions in one scope return the same frozen
|
|
1298
|
+
* object (as they did before selections were bound).
|
|
1299
|
+
*/
|
|
1300
|
+
const VISIBLE_SELECTIONS = new WeakMap();
|
|
1301
|
+
/** A policy-chosen projection (defaults, or "all") without hidden-typed fields. */
|
|
1302
|
+
function visibleSelection(table, selection) {
|
|
1303
|
+
const hidden = typeHiddenFields(table);
|
|
1304
|
+
let byTable = VISIBLE_SELECTIONS.get(selection);
|
|
1305
|
+
if (!byTable)
|
|
1306
|
+
VISIBLE_SELECTIONS.set(selection, (byTable = new Map()));
|
|
1307
|
+
let byHidden = byTable.get(table);
|
|
1308
|
+
if (!byHidden)
|
|
1309
|
+
byTable.set(table, (byHidden = new WeakMap()));
|
|
1310
|
+
const cached = byHidden.get(hidden);
|
|
1311
|
+
if (cached)
|
|
1312
|
+
return cached;
|
|
1313
|
+
const bound = isAllFieldSelection(selection)
|
|
1314
|
+
? boundSelection(table, ALL_FIELDS_SELECTION, hidden)
|
|
1315
|
+
: boundSelection(table, requireNonEmptySelection(selection.filter((field) => !hidden.has(field))), hidden);
|
|
1316
|
+
byHidden.set(hidden, bound);
|
|
1317
|
+
return bound;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* The projection a prepared marker carries: hidden-typed fields removed, and
|
|
1321
|
+
* a row rule's type field added when its value field is selected, so each
|
|
1322
|
+
* row's type comes back to decide the value (the type is dropped from the
|
|
1323
|
+
* output again).
|
|
1324
|
+
*/
|
|
1325
|
+
function preparedSelection(table, readableFields, hidden, inheritedCompanions = EMPTY_FIELDS) {
|
|
1326
|
+
if (isAllFieldSelection(readableFields)) {
|
|
1327
|
+
return boundSelection(table, ALL_FIELDS_SELECTION, hidden);
|
|
1328
|
+
}
|
|
1329
|
+
let fields = readableFields.filter((field) => !hidden.has(field));
|
|
1330
|
+
if (fields.length === 0)
|
|
1331
|
+
fields = [...WRITE_ONLY_RESPONSE_FIELDS];
|
|
1332
|
+
const rule = (0, hidden_values_js_1.rowValueRule)(table);
|
|
1333
|
+
if (rule !== undefined &&
|
|
1334
|
+
fields.includes(rule.valueField) &&
|
|
1335
|
+
!fields.includes(rule.typeField) &&
|
|
1336
|
+
!hidden.has(rule.typeField) &&
|
|
1337
|
+
typeFieldReadable(table, rule.typeField)) {
|
|
1338
|
+
return boundSelection(table, [...fields, rule.typeField], hidden, new Set([...inheritedCompanions, rule.typeField]));
|
|
1339
|
+
}
|
|
1340
|
+
return boundSelection(table, fields, hidden, inheritedCompanions);
|
|
1341
|
+
}
|
|
1342
|
+
function typeFieldReadable(table, field) {
|
|
1343
|
+
try {
|
|
1344
|
+
const policy = requirePolicy(table);
|
|
1345
|
+
return (!isSensitiveFieldName(field) &&
|
|
1346
|
+
fieldSetAllows(policy.readable, policy.allowAnyReadable, field));
|
|
1347
|
+
}
|
|
1348
|
+
catch {
|
|
1349
|
+
return false;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* The rules for a selection: its own table's when it was resolved here, else,
|
|
1354
|
+
* inside a dispatched call, the union over the call's tables (a projection
|
|
1355
|
+
* built elsewhere is held to what any table of the call hides).
|
|
1356
|
+
*/
|
|
1357
|
+
function selectionContext(selection) {
|
|
1358
|
+
if (typeof selection === "object" && selection !== null) {
|
|
1359
|
+
const bound = SELECTION_CONTEXTS.get(selection);
|
|
1360
|
+
if (bound !== undefined)
|
|
1361
|
+
return bound;
|
|
1362
|
+
}
|
|
1363
|
+
const scope = (0, hidden_values_js_1.currentHiddenFieldScope)();
|
|
1364
|
+
if (scope === undefined)
|
|
1365
|
+
return undefined;
|
|
1366
|
+
const hidden = new Set();
|
|
1367
|
+
let rule;
|
|
1368
|
+
for (const [table, fields] of scope.tables) {
|
|
1369
|
+
for (const field of fields)
|
|
1370
|
+
hidden.add(field);
|
|
1371
|
+
rule ??= (0, hidden_values_js_1.rowValueRule)(table);
|
|
1372
|
+
}
|
|
1373
|
+
return { hidden, ...(rule === undefined ? {} : { rule }), companions: EMPTY_FIELDS };
|
|
1374
|
+
}
|
|
1375
|
+
/** Drop hidden-typed fields, apply the row rule, drop companions: per record. */
|
|
1376
|
+
function applyHiddenRules(filtered, context) {
|
|
1377
|
+
if (context.hidden.size === 0 && context.rule === undefined && context.companions.size === 0) {
|
|
1378
|
+
return filtered;
|
|
1379
|
+
}
|
|
1380
|
+
return Array.isArray(filtered)
|
|
1381
|
+
? filtered.map((record) => hideInRecord(record, context))
|
|
1382
|
+
: hideInRecord(filtered, context);
|
|
1383
|
+
}
|
|
1384
|
+
function hideInRecord(record, context) {
|
|
1385
|
+
if (typeof record !== "object" || record === null || Array.isArray(record))
|
|
1386
|
+
return record;
|
|
1387
|
+
const output = (0, hidden_values_js_1.withoutFields)(record, context.hidden);
|
|
1388
|
+
const rule = context.rule;
|
|
1389
|
+
if (rule !== undefined && Object.hasOwn(output, rule.valueField) && (0, hidden_values_js_1.rowValueHidden)(rule, output)) {
|
|
1390
|
+
Reflect.deleteProperty(output, rule.valueField);
|
|
1391
|
+
}
|
|
1392
|
+
for (const companion of context.companions)
|
|
1393
|
+
Reflect.deleteProperty(output, companion);
|
|
1394
|
+
return output;
|
|
1395
|
+
}
|
|
1396
|
+
/** Remove hidden fields from already-sanitized aggregate data, at any depth. */
|
|
1397
|
+
function withoutAggregateFields(candidate, hidden, depth) {
|
|
1398
|
+
if (typeof candidate !== "object" || candidate === null || depth > exports.MAX_FIELD_VALUE_DEPTH) {
|
|
1399
|
+
return candidate;
|
|
1400
|
+
}
|
|
1401
|
+
if (Array.isArray(candidate)) {
|
|
1402
|
+
return candidate
|
|
1403
|
+
.filter((entry) => {
|
|
1404
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry))
|
|
1405
|
+
return true;
|
|
1406
|
+
const field = entry.field;
|
|
1407
|
+
return typeof field !== "string" || !hidden.has(field.trim().toLowerCase());
|
|
1408
|
+
})
|
|
1409
|
+
.map((entry) => withoutAggregateFields(entry, hidden, depth + 1));
|
|
1410
|
+
}
|
|
1411
|
+
const output = {};
|
|
1412
|
+
for (const [key, value] of Object.entries((0, hidden_values_js_1.withoutFields)(candidate, hidden))) {
|
|
1413
|
+
safeDefine(output, key, withoutAggregateFields(value, hidden, depth + 1));
|
|
1414
|
+
}
|
|
1415
|
+
return output;
|
|
1416
|
+
}
|
|
1125
1417
|
/** Names the writable wildcard never covers; a profile must list each one. */
|
|
1126
1418
|
exports.EXPLICIT_WRITE_FIELD_NAMES = Object.freeze([
|
|
1127
1419
|
...EXPLICIT_WRITE_FIELDS,
|
|
@@ -1223,8 +1515,9 @@ function isDeepFrozen(candidate, depth) {
|
|
|
1223
1515
|
}
|
|
1224
1516
|
function mergeFieldPolicyDefinitions(base, configured) {
|
|
1225
1517
|
const merged = { ...base };
|
|
1226
|
-
// A profile's "*" entry also covers the ITSM tables
|
|
1227
|
-
// they are merged even without an entry of their
|
|
1518
|
+
// A profile's "*" entry also covers the ITSM tables and the named-only
|
|
1519
|
+
// tables it does not name, so they are merged even without an entry of their
|
|
1520
|
+
// own.
|
|
1228
1521
|
const profileWildcard = Object.hasOwn(configured, FIELD_POLICY_WILDCARD)
|
|
1229
1522
|
? configured[FIELD_POLICY_WILDCARD]
|
|
1230
1523
|
: undefined;
|
|
@@ -1232,13 +1525,15 @@ function mergeFieldPolicyDefinitions(base, configured) {
|
|
|
1232
1525
|
if (profileWildcard !== undefined) {
|
|
1233
1526
|
for (const table of ITSM_TABLES)
|
|
1234
1527
|
tables.add(table);
|
|
1528
|
+
for (const table of NAMED_ONLY_BUILT_INS)
|
|
1529
|
+
tables.add(table);
|
|
1235
1530
|
}
|
|
1236
1531
|
for (const table of tables) {
|
|
1237
1532
|
const definition = Object.hasOwn(configured, table)
|
|
1238
1533
|
? configured[table]
|
|
1239
1534
|
: {};
|
|
1240
1535
|
const existing = merged[table];
|
|
1241
|
-
// Every table but the system tables (ITSM and custom alike) resolves each
|
|
1536
|
+
// Every table but the system tables (ITSM, named-only and custom alike) resolves each
|
|
1242
1537
|
// set from its own entry, then the profile's "*" entry, then the base. A
|
|
1243
1538
|
// named custom table therefore cannot escape a narrowing "*" by stating
|
|
1244
1539
|
// only the other key. System tables never take the "*" entry.
|
|
@@ -1768,11 +2063,11 @@ function normalizePolicyFields(candidates, location) {
|
|
|
1768
2063
|
function issuePreparedAccess(args, table, readableFields) {
|
|
1769
2064
|
const normalizedTable = normalizeTableName(table);
|
|
1770
2065
|
const previous = issuedPreparedEntries(args).filter((entry) => entry.table !== normalizedTable);
|
|
2066
|
+
const hidden = typeHiddenFields(normalizedTable);
|
|
1771
2067
|
const entry = Object.freeze({
|
|
1772
2068
|
table: normalizedTable,
|
|
1773
|
-
readableFields:
|
|
1774
|
-
|
|
1775
|
-
: Object.freeze([...readableFields]),
|
|
2069
|
+
readableFields: preparedSelection(normalizedTable, readableFields, hidden),
|
|
2070
|
+
hiddenFields: Object.freeze([...hidden].sort()),
|
|
1776
2071
|
});
|
|
1777
2072
|
const marker = Object.freeze({
|
|
1778
2073
|
entries: Object.freeze([...previous, entry]),
|