identityscope 0.0.0-stage → 0.28.4
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/LICENSE +21 -0
- package/README.md +916 -2
- package/SECURITY.md +56 -0
- package/dist/core/audit-readiness.d.ts +158 -0
- package/dist/core/audit-readiness.js +357 -0
- package/dist/core/audit-readiness.js.map +1 -0
- package/dist/core/certs.d.ts +68 -0
- package/dist/core/certs.js +132 -0
- package/dist/core/certs.js.map +1 -0
- package/dist/core/checks.d.ts +133 -0
- package/dist/core/checks.js +512 -0
- package/dist/core/checks.js.map +1 -0
- package/dist/core/cloud-rules.d.ts +20 -0
- package/dist/core/cloud-rules.js +44 -0
- package/dist/core/cloud-rules.js.map +1 -0
- package/dist/core/compare.d.ts +45 -0
- package/dist/core/compare.js +372 -0
- package/dist/core/compare.js.map +1 -0
- package/dist/core/conditions.d.ts +10 -0
- package/dist/core/conditions.js +201 -0
- package/dist/core/conditions.js.map +1 -0
- package/dist/core/credentials.d.ts +71 -0
- package/dist/core/credentials.js +211 -0
- package/dist/core/credentials.js.map +1 -0
- package/dist/core/datasets.d.ts +53 -0
- package/dist/core/datasets.js +596 -0
- package/dist/core/datasets.js.map +1 -0
- package/dist/core/definition.d.ts +32 -0
- package/dist/core/definition.js +301 -0
- package/dist/core/definition.js.map +1 -0
- package/dist/core/discover.d.ts +32 -0
- package/dist/core/discover.js +105 -0
- package/dist/core/discover.js.map +1 -0
- package/dist/core/engine.d.ts +18 -0
- package/dist/core/engine.js +290 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/fields.d.ts +16 -0
- package/dist/core/fields.js +132 -0
- package/dist/core/fields.js.map +1 -0
- package/dist/core/governance-trail.d.ts +211 -0
- package/dist/core/governance-trail.js +557 -0
- package/dist/core/governance-trail.js.map +1 -0
- package/dist/core/http-transport.d.ts +66 -0
- package/dist/core/http-transport.js +247 -0
- package/dist/core/http-transport.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +16 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/insights.d.ts +176 -0
- package/dist/core/insights.js +417 -0
- package/dist/core/insights.js.map +1 -0
- package/dist/core/joiner-evidence.d.ts +98 -0
- package/dist/core/joiner-evidence.js +254 -0
- package/dist/core/joiner-evidence.js.map +1 -0
- package/dist/core/lab/credential-map.d.ts +50 -0
- package/dist/core/lab/credential-map.js +163 -0
- package/dist/core/lab/credential-map.js.map +1 -0
- package/dist/core/lab/javadate.d.ts +7 -0
- package/dist/core/lab/javadate.js +307 -0
- package/dist/core/lab/javadate.js.map +1 -0
- package/dist/core/lab/jsonpath.d.ts +11 -0
- package/dist/core/lab/jsonpath.js +273 -0
- package/dist/core/lab/jsonpath.js.map +1 -0
- package/dist/core/lab/policy-preview.d.ts +43 -0
- package/dist/core/lab/policy-preview.js +78 -0
- package/dist/core/lab/policy-preview.js.map +1 -0
- package/dist/core/lab/rfc5646.d.ts +2 -0
- package/dist/core/lab/rfc5646.js +421 -0
- package/dist/core/lab/rfc5646.js.map +1 -0
- package/dist/core/lab/transform-impact.d.ts +63 -0
- package/dist/core/lab/transform-impact.js +138 -0
- package/dist/core/lab/transform-impact.js.map +1 -0
- package/dist/core/lab/transform-people.d.ts +61 -0
- package/dist/core/lab/transform-people.js +132 -0
- package/dist/core/lab/transform-people.js.map +1 -0
- package/dist/core/lab/transforms.d.ts +79 -0
- package/dist/core/lab/transforms.js +738 -0
- package/dist/core/lab/transforms.js.map +1 -0
- package/dist/core/lab/velocity.d.ts +33 -0
- package/dist/core/lab/velocity.js +874 -0
- package/dist/core/lab/velocity.js.map +1 -0
- package/dist/core/lab/workflow-health.d.ts +80 -0
- package/dist/core/lab/workflow-health.js +234 -0
- package/dist/core/lab/workflow-health.js.map +1 -0
- package/dist/core/lab/workflows.d.ts +87 -0
- package/dist/core/lab/workflows.js +568 -0
- package/dist/core/lab/workflows.js.map +1 -0
- package/dist/core/lifecycle-gaps.d.ts +192 -0
- package/dist/core/lifecycle-gaps.js +389 -0
- package/dist/core/lifecycle-gaps.js.map +1 -0
- package/dist/core/logs.d.ts +145 -0
- package/dist/core/logs.js +342 -0
- package/dist/core/logs.js.map +1 -0
- package/dist/core/lookup.d.ts +129 -0
- package/dist/core/lookup.js +289 -0
- package/dist/core/lookup.js.map +1 -0
- package/dist/core/model-insights.d.ts +247 -0
- package/dist/core/model-insights.js +474 -0
- package/dist/core/model-insights.js.map +1 -0
- package/dist/core/narrow.d.ts +23 -0
- package/dist/core/narrow.js +137 -0
- package/dist/core/narrow.js.map +1 -0
- package/dist/core/nerm.d.ts +154 -0
- package/dist/core/nerm.js +397 -0
- package/dist/core/nerm.js.map +1 -0
- package/dist/core/operations-watch.d.ts +232 -0
- package/dist/core/operations-watch.js +491 -0
- package/dist/core/operations-watch.js.map +1 -0
- package/dist/core/output/csv.d.ts +6 -0
- package/dist/core/output/csv.js +22 -0
- package/dist/core/output/csv.js.map +1 -0
- package/dist/core/output/html.d.ts +11 -0
- package/dist/core/output/html.js +66 -0
- package/dist/core/output/html.js.map +1 -0
- package/dist/core/output/xlsx.d.ts +3 -0
- package/dist/core/output/xlsx.js +130 -0
- package/dist/core/output/xlsx.js.map +1 -0
- package/dist/core/output/zip.d.ts +16 -0
- package/dist/core/output/zip.js +106 -0
- package/dist/core/output/zip.js.map +1 -0
- package/dist/core/ownership.d.ts +39 -0
- package/dist/core/ownership.js +100 -0
- package/dist/core/ownership.js.map +1 -0
- package/dist/core/patterns.d.ts +11 -0
- package/dist/core/patterns.js +31 -0
- package/dist/core/patterns.js.map +1 -0
- package/dist/core/preview.d.ts +96 -0
- package/dist/core/preview.js +173 -0
- package/dist/core/preview.js.map +1 -0
- package/dist/core/roles.d.ts +125 -0
- package/dist/core/roles.js +420 -0
- package/dist/core/roles.js.map +1 -0
- package/dist/core/tenant.d.ts +67 -0
- package/dist/core/tenant.js +194 -0
- package/dist/core/tenant.js.map +1 -0
- package/dist/core/threat-signals.d.ts +112 -0
- package/dist/core/threat-signals.js +250 -0
- package/dist/core/threat-signals.js.map +1 -0
- package/dist/core/threat-watch.d.ts +144 -0
- package/dist/core/threat-watch.js +282 -0
- package/dist/core/threat-watch.js.map +1 -0
- package/dist/core/transport.d.ts +82 -0
- package/dist/core/transport.js +312 -0
- package/dist/core/transport.js.map +1 -0
- package/dist/core/types.d.ts +137 -0
- package/dist/core/types.js +10 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/warnings.d.ts +236 -0
- package/dist/core/warnings.js +504 -0
- package/dist/core/warnings.js.map +1 -0
- package/dist/demo/tenant.d.ts +1572 -0
- package/dist/demo/tenant.js +1023 -0
- package/dist/demo/tenant.js.map +1 -0
- package/dist/node/attribute-history.d.ts +22 -0
- package/dist/node/attribute-history.js +86 -0
- package/dist/node/attribute-history.js.map +1 -0
- package/dist/node/changes.d.ts +20 -0
- package/dist/node/changes.js +78 -0
- package/dist/node/changes.js.map +1 -0
- package/dist/node/cli.d.ts +2 -0
- package/dist/node/cli.js +291 -0
- package/dist/node/cli.js.map +1 -0
- package/dist/node/config.d.ts +72 -0
- package/dist/node/config.js +203 -0
- package/dist/node/config.js.map +1 -0
- package/dist/node/credentials.d.ts +13 -0
- package/dist/node/credentials.js +24 -0
- package/dist/node/credentials.js.map +1 -0
- package/dist/node/delivery.d.ts +10 -0
- package/dist/node/delivery.js +105 -0
- package/dist/node/delivery.js.map +1 -0
- package/dist/node/doctor.d.ts +2 -0
- package/dist/node/doctor.js +151 -0
- package/dist/node/doctor.js.map +1 -0
- package/dist/node/drift.d.ts +31 -0
- package/dist/node/drift.js +56 -0
- package/dist/node/drift.js.map +1 -0
- package/dist/node/evidence.d.ts +42 -0
- package/dist/node/evidence.js +129 -0
- package/dist/node/evidence.js.map +1 -0
- package/dist/node/exceptions.d.ts +30 -0
- package/dist/node/exceptions.js +83 -0
- package/dist/node/exceptions.js.map +1 -0
- package/dist/node/history.d.ts +35 -0
- package/dist/node/history.js +74 -0
- package/dist/node/history.js.map +1 -0
- package/dist/node/index.d.ts +7 -0
- package/dist/node/index.js +8 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/keep.d.ts +9 -0
- package/dist/node/keep.js +39 -0
- package/dist/node/keep.js.map +1 -0
- package/dist/node/loader.d.ts +7 -0
- package/dist/node/loader.js +35 -0
- package/dist/node/loader.js.map +1 -0
- package/dist/node/log-files.d.ts +16 -0
- package/dist/node/log-files.js +93 -0
- package/dist/node/log-files.js.map +1 -0
- package/dist/node/monthly.d.ts +41 -0
- package/dist/node/monthly.js +108 -0
- package/dist/node/monthly.js.map +1 -0
- package/dist/node/oauth-login.d.ts +45 -0
- package/dist/node/oauth-login.js +121 -0
- package/dist/node/oauth-login.js.map +1 -0
- package/dist/node/packs.d.ts +32 -0
- package/dist/node/packs.js +43 -0
- package/dist/node/packs.js.map +1 -0
- package/dist/node/privileged-seen.d.ts +11 -0
- package/dist/node/privileged-seen.js +41 -0
- package/dist/node/privileged-seen.js.map +1 -0
- package/dist/node/recipients.d.ts +17 -0
- package/dist/node/recipients.js +51 -0
- package/dist/node/recipients.js.map +1 -0
- package/dist/node/runner.d.ts +51 -0
- package/dist/node/runner.js +298 -0
- package/dist/node/runner.js.map +1 -0
- package/dist/node/runtime.d.ts +12 -0
- package/dist/node/runtime.js +13 -0
- package/dist/node/runtime.js.map +1 -0
- package/dist/node/schedules.d.ts +87 -0
- package/dist/node/schedules.js +141 -0
- package/dist/node/schedules.js.map +1 -0
- package/dist/node/secrets.d.ts +37 -0
- package/dist/node/secrets.js +219 -0
- package/dist/node/secrets.js.map +1 -0
- package/dist/node/support.d.ts +14 -0
- package/dist/node/support.js +133 -0
- package/dist/node/support.js.map +1 -0
- package/dist/node/tenants.d.ts +93 -0
- package/dist/node/tenants.js +255 -0
- package/dist/node/tenants.js.map +1 -0
- package/dist/node/ui-page.d.ts +1 -0
- package/dist/node/ui-page.js +3 -0
- package/dist/node/ui-page.js.map +1 -0
- package/dist/node/ui-server.d.ts +48 -0
- package/dist/node/ui-server.js +2665 -0
- package/dist/node/ui-server.js.map +1 -0
- package/dist/node/write.d.ts +9 -0
- package/dist/node/write.js +53 -0
- package/dist/node/write.js.map +1 -0
- package/dist/reports/builtin.generated.d.ts +1 -0
- package/dist/reports/builtin.generated.js +49 -0
- package/dist/reports/builtin.generated.js.map +1 -0
- package/dist/reports/library.d.ts +6 -0
- package/dist/reports/library.js +18 -0
- package/dist/reports/library.js.map +1 -0
- package/launcher/IdentityScope.cmd +11 -0
- package/package.json +69 -4
- package/reports/access-profile-members.yaml +29 -0
- package/reports/access-profile-membership-counts.yaml +17 -0
- package/reports/access-profiles-without-owner.yaml +16 -0
- package/reports/access-request-audit-trail.yaml +36 -0
- package/reports/accounts-by-source.yaml +19 -0
- package/reports/active-identities-without-manager.yaml +22 -0
- package/reports/aggregation-failures.yaml +29 -0
- package/reports/aggregation-history.yaml +27 -0
- package/reports/all-sources.yaml +16 -0
- package/reports/application-accounts.yaml +32 -0
- package/reports/application-entitlements.yaml +31 -0
- package/reports/campaign-progress.yaml +23 -0
- package/reports/certification-decisions.yaml +31 -0
- package/reports/direct-reports-per-manager.yaml +20 -0
- package/reports/disabled-accounts-of-active-people.yaml +33 -0
- package/reports/duplicate-emails.yaml +16 -0
- package/reports/entitlement-holders.yaml +35 -0
- package/reports/entitlements-held-by-inactive-identities.yaml +31 -0
- package/reports/entitlements-without-owner.yaml +28 -0
- package/reports/identities-by-lifecycle-state.yaml +15 -0
- package/reports/identities-missing-key-attributes.yaml +27 -0
- package/reports/identities-with-processing-errors.yaml +19 -0
- package/reports/identity-attribute-mappings.yaml +27 -0
- package/reports/machine-accounts.yaml +28 -0
- package/reports/managers-and-direct-reports.yaml +23 -0
- package/reports/most-access.yaml +18 -0
- package/reports/new-identities.yaml +24 -0
- package/reports/old-passwords.yaml +35 -0
- package/reports/pending-reviews-by-reviewer.yaml +20 -0
- package/reports/person-access.yaml +31 -0
- package/reports/privileged-access.yaml +29 -0
- package/reports/provisioning-error-causes.yaml +27 -0
- package/reports/provisioning-errors.yaml +32 -0
- package/reports/provisioning-failures.yaml +28 -0
- package/reports/recent-access-requests.yaml +22 -0
- package/reports/recent-activity.yaml +32 -0
- package/reports/recent-leavers.yaml +34 -0
- package/reports/role-members.yaml +29 -0
- package/reports/role-membership-counts.yaml +18 -0
- package/reports/roles-without-owner.yaml +17 -0
- package/reports/sources-needing-attention.yaml +23 -0
- package/reports/stuck-access-requests.yaml +29 -0
- package/reports/team-access.yaml +30 -0
- package/reports/terminated-users-with-active-accounts.yaml +46 -0
- package/reports/uncorrelated-accounts.yaml +38 -0
- package/ui/js/00-setup.js +6 -0
- package/ui/js/01-small-helpers.js +143 -0
- package/ui/js/02-connection.js +150 -0
- package/ui/js/03-health-check.js +17 -0
- package/ui/js/04-library.js +135 -0
- package/ui/js/05-pickers.js +163 -0
- package/ui/js/06-report-view.js +157 -0
- package/ui/js/07-fields.js +85 -0
- package/ui/js/08-designer.js +360 -0
- package/ui/js/09-yaml.js +22 -0
- package/ui/js/10-instant-check.js +171 -0
- package/ui/js/11-lookup.js +161 -0
- package/ui/js/12-tenant.js +115 -0
- package/ui/js/13-source-configuration-and-diagnostics.js +64 -0
- package/ui/js/14-certifications.js +68 -0
- package/ui/js/15-monthly-report.js +24 -0
- package/ui/js/16-ownership.js +39 -0
- package/ui/js/17-compare-tenants.js +102 -0
- package/ui/js/18-audit.js +181 -0
- package/ui/js/19-insights.js +108 -0
- package/ui/js/20-role-mining.js +35 -0
- package/ui/js/21-share-reports.js +45 -0
- package/ui/js/22-partner-overview-all-customer-tenants.js +228 -0
- package/ui/js/23-in-app-guidance.js +217 -0
- package/ui/js/24-role-tools.js +220 -0
- package/ui/js/25-schedules.js +264 -0
- package/ui/js/26-start.js +7 -0
- package/ui/js/27-warnings.js +224 -0
- package/ui/js/28-audit-readiness.js +99 -0
- package/ui/js/29-lifecycle.js +182 -0
- package/ui/js/30-labs.js +265 -0
- package/ui/js/31-build.js +203 -0
- package/ui/js/32-lab-examples.js +148 -0
- package/ui/js/33-finder.js +89 -0
- package/ui/js/34-governance.js +129 -0
- package/ui/js/35-watch.js +266 -0
- package/ui/js/36-model.js +247 -0
- package/ui/js/37-logs-and-watch.js +224 -0
- package/ui/shell.html +112 -0
- package/ui/style.css +350 -0
|
@@ -0,0 +1,1023 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A small made-up ISC tenant: the tests run against it, and the demo mode of the program shows it
|
|
3
|
+
* so the tool can be tried without connecting a real tenant. It implements only the read-only
|
|
4
|
+
* endpoints identityscope uses, with the same paging rules as ISC: list APIs
|
|
5
|
+
* page with limit (max 250) and offset; search pages with limit (max 10,000),
|
|
6
|
+
* sort and searchAfter.
|
|
7
|
+
*/
|
|
8
|
+
import { createHash } from 'node:crypto';
|
|
9
|
+
import { createServer } from 'node:http';
|
|
10
|
+
// The tests use a fixed day. The demo sets IDENTITYSCOPE_DEMO_NOW before this file is loaded, so
|
|
11
|
+
// every date in the made-up data is relative to today.
|
|
12
|
+
export const NOW = new Date(process.env['IDENTITYSCOPE_DEMO_NOW'] || '2026-11-20T12:00:00Z');
|
|
13
|
+
const daysAgo = (n) => new Date(NOW.getTime() - n * 86_400_000).toISOString();
|
|
14
|
+
const daysAhead = (n) => new Date(NOW.getTime() + n * 86_400_000).toISOString();
|
|
15
|
+
export const SOURCES = [
|
|
16
|
+
{ id: 'src-wd', name: 'Workday', type: 'Workday', connectorName: 'Workday', authoritative: true, healthy: true, status: 'SOURCE_STATE_HEALTHY', owner: { type: 'IDENTITY', id: 'id-bob', name: 'Bob Stone' }, modified: daysAgo(40) },
|
|
17
|
+
{ id: 'src-ad', name: 'Active Directory', type: 'Active Directory - Direct', connectorName: 'Active Directory', authoritative: false, beforeProvisioningRule: { type: 'RULE', id: 'rule-bp', name: 'AD Before Provisioning' }, connectorAttributes: { nativeRules: ['AD After Create'] }, healthy: true, status: 'SOURCE_STATE_HEALTHY', owner: { type: 'IDENTITY', id: 'id-frank', name: 'Frank Ito' }, modified: daysAgo(10) },
|
|
18
|
+
{ id: 'src-csv', name: 'HR Extract', type: 'DelimitedFile', connectorName: 'Delimited File', authoritative: false, healthy: false, status: 'SOURCE_STATE_UNCHECKED_SOURCE', owner: { type: 'IDENTITY', id: 'id-bob', name: 'Bob Stone' }, modified: daysAgo(90) },
|
|
19
|
+
{ id: 'src-sf', name: 'Salesforce', type: 'Salesforce', connectorName: 'Salesforce', connectorAttributes: { instanceUrl: 'https://acme.my.salesforce.com', clientId: 'sf-client-1', clientSecret: 'SHOULD-NEVER-LEAK', user: 'svc_isc@acme.com' }, authoritative: false, healthy: false, status: 'SOURCE_STATE_ERROR_ACCOUNT_FILE_IMPORT', owner: null, modified: daysAgo(2) },
|
|
20
|
+
];
|
|
21
|
+
const src = (id) => {
|
|
22
|
+
const s = SOURCES.find((x) => x.id === id);
|
|
23
|
+
return { id: s.id, name: s.name };
|
|
24
|
+
};
|
|
25
|
+
const account = (id, sourceId, name, extra = {}) => ({
|
|
26
|
+
id,
|
|
27
|
+
name,
|
|
28
|
+
accountId: name,
|
|
29
|
+
source: src(sourceId),
|
|
30
|
+
disabled: false,
|
|
31
|
+
locked: false,
|
|
32
|
+
privileged: false,
|
|
33
|
+
manuallyCorrelated: false,
|
|
34
|
+
created: daysAgo(300),
|
|
35
|
+
...extra,
|
|
36
|
+
});
|
|
37
|
+
const ent = (id, sourceId, name, extra = {}) => ({
|
|
38
|
+
id,
|
|
39
|
+
name,
|
|
40
|
+
displayName: name,
|
|
41
|
+
type: 'ENTITLEMENT',
|
|
42
|
+
source: src(sourceId),
|
|
43
|
+
attribute: 'memberOf',
|
|
44
|
+
value: `CN=${name}`,
|
|
45
|
+
privileged: false,
|
|
46
|
+
standalone: false,
|
|
47
|
+
...extra,
|
|
48
|
+
});
|
|
49
|
+
export const NAMED_IDENTITIES = [
|
|
50
|
+
{
|
|
51
|
+
id: 'id-alice',
|
|
52
|
+
name: 'alice',
|
|
53
|
+
displayName: 'Alice Ng',
|
|
54
|
+
email: 'alice@example.com',
|
|
55
|
+
inactive: false,
|
|
56
|
+
attributes: { cloudLifecycleState: 'active', department: 'Finance', endDate: daysAgo(5).slice(0, 10) },
|
|
57
|
+
manager: { id: 'id-bob', name: 'bob', displayName: 'Bob Stone' },
|
|
58
|
+
identityProfile: { id: 'ip1', name: 'Employees' },
|
|
59
|
+
source: src('src-wd'),
|
|
60
|
+
created: daysAgo(12),
|
|
61
|
+
modified: daysAgo(5),
|
|
62
|
+
accessCount: 2,
|
|
63
|
+
accountCount: 3,
|
|
64
|
+
accounts: [
|
|
65
|
+
account('a-alice-wd', 'src-wd', 'W100'),
|
|
66
|
+
account('a-alice-ad', 'src-ad', 'alice', { privileged: true, passwordLastSet: daysAgo(200) }),
|
|
67
|
+
account('a-alice-sf', 'src-sf', 'alice@sf', { disabled: true }),
|
|
68
|
+
],
|
|
69
|
+
access: [
|
|
70
|
+
ent('e-da', 'src-ad', 'Domain Admins', { privileged: true, standalone: true }),
|
|
71
|
+
{ id: 'r-fin', name: 'Finance', displayName: 'Finance', type: 'ROLE', privileged: false },
|
|
72
|
+
{ id: 'ap-fin', name: 'Finance Apps', displayName: 'Finance Apps', type: 'ACCESS_PROFILE', source: src('src-sf'), privileged: false },
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 'id-carl',
|
|
77
|
+
name: 'carl',
|
|
78
|
+
displayName: 'Carl Diaz',
|
|
79
|
+
email: 'carl@example.com',
|
|
80
|
+
inactive: true,
|
|
81
|
+
attributes: { cloudLifecycleState: 'terminated', department: 'Sales' },
|
|
82
|
+
manager: { id: 'id-bob', name: 'bob', displayName: 'Bob Stone' },
|
|
83
|
+
identityProfile: { id: 'ip1', name: 'Employees' },
|
|
84
|
+
source: src('src-wd'),
|
|
85
|
+
created: daysAgo(700),
|
|
86
|
+
modified: daysAgo(3),
|
|
87
|
+
accessCount: 2,
|
|
88
|
+
accounts: [
|
|
89
|
+
account('a-carl-wd', 'src-wd', 'W200'),
|
|
90
|
+
account('a-carl-ad', 'src-ad', 'carl'),
|
|
91
|
+
account('a-carl-sf', 'src-sf', 'carl@sf', { disabled: true }),
|
|
92
|
+
],
|
|
93
|
+
access: [ent('e-vpn', 'src-ad', 'VPN Users'), ent('e-sfa', 'src-sf', 'SF Admin', { privileged: true, standalone: true }), { id: 'ap-vpn', name: 'VPN', displayName: 'VPN', type: 'ACCESS_PROFILE', source: src('src-ad'), privileged: false }, { id: 'idn-org', name: 'ORG_ADMIN', displayName: 'ORG_ADMIN', value: 'ORG_ADMIN', type: 'ENTITLEMENT', source: { id: 'src-idn', name: 'IdentityNow' }, privileged: false }],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'id-dana',
|
|
97
|
+
name: 'dana',
|
|
98
|
+
displayName: 'Dana Fox',
|
|
99
|
+
email: 'dana@example.com',
|
|
100
|
+
inactive: false,
|
|
101
|
+
attributes: { cloudLifecycleState: 'inactive', department: 'IT' },
|
|
102
|
+
manager: { id: 'id-bob', name: 'bob', displayName: 'Bob Stone' },
|
|
103
|
+
identityProfile: { id: 'ip1', name: 'Employees' },
|
|
104
|
+
source: src('src-wd'),
|
|
105
|
+
modified: daysAgo(1),
|
|
106
|
+
processingState: 'ERROR',
|
|
107
|
+
processingDetails: { message: 'Attribute promotion failed for manager', date: daysAgo(1) },
|
|
108
|
+
accounts: [account('a-dana-ad', 'src-ad', 'dana')],
|
|
109
|
+
access: [ent('e-vpn', 'src-ad', 'VPN Users')],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: 'id-eve',
|
|
113
|
+
name: 'eve',
|
|
114
|
+
displayName: 'Eve Ward',
|
|
115
|
+
email: '=HYPERLINK("http://evil.example","click")',
|
|
116
|
+
inactive: false,
|
|
117
|
+
attributes: { cloudLifecycleState: 'active', department: 'Sales', endDate: daysAhead(10).slice(0, 10) },
|
|
118
|
+
manager: null,
|
|
119
|
+
identityProfile: { id: 'ip2', name: 'Contractors' },
|
|
120
|
+
source: src('src-wd'),
|
|
121
|
+
modified: daysAgo(8),
|
|
122
|
+
accounts: [account('a-eve-sf', 'src-sf', 'eve@sf')],
|
|
123
|
+
access: [ent('e-sfu', 'src-sf', 'SF User <script>alert(1)</script>')],
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
export const FILLER_COUNT = 2600;
|
|
127
|
+
export const IDENTITIES = [
|
|
128
|
+
...NAMED_IDENTITIES,
|
|
129
|
+
...Array.from({ length: FILLER_COUNT }, (_, i) => {
|
|
130
|
+
const n = String(i + 1).padStart(4, '0');
|
|
131
|
+
return {
|
|
132
|
+
id: `id-u${n}`,
|
|
133
|
+
name: `user${n}`,
|
|
134
|
+
displayName: `User ${n}`,
|
|
135
|
+
email: i === 1 ? 'user0001@example.com' : `user${n}@example.com`,
|
|
136
|
+
inactive: false,
|
|
137
|
+
// Joiner checks: User 0007 started 5 days ago but is still pre-hire; User 0008 joined 8 days ago, cleanly.
|
|
138
|
+
attributes: { cloudLifecycleState: i === 6 ? 'prehire' : 'active', department: 'Operations' },
|
|
139
|
+
manager: { id: 'id-bob', name: 'bob', displayName: 'Bob Stone' },
|
|
140
|
+
identityProfile: { id: 'ip1', name: 'Employees' },
|
|
141
|
+
source: src('src-wd'),
|
|
142
|
+
created: i === 6 ? daysAgo(10) : i === 7 ? daysAgo(8) : daysAgo(400),
|
|
143
|
+
modified: daysAgo(20),
|
|
144
|
+
accessCount: i === 2 ? 25 : 1,
|
|
145
|
+
// Sample lifecycle gaps: User 0004 has no AD account (missed joiner), User 0005's HR account is
|
|
146
|
+
// disabled while the identity is active, User 0003 has unusual access and a service account.
|
|
147
|
+
accounts: i === 3
|
|
148
|
+
? []
|
|
149
|
+
: i === 6
|
|
150
|
+
? [account(`a-u${n}-wd`, 'src-wd', `W${n}`)]
|
|
151
|
+
: [
|
|
152
|
+
account(`a-u${n}-ad`, 'src-ad', `user${n}`, { passwordLastSet: daysAgo(30) }),
|
|
153
|
+
...(i === 4 ? [account(`a-u${n}-wd`, 'src-wd', `W${n}`, { disabled: true })] : []),
|
|
154
|
+
...(i === 2 ? [account(`a-u${n}-svc`, 'src-ad', `svc_user${n}`, { privileged: true })] : []),
|
|
155
|
+
],
|
|
156
|
+
access: [ent('e-vpn', 'src-ad', 'VPN Users'), ...(i === 2 ? [ent('e-pay', 'src-wd', 'Payroll Admin')] : [])],
|
|
157
|
+
};
|
|
158
|
+
}),
|
|
159
|
+
];
|
|
160
|
+
export const UNCORRELATED = [
|
|
161
|
+
{ id: 'ua1', name: 'svc_backup', nativeIdentity: 'CN=svc_backup', sourceId: 'src-ad', sourceName: 'Active Directory', uncorrelated: true, disabled: false, hasEntitlements: true, isMachine: true, created: daysAgo(400) },
|
|
162
|
+
{ id: 'ua2', name: 'svc_sql', nativeIdentity: 'CN=svc_sql', sourceId: 'src-ad', sourceName: 'Active Directory', uncorrelated: true, disabled: false, hasEntitlements: true, isMachine: true, created: daysAgo(380) },
|
|
163
|
+
{ id: 'ua3', name: 'test01', nativeIdentity: 'CN=test01', sourceId: 'src-ad', sourceName: 'Active Directory', uncorrelated: true, disabled: true, hasEntitlements: false, isMachine: false, created: daysAgo(90) },
|
|
164
|
+
{ id: 'ua4', name: 'old.admin@sf', nativeIdentity: '005xx', sourceId: 'src-sf', sourceName: 'Salesforce', uncorrelated: true, disabled: false, hasEntitlements: true, isMachine: false, created: daysAgo(30), origin: 'AGGREGATED' },
|
|
165
|
+
];
|
|
166
|
+
export const CORRELATED_ACCOUNTS = Array.from({ length: 300 }, (_, i) => ({
|
|
167
|
+
id: `ca${i}`,
|
|
168
|
+
name: `user${i}`,
|
|
169
|
+
sourceId: 'src-ad',
|
|
170
|
+
sourceName: 'Active Directory',
|
|
171
|
+
uncorrelated: false,
|
|
172
|
+
disabled: false,
|
|
173
|
+
...(i === 0 ? { name: 'alice', identityId: 'id-alice', attributes: { title: 'Controller' } } : {}),
|
|
174
|
+
// Sign-in dates for license reclaim: AD FILETIME 200 days ago, ISO 10 days ago, never.
|
|
175
|
+
...(i === 1 ? { created: daysAgo(400), identity: { id: 'id-u0001', name: 'User 0001' }, attributes: { lastLogonTimestamp: String((Date.parse(daysAgo(200)) + 11_644_473_600_000) * 10_000) } } : {}),
|
|
176
|
+
...(i === 2 ? { created: daysAgo(400), attributes: { lastLogonTimestamp: daysAgo(10) } } : {}),
|
|
177
|
+
...(i === 3 ? { created: daysAgo(400), attributes: { lastLogonTimestamp: '0' } } : {}),
|
|
178
|
+
// Account expiry (AD accountExpires FILETIME): one in 5 days, one expired 3 days ago but still enabled.
|
|
179
|
+
...(i === 4 ? { identity: { id: 'id-u0004', name: 'User 0004' }, attributes: { accountExpires: String((Date.parse(daysAhead(5)) + 11_644_473_600_000) * 10_000) } } : {}),
|
|
180
|
+
...(i === 5 ? { attributes: { accountExpires: String((Date.parse(daysAgo(3)) + 11_644_473_600_000) * 10_000) } } : {}),
|
|
181
|
+
}));
|
|
182
|
+
export const ENTITLEMENTS = [
|
|
183
|
+
...Array.from({ length: 600 }, (_, i) => ({
|
|
184
|
+
id: `ent-${i}`,
|
|
185
|
+
name: `Group ${i}`,
|
|
186
|
+
value: `CN=Group ${i}`,
|
|
187
|
+
attribute: 'memberOf',
|
|
188
|
+
source: src('src-ad'),
|
|
189
|
+
owner: { type: 'IDENTITY', id: 'id-frank', name: 'Frank Ito' },
|
|
190
|
+
requestable: true,
|
|
191
|
+
privileged: false,
|
|
192
|
+
created: daysAgo(200),
|
|
193
|
+
})),
|
|
194
|
+
{ id: 'ent-x1', name: 'Domain Admins', value: 'CN=Domain Admins', attribute: 'memberOf', source: src('src-ad'), owner: null, requestable: false, privileged: true, created: daysAgo(900) },
|
|
195
|
+
{ id: 'ent-x2', name: 'SF Admin', value: 'System Administrator', attribute: 'profile', source: src('src-sf'), owner: null, requestable: true, privileged: true, created: daysAgo(100) },
|
|
196
|
+
{ id: 'ent-x3', name: 'SF User', value: 'Standard User', attribute: 'profile', source: src('src-sf'), requestable: true, privileged: false, created: daysAgo(100) },
|
|
197
|
+
];
|
|
198
|
+
export const CAMPAIGNS = [
|
|
199
|
+
{ id: 'c1', name: 'Q3 Manager Review', type: 'MANAGER', status: 'COMPLETED', deadline: daysAgo(30), created: daysAgo(60), totalCertifications: 2, completedCertifications: 2 },
|
|
200
|
+
{ id: 'c2', name: 'Q4 SOX Review', type: 'SEARCH', status: 'ACTIVE', deadline: daysAgo(-10), created: daysAgo(5), totalCertifications: 4, completedCertifications: 1 },
|
|
201
|
+
];
|
|
202
|
+
export const CERTIFICATIONS = [
|
|
203
|
+
{ id: 'cert1', name: 'Bob Stone - Q3', campaign: { id: 'c1', name: 'Q3 Manager Review' }, reviewer: { id: 'id-bob', name: 'Bob Stone', email: 'bob@example.com' }, completed: true, signed: daysAgo(31), due: daysAgo(30) },
|
|
204
|
+
{ id: 'cert2', name: 'Frank Ito - Q3', campaign: { id: 'c1', name: 'Q3 Manager Review' }, reviewer: { id: 'id-frank', name: 'Frank Ito', email: 'frank@example.com' }, completed: true, signed: daysAgo(32), due: daysAgo(30) },
|
|
205
|
+
{ id: 'cert3', name: 'Bob Stone - Q4', campaign: { id: 'c2', name: 'Q4 SOX Review' }, reviewer: { type: 'IDENTITY', id: 'id-bob', name: 'Bob Stone', email: 'bob@example.com' }, completed: false, due: daysAgo(-10), decisionsMade: 3, decisionsTotal: 12 },
|
|
206
|
+
];
|
|
207
|
+
const item = (id, who, type, name, decision, comments, source = 'Active Directory') => ({
|
|
208
|
+
id,
|
|
209
|
+
completed: decision !== null,
|
|
210
|
+
newAccess: false,
|
|
211
|
+
decision,
|
|
212
|
+
comments,
|
|
213
|
+
identitySummary: { id: `is-${id}`, name: who, identityId: `id-${who.toLowerCase()}`, completed: true },
|
|
214
|
+
accessSummary: { access: { type, id: `acc-${id}`, name }, entitlement: type === 'ENTITLEMENT' ? { name, sourceName: source, privileged: false } : null },
|
|
215
|
+
});
|
|
216
|
+
export const REVIEW_ITEMS = {
|
|
217
|
+
cert1: [item('i1', 'Alice Ng', 'ENTITLEMENT', 'Domain Admins', 'APPROVE', 'Needed for on-call'), item('i2', 'Carl Diaz', 'ENTITLEMENT', 'VPN Users', 'REVOKE', 'Left the company')],
|
|
218
|
+
cert2: [item('i3', 'Eve Ward', 'ENTITLEMENT', 'SF User', 'APPROVE', null, 'Salesforce'), item('i4', 'Dana Fox', 'ROLE', 'Finance', null, null)],
|
|
219
|
+
cert3: [item('i5', 'Alice Ng', 'ROLE', 'Finance', 'APPROVE', null), item('i6', 'Dana Fox', 'ENTITLEMENT', 'VPN Users', null, null)],
|
|
220
|
+
};
|
|
221
|
+
export const ACCESS_REQUESTS = [
|
|
222
|
+
{ id: 'ar1', accessRequestId: 'req-1', name: 'SF Admin', type: 'ENTITLEMENT', requestType: 'GRANT_ACCESS', state: 'EXECUTING', requester: { type: 'IDENTITY', id: 'id-alice', name: 'Alice Ng' }, requestedFor: { type: 'IDENTITY', id: 'id-eve', name: 'Eve Ward' }, created: daysAgo(10), modified: daysAgo(9), approvalDetails: [{ status: 'PENDING', currentOwner: { name: 'Bob Stone' } }], errorMessages: [] },
|
|
223
|
+
{ id: 'ar2', accessRequestId: 'req-2', name: 'VPN Users', type: 'ENTITLEMENT', requestType: 'GRANT_ACCESS', state: 'REQUEST_COMPLETED', removeDate: daysAhead(5), requester: { name: 'Dana Fox' }, requestedFor: { type: 'IDENTITY', id: 'id-dana', name: 'Dana Fox' }, created: daysAgo(20), modified: daysAgo(19), approvalDetails: [{ status: 'APPROVED', currentOwner: { name: 'Bob Stone' }, modified: daysAgo(19.75) }] },
|
|
224
|
+
{ id: 'ar3', accessRequestId: 'req-3', name: 'Finance', type: 'ROLE', requestType: 'GRANT_ACCESS', state: 'PROVISIONING_VERIFICATION_PENDING', requester: { name: 'Alice Ng' }, requestedFor: { name: 'Alice Ng' }, created: daysAgo(1), modified: daysAgo(1) },
|
|
225
|
+
{ id: 'ar4', accessRequestId: 'req-4', name: 'Domain Admins', type: 'ENTITLEMENT', requestType: 'GRANT_ACCESS', state: 'PROVISIONING_VERIFICATION_PENDING', requester: { name: 'Alice Ng' }, requestedFor: { name: 'Carl Diaz' }, created: daysAgo(6), modified: daysAgo(6), errorMessages: [{ locale: 'en-US', text: 'Timed out waiting for AD' }] },
|
|
226
|
+
{ id: 'ar5', accessRequestId: 'req-5', name: 'SF Admin', type: 'ENTITLEMENT', requestType: 'GRANT_ACCESS', state: 'REJECTED', requester: { name: 'Dana Fox' }, requestedFor: { name: 'Dana Fox' }, created: daysAgo(30), modified: daysAgo(28), approvalDetails: [{ status: 'REJECTED', currentOwner: { name: 'Frank Ito' }, modified: daysAgo(28) }] },
|
|
227
|
+
{ id: 'ar6', accessRequestId: 'req-6', name: 'VPN Users', type: 'ENTITLEMENT', requestType: 'GRANT_ACCESS', state: 'REQUEST_COMPLETED', removeDate: daysAhead(40), requester: { name: 'Eve Ward' }, requestedFor: { type: 'IDENTITY', id: 'id-eve', name: 'Eve Ward' }, created: daysAgo(40), modified: daysAgo(39.5), approvalDetails: [{ status: 'APPROVED', currentOwner: { name: 'Bob Stone' }, modified: daysAgo(39.875) }] },
|
|
228
|
+
{ id: 'ar7', accessRequestId: 'req-7', name: 'Old Request', type: 'ROLE', requestType: 'GRANT_ACCESS', state: 'REQUEST_COMPLETED', removeDate: daysAgo(3), requester: { name: 'Eve Ward' }, requestedFor: { name: 'Eve Ward' }, created: daysAgo(200), modified: daysAgo(199) },
|
|
229
|
+
];
|
|
230
|
+
export const ROLE_DEFINITIONS = {
|
|
231
|
+
'r-fin': {
|
|
232
|
+
id: 'r-fin',
|
|
233
|
+
name: 'Finance',
|
|
234
|
+
owner: { type: 'IDENTITY', id: 'id-bob', name: 'Bob Stone' },
|
|
235
|
+
enabled: true,
|
|
236
|
+
requestable: true,
|
|
237
|
+
accessProfiles: [{ id: 'ap-fin', type: 'ACCESS_PROFILE', name: 'Finance Apps' }],
|
|
238
|
+
entitlements: [{ id: 'e-vpn', type: 'ENTITLEMENT', name: 'VPN Users' }],
|
|
239
|
+
membership: {
|
|
240
|
+
type: 'STANDARD',
|
|
241
|
+
criteria: { operation: 'OR', children: [{ operation: 'EQUALS', key: { type: 'IDENTITY', property: 'attribute.department' }, stringValue: 'Finance' }] },
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
'r-ops': {
|
|
245
|
+
id: 'r-ops',
|
|
246
|
+
name: 'Operations',
|
|
247
|
+
owner: null,
|
|
248
|
+
enabled: true,
|
|
249
|
+
requestable: false,
|
|
250
|
+
accessProfiles: [{ id: 'ap-vpn', type: 'ACCESS_PROFILE', name: 'VPN' }],
|
|
251
|
+
entitlements: [],
|
|
252
|
+
membership: {
|
|
253
|
+
type: 'STANDARD',
|
|
254
|
+
criteria: {
|
|
255
|
+
operation: 'AND',
|
|
256
|
+
children: [
|
|
257
|
+
{ operation: 'EQUALS', key: { type: 'IDENTITY', property: 'attribute.department' }, stringValue: 'operations' },
|
|
258
|
+
{ operation: 'EQUALS', key: { type: 'ENTITLEMENT', property: 'attribute.memberOf', sourceId: 'src-ad' }, stringValue: 'CN=VPN Users' },
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
export const IDENTITY_PROFILES = [
|
|
265
|
+
{
|
|
266
|
+
id: 'ip1',
|
|
267
|
+
name: 'Employees',
|
|
268
|
+
priority: 10,
|
|
269
|
+
authoritativeSource: { type: 'SOURCE', id: 'src-wd', name: 'Workday' },
|
|
270
|
+
owner: { name: 'Bob Stone' },
|
|
271
|
+
identityAttributeConfig: {
|
|
272
|
+
enabled: true,
|
|
273
|
+
attributeTransforms: [
|
|
274
|
+
{ identityAttributeName: 'email', transformDefinition: { type: 'accountAttribute', attributes: { sourceName: 'Workday', attributeName: 'EMAIL', sourceId: 'src-wd' } } },
|
|
275
|
+
{ identityAttributeName: 'department', transformDefinition: { type: 'reference', attributes: { id: 'Department Lookup', input: { type: 'accountAttribute', attributes: { sourceName: 'Workday', attributeName: 'DEPT' } } } } },
|
|
276
|
+
{
|
|
277
|
+
identityAttributeName: 'cloudLifecycleState',
|
|
278
|
+
transformDefinition: {
|
|
279
|
+
type: 'dateCompare',
|
|
280
|
+
attributes: {
|
|
281
|
+
firstDate: { type: 'dateFormat', attributes: { inputFormat: 'yyyy-MM-dd', outputFormat: 'ISO8601', input: { type: 'accountAttribute', attributes: { sourceName: 'Workday', attributeName: 'START_DATE' } } } },
|
|
282
|
+
secondDate: 'now',
|
|
283
|
+
operator: 'LTE',
|
|
284
|
+
positiveCondition: 'active',
|
|
285
|
+
negativeCondition: 'prehire',
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
{ id: 'ip2', name: 'Contractors', priority: 20, authoritativeSource: { id: 'src-csv', name: 'HR Extract' }, identityAttributeConfig: { attributeTransforms: [{ identityAttributeName: 'email', transformDefinition: { type: 'accountAttribute', attributes: { attributeName: 'mail' } } }] } },
|
|
293
|
+
];
|
|
294
|
+
export const CLUSTERS = [
|
|
295
|
+
{ id: 'cl-1', name: 'Main Cluster', type: 'idn', status: 'NORMAL', operational: true, clientIds: ['va-1', 'va-2'] },
|
|
296
|
+
{ id: 'cl-2', name: 'DMZ Cluster', type: 'idn', status: 'WARNING', operational: true, alertKey: 'CLIENT_STATUS_NOT_CONFIGURED', clientIds: ['va-3'] },
|
|
297
|
+
];
|
|
298
|
+
export const CLIENTS = [
|
|
299
|
+
{ id: 'va-1', clientId: 'va-1', clusterId: 'cl-1', name: 'va-east-1', description: 'VA east 1', status: 'NORMAL', lastSeen: daysAgo(0.001), vaVersion: '2026.11.1', ipAddress: '10.0.0.1', type: 'VA' },
|
|
300
|
+
{ id: 'va-2', clientId: 'va-2', clusterId: 'cl-1', name: 'va-east-2', description: 'VA east 2', status: 'NORMAL', lastSeen: daysAgo(0.001), vaVersion: '2026.11.1', type: 'VA' },
|
|
301
|
+
{ id: 'va-3', clientId: 'va-3', clusterId: 'cl-2', name: 'va-dmz-1', description: 'VA DMZ', status: 'ERROR', lastSeen: daysAgo(2), sinceLastSeen: '2 days', vaVersion: '2026.09.3', type: 'VA' },
|
|
302
|
+
];
|
|
303
|
+
// Workflow definitions for the workflow lab and the credential map.
|
|
304
|
+
export const LEAVER_DEFINITION = {
|
|
305
|
+
start: 'Get Identity',
|
|
306
|
+
steps: {
|
|
307
|
+
'Get Identity': { actionId: 'sp:get-identity', attributes: { 'id.$': '$.trigger.identity.id' }, nextStep: 'Define Variable', type: 'action', versionNumber: 2 },
|
|
308
|
+
'Define Variable': {
|
|
309
|
+
actionId: 'sp:define-variable',
|
|
310
|
+
attributes: { id: 'sp:define-variable', variables: [{ name: 'Short Name', 'variableA.$': '$.trigger.identity.name', transforms: [{ id: 'sp:transform:substring:string', input: { start: 0, length: 3 } }] }] },
|
|
311
|
+
nextStep: 'Is Leaver',
|
|
312
|
+
type: 'Mutation',
|
|
313
|
+
},
|
|
314
|
+
'Is Leaver': { type: 'choice', choiceList: [{ comparator: 'StringEquals', 'variableA.$': '$.trigger.changes[?(@.attribute == "cloudLifecycleState")].newValue', variableB: 'inactive', nextStep: 'HTTP Request' }], defaultStep: 'End Step - Success' },
|
|
315
|
+
'HTTP Request': {
|
|
316
|
+
actionId: 'sp:http',
|
|
317
|
+
attributes: { method: 'POST', url: 'https://acme.service-now.com/api/now/table/incident', authenticationType: 'OAuth', oAuthClientId: 'sn-client-1', oAuthClientSecret: 'SHOULD-NEVER-LEAK', oAuthTokenUrl: 'https://acme.service-now.com/oauth_token.do', jsonRequestBody: { short_description: 'Leaver {{$.trigger.identity.name}} ({{$.defineVariable.shortName}})' } },
|
|
318
|
+
nextStep: 'End Step - Success',
|
|
319
|
+
type: 'action',
|
|
320
|
+
versionNumber: 2,
|
|
321
|
+
},
|
|
322
|
+
'End Step - Success': { type: 'success' },
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
/** Configuration objects compared between tenants. */
|
|
326
|
+
export const EXECUTIONS = { maxPage: 250, onlyFiltered: false };
|
|
327
|
+
/** Cloud rules as an SP-Config export returns them, and the exports started (to check the body). */
|
|
328
|
+
export const SP_CONFIG = {
|
|
329
|
+
started: [],
|
|
330
|
+
polls: 0,
|
|
331
|
+
rules: [
|
|
332
|
+
{ id: 'rule-bp', name: 'AD Before Provisioning', type: 'BeforeProvisioning', description: 'Sets the OU', signature: { input: [], output: null }, sourceCode: { version: '1.0', script: 'import sailpoint.object.*;\nplan.add("ou", "Users");\nreturn plan;' } },
|
|
333
|
+
{ id: 'rule-cpd', name: 'Cloud Promote Department', type: 'IdentityAttribute', description: 'Department from HR', signature: { input: [], output: null }, sourceCode: { version: '1.0', script: 'return link.getAttribute("DEPT");' } },
|
|
334
|
+
],
|
|
335
|
+
};
|
|
336
|
+
export const CONNECTOR_RULES = [
|
|
337
|
+
{ id: 'cr-1', name: 'AD After Create', type: 'ConnectorAfterCreate', signature: { input: [], output: null }, sourceCode: { version: '1.0', script: 'import java.util.*;\nlog.info("created " + plan);\nreturn null;' }, created: daysAgo(90) },
|
|
338
|
+
];
|
|
339
|
+
export const NERM_DATA = {
|
|
340
|
+
profile_types: [{ id: 'pt1', name: 'Contractor', category: 'non-employee', isc_synced: true }],
|
|
341
|
+
ne_attributes: [
|
|
342
|
+
{ uid: 'end_date', label: 'End Date', type: 'DateAttribute', date_format: 'mm/dd/yyyy' },
|
|
343
|
+
{ uid: 'sponsor', label: 'Sponsor', type: 'OwnerSelectAttribute' },
|
|
344
|
+
],
|
|
345
|
+
profiles: [
|
|
346
|
+
{ id: 'np1', name: 'Vera Vendor', profile_type_id: 'pt1', status: 'Active', attributes: { end_date: '01/01/2020', sponsor: 'Carl Diaz (carl@example.com)' } },
|
|
347
|
+
{ id: 'np2', name: 'Tom Temp', profile_type_id: 'pt1', status: 'Active', attributes: { end_date: '12/31/2099', sponsor: 'Alice Ng (alice@example.com)' } },
|
|
348
|
+
],
|
|
349
|
+
users: [{ id: 'nu1', name: 'Carl Diaz', email: 'carl@example.com', status: 'Active', type: 'NeprofileUser', sailpoint_identity_id: 'id-carl' }],
|
|
350
|
+
workflow_sessions: [{ id: 'ns1', workflow_id: 'w1', status: 'pending_approval' }],
|
|
351
|
+
risk_levels: [{ id: 'rl1', label: 'High', points: 3 }],
|
|
352
|
+
risk_scores: [{ object_type: 'Profile', object_id: 'np1', overall_score: 80, overall_risk_level_id: 'rl1' }],
|
|
353
|
+
};
|
|
354
|
+
export const CONFIG_LISTS = {
|
|
355
|
+
'/identity-attributes/v1': [
|
|
356
|
+
{ name: 'department', displayName: 'Department', standard: false, type: 'string', multi: false, searchable: true, system: false, sources: [{ type: 'rule', properties: { ruleType: 'IdentityAttribute', ruleName: 'Cloud Promote Department' } }] },
|
|
357
|
+
{ name: 'email', displayName: 'Email', standard: true, type: 'string', multi: false, searchable: true, system: false },
|
|
358
|
+
],
|
|
359
|
+
'/machine-accounts/v1': [
|
|
360
|
+
{ id: 'ma-1', name: 'svc-backup', source: { id: 'src-ad', name: 'Active Directory' }, subtype: { displayName: 'Service account' }, ownerIdentity: { id: 'id-carl', name: 'Carl Diaz' }, enabled: true, hasEntitlements: true, lastUsedAt: daysAgo(200) },
|
|
361
|
+
{ id: 'ma-2', name: 'svc-reports', source: { id: 'src-ad', name: 'Active Directory' }, enabled: true, hasEntitlements: true, lastUsedAt: daysAgo(3) },
|
|
362
|
+
],
|
|
363
|
+
'/access-profiles/v1': [
|
|
364
|
+
{ id: 'ap-vpn', name: 'VPN', requestable: true, owner: { type: 'IDENTITY', id: 'id-bob', name: 'Bob Stone' }, source: { id: 'src-ad', name: 'Active Directory' }, accessRequestConfig: { commentsRequired: true, approvalSchemes: [{ approverType: 'MANAGER', approverId: null }, { approverType: 'GOVERNANCE_GROUP', approverId: 'wg-1' }] }, revocationRequestConfig: { approvalSchemes: [{ approverType: 'OWNER', approverId: null }] } },
|
|
365
|
+
{ id: 'ap-fin', name: 'Finance Apps', requestable: true, source: { id: 'src-sf', name: 'Salesforce' }, accessRequestConfig: { approvalSchemes: [] } },
|
|
366
|
+
],
|
|
367
|
+
'/roles/v1': [{ id: 'role-fin', name: 'Finance', requestable: true, owner: { type: 'IDENTITY', id: 'id-frank', name: 'Frank Ito' }, accessRequestConfig: { approvalSchemes: [{ approverType: 'GOVERNANCE_GROUP', approverId: 'wg-gone' }] } }],
|
|
368
|
+
'/workgroups/v1': [{ id: 'wg-1', name: 'IAM Team', description: 'Approves IAM changes', owner: { type: 'IDENTITY', id: 'id-bob', name: 'Bob Stone' }, memberCount: 3 }],
|
|
369
|
+
'/sod-policies/v1': [{ id: 'sod-1', name: 'Payroll vs Finance', description: 'Pay and approve', state: 'ENFORCED', type: 'CONFLICTING_ACCESS_BASED', violationOwnerAssignmentConfig: { assignmentRule: 'MANAGER' } }],
|
|
370
|
+
'/password-policies/v1': [{ id: 'pp-1', name: 'Default', minLength: 12, requireStrongAuthn: true }],
|
|
371
|
+
'/trigger-subscriptions/v1': [{ id: 'ts-1', name: 'Leaver webhook', triggerId: 'idn:identity-attributes-changed', type: 'HTTP', enabled: true, httpConfig: { url: 'https://hooks.acme.com/leaver', httpAuthenticationType: 'BASIC_AUTH', basicAuthConfig: { userName: 'svc', password: 'SHOULD-NEVER-LEAK' } } }],
|
|
372
|
+
'/notification-templates/v1': [{ id: 'nt-1', key: 'cloud_manual_tasks', medium: 'EMAIL', locale: 'en', name: 'Manual task', subject: 'Task for ${name}', body: '<p>Hello</p>\n<p>Please act.</p>' }],
|
|
373
|
+
'/segments/v1': [{ id: 'sg-1', name: 'Finance only', description: 'Finance access', active: true, owner: { type: 'IDENTITY', id: 'id-bob', name: 'Bob Stone' } }],
|
|
374
|
+
};
|
|
375
|
+
export const FORM_DEFINITIONS = { count: 1, results: [{ id: 'fd-1', name: 'Manager approval', description: 'Approve leaver', formElements: [{ id: 'e1', elementType: 'TEXT', key: 'reason' }] }] };
|
|
376
|
+
export const WORKFLOWS = [
|
|
377
|
+
{ id: 'wf-1', name: 'Leaver notification', enabled: true, owner: { name: 'Bob Stone' }, trigger: { type: 'EVENT', attributes: { id: 'idn:identity-attributes-changed' } }, executionCount: 40, failureCount: 3, definition: LEAVER_DEFINITION },
|
|
378
|
+
{
|
|
379
|
+
id: 'wf-2',
|
|
380
|
+
name: 'Old test flow',
|
|
381
|
+
enabled: false,
|
|
382
|
+
owner: { name: 'Frank Ito' },
|
|
383
|
+
trigger: { type: 'EXTERNAL' },
|
|
384
|
+
executionCount: 2,
|
|
385
|
+
failureCount: 0,
|
|
386
|
+
definition: {
|
|
387
|
+
start: 'Call ISC',
|
|
388
|
+
steps: {
|
|
389
|
+
'Call ISC': { actionId: 'sp:http', attributes: { method: 'GET', url: 'https://acme-sb.api.identitynow.com/v3/sources', authenticationType: 'OAuth', oAuthClientId: 'isc-client-x', oAuthClientSecret: 'SHOULD-NEVER-LEAK', oAuthTokenUrl: 'https://acme-sb.api.identitynow.com/oauth/token' }, nextStep: 'Ticket', type: 'action', versionNumber: 2 },
|
|
390
|
+
Ticket: { actionId: 'sp:http', attributes: { method: 'POST', url: 'https://acme.service-now.com/api/now/table/task', parameterStorageCredentialId: 'param-sn' }, nextStep: 'Done', type: 'action', versionNumber: 3 },
|
|
391
|
+
Done: { type: 'success' },
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
];
|
|
396
|
+
/** history-v2 documents of two real runs of the leaver workflow. */
|
|
397
|
+
const historyOf = (input, executed, status) => ({
|
|
398
|
+
definition: LEAVER_DEFINITION,
|
|
399
|
+
status,
|
|
400
|
+
history: [
|
|
401
|
+
{ type: 'WorkflowExecutionStarted', timestamp: daysAgo(1), attributes: { input } },
|
|
402
|
+
...executed.flatMap((n) => [
|
|
403
|
+
{ type: 'ActivityTaskScheduled', timestamp: daysAgo(1), attributes: { displayName: n } },
|
|
404
|
+
{ type: 'ActivityTaskCompleted', timestamp: daysAgo(1), attributes: { displayName: n, result: n === 'Get Identity' ? { id: 'id-dana', name: 'dana' } : {} } },
|
|
405
|
+
]),
|
|
406
|
+
{ type: 'WorkflowExecutionCompleted', timestamp: daysAgo(1), attributes: {} },
|
|
407
|
+
],
|
|
408
|
+
});
|
|
409
|
+
const failedHistory = (request, user) => ({
|
|
410
|
+
status: 'Failed',
|
|
411
|
+
history: [
|
|
412
|
+
{ type: 'WorkflowExecutionStarted', timestamp: daysAgo(1), attributes: { input: {} } },
|
|
413
|
+
{ type: 'ActivityTaskScheduled', timestamp: daysAgo(1), attributes: { displayName: 'Call ISC' } },
|
|
414
|
+
{ type: 'ActivityTaskFailed', timestamp: daysAgo(1), attributes: { displayName: 'Call ISC', error: `HTTP 401 Unauthorized: token for "${user}" rejected (request ${request})` } },
|
|
415
|
+
{ type: 'WorkflowExecutionFailed', timestamp: daysAgo(1), attributes: {} },
|
|
416
|
+
],
|
|
417
|
+
});
|
|
418
|
+
export const WORKFLOW_HISTORY = {
|
|
419
|
+
'run-9': failedHistory('88421', 'isc-client-x'),
|
|
420
|
+
'run-10': failedHistory('99107', 'isc-client-y'),
|
|
421
|
+
'run-11': failedHistory('10233', 'isc-client-x'),
|
|
422
|
+
'run-1': historyOf({ identity: { id: 'id-dana', name: 'dana' }, changes: [{ attribute: 'cloudLifecycleState', oldValue: 'active', newValue: 'inactive' }] }, ['Get Identity', 'Define Variable', 'Is Leaver', 'HTTP Request'], 'Completed'),
|
|
423
|
+
'run-2': historyOf({ identity: { id: 'id-eve', name: 'eve' }, changes: [{ attribute: 'department', oldValue: 'Sales', newValue: 'IT' }] }, ['Get Identity', 'Define Variable', 'Is Leaver'], 'Completed'),
|
|
424
|
+
};
|
|
425
|
+
export const WORKFLOW_RUNS = {
|
|
426
|
+
'wf-1': [
|
|
427
|
+
{ id: 'run-1', workflowId: 'wf-1', status: 'Failed', startTime: daysAgo(0.2), closeTime: daysAgo(0.19) },
|
|
428
|
+
{ id: 'run-2', workflowId: 'wf-1', status: 'Completed', startTime: daysAgo(0.5), closeTime: daysAgo(0.49) },
|
|
429
|
+
{ id: 'run-3', workflowId: 'wf-1', status: 'Failed', startTime: daysAgo(3), closeTime: daysAgo(3) },
|
|
430
|
+
],
|
|
431
|
+
'wf-2': [
|
|
432
|
+
{ id: 'run-9', workflowId: 'wf-2', status: 'Failed', startTime: daysAgo(1), closeTime: daysAgo(1) },
|
|
433
|
+
{ id: 'run-10', workflowId: 'wf-2', status: 'Failed', startTime: daysAgo(2), closeTime: daysAgo(2) },
|
|
434
|
+
{ id: 'run-11', workflowId: 'wf-2', status: 'Failed', startTime: daysAgo(9), closeTime: daysAgo(9) },
|
|
435
|
+
],
|
|
436
|
+
};
|
|
437
|
+
// API credentials. 'test-client' is the token the tests connect with (owned by Alice).
|
|
438
|
+
export const PERSONAL_ACCESS_TOKENS = [
|
|
439
|
+
{ id: 'test-client', name: 'IdentityScope reporting', owner: { type: 'IDENTITY', id: 'id-alice', name: 'alice' }, scope: ['sp:search:read', 'idn:sources:read'], created: daysAgo(80), lastUsed: daysAgo(0), expirationDate: daysAhead(10), managed: false },
|
|
440
|
+
{ id: 'pat-carl', name: 'Carl scripts', owner: { type: 'IDENTITY', id: 'id-carl', name: 'carl' }, scope: ['sp:scopes:all'], created: daysAgo(400), lastUsed: daysAgo(2), expirationDate: null, userAwareTokenNeverExpires: true, managed: false },
|
|
441
|
+
{ id: 'pat-old', name: 'Migration 2025', owner: { type: 'IDENTITY', id: 'id-eve', name: 'eve' }, scope: ['sp:search:read'], created: daysAgo(300), lastUsed: daysAgo(40), expirationDate: daysAgo(5), managed: false },
|
|
442
|
+
{ id: 'pat-unused', name: 'Test token', owner: { type: 'IDENTITY', id: 'id-eve', name: 'eve' }, scope: ['sp:search:read'], created: daysAgo(200), lastUsed: null, expirationDate: daysAhead(300), managed: false },
|
|
443
|
+
{ id: 'pat-wf', name: 'Workflow token', owner: { type: 'IDENTITY', id: 'id-alice', name: 'alice' }, scope: null, created: daysAgo(30), lastUsed: daysAgo(1), expirationDate: null, managed: true },
|
|
444
|
+
{ id: 'pat-ghost', name: 'Old integration', owner: { type: 'IDENTITY', id: 'id-gone', name: 'Ghost User' }, scope: ['idn:accounts:read'], created: daysAgo(100), lastUsed: daysAgo(3), expirationDate: daysAhead(20), managed: false },
|
|
445
|
+
];
|
|
446
|
+
export const OAUTH_CLIENTS = [
|
|
447
|
+
{ id: 'oc-report', name: 'Reporting integration', enabled: true, created: daysAgo(100), lastUsed: daysAgo(1), scope: ['sp:search:read'], grantTypes: ['CLIENT_CREDENTIALS'], type: 'CONFIDENTIAL', secret: 'SHOULD-NEVER-LEAK' },
|
|
448
|
+
{ id: 'oc-siem', name: 'Old SIEM', enabled: true, created: daysAgo(500), lastUsed: daysAgo(300), scope: ['sp:scopes:all'], grantTypes: ['CLIENT_CREDENTIALS'], type: 'CONFIDENTIAL' },
|
|
449
|
+
{ id: 'oc-off', name: 'Retired portal', enabled: false, created: daysAgo(600), lastUsed: daysAgo(400), scope: ['sp:scopes:default'], grantTypes: ['AUTHORIZATION_CODE'], type: 'CONFIDENTIAL' },
|
|
450
|
+
];
|
|
451
|
+
// Account attributes for the transform lab's "matches ISC" check.
|
|
452
|
+
/** Lifecycle states per identity profile: what a joiner (and leaver) is configured to do. */
|
|
453
|
+
export const LIFECYCLE_STATES = {
|
|
454
|
+
ip1: [
|
|
455
|
+
{ id: 'ls-active', name: 'Active', technicalName: 'active', enabled: true, accessProfileIds: [], accountActions: [{ action: 'ENABLE', sourceIds: ['src-ad'] }] },
|
|
456
|
+
{ id: 'ls-prehire', name: 'Pre-hire', technicalName: 'prehire', enabled: true, accessProfileIds: [], accountActions: [] },
|
|
457
|
+
{ id: 'ls-inactive', name: 'Inactive', technicalName: 'inactive', enabled: true, accessProfileIds: [], accountActions: [{ action: 'DISABLE', sourceIds: ['src-ad', 'src-sf'] }] },
|
|
458
|
+
],
|
|
459
|
+
};
|
|
460
|
+
export const LAB_ACCOUNT_ATTRIBUTES = {
|
|
461
|
+
'a-u0007-wd': { START_DATE: daysAgo(5).slice(0, 10) },
|
|
462
|
+
'a-alice-wd': { EMAIL: 'alice@example.com', DEPT: 'IT', firstName: 'alice', lastName: 'NG' },
|
|
463
|
+
'a-carl-wd': { EMAIL: 'carl@example.com', DEPT: 'Sales', firstName: 'Carl', lastName: 'diaz' },
|
|
464
|
+
};
|
|
465
|
+
export const TRANSFORMS = [
|
|
466
|
+
{ id: 'tr-1', name: 'Department Lookup', type: 'lookup', internal: false, attributes: { table: { IT: 'Information Technology' } } },
|
|
467
|
+
{ id: 'tr-2', name: 'Email Lower', type: 'lower', internal: false, attributes: { input: { type: 'reference', attributes: { id: 'Department Lookup' } } } },
|
|
468
|
+
{ id: 'tr-3', name: 'Unused Trim', type: 'trim', internal: false, attributes: {} },
|
|
469
|
+
];
|
|
470
|
+
/** Provisioning policies per source (account create preview, transform impact). */
|
|
471
|
+
export const PROVISIONING_POLICIES = {
|
|
472
|
+
'src-ad': [
|
|
473
|
+
{
|
|
474
|
+
name: 'Account',
|
|
475
|
+
usageType: 'CREATE',
|
|
476
|
+
fields: [
|
|
477
|
+
{ name: 'sAMAccountName', transform: { type: 'identityAttribute', attributes: { name: 'uid' } }, isRequired: true, type: 'string' },
|
|
478
|
+
{ name: 'mail', transform: { type: 'identityAttribute', attributes: { name: 'email' } }, isRequired: true, type: 'string' },
|
|
479
|
+
{ name: 'department', transform: { type: 'reference', attributes: { id: 'Email Lower', input: { type: 'identityAttribute', attributes: { name: 'department' } } } }, isRequired: false, type: 'string' },
|
|
480
|
+
{ name: 'password', transform: { type: 'generator', attributes: { name: 'Create Password' } }, isRequired: true, type: 'secret' },
|
|
481
|
+
{ name: 'description', isRequired: false, type: 'string' },
|
|
482
|
+
{ name: 'distinguishedName', transform: { type: 'static', attributes: { cn: { type: 'identityAttribute', attributes: { name: 'displayName' } }, value: 'CN=$cn,OU=Users,DC=acme,DC=com' } }, isRequired: true, type: 'string' },
|
|
483
|
+
],
|
|
484
|
+
},
|
|
485
|
+
{ name: 'Disable', usageType: 'DISABLE', fields: [] },
|
|
486
|
+
],
|
|
487
|
+
};
|
|
488
|
+
export const SOURCE_DETAILS = {
|
|
489
|
+
'src-ad': {
|
|
490
|
+
id: 'src-ad',
|
|
491
|
+
name: 'Active Directory',
|
|
492
|
+
connectorAttributes: { host: 'dc1.corp.example.com', user: 'CORP\\svc_isc', password: '2:ABCDEFG%%encryptedvalue', domainSettings: [{ domain: 'corp.example.com', password: 'secret-pw' }] },
|
|
493
|
+
cluster: { id: 'cl-1', name: 'Main Cluster' },
|
|
494
|
+
},
|
|
495
|
+
};
|
|
496
|
+
export const SEARCH_INDEXES = {
|
|
497
|
+
identities: IDENTITIES,
|
|
498
|
+
entitlements: [],
|
|
499
|
+
roles: [
|
|
500
|
+
{ id: 'r-fin', name: 'Finance', enabled: true, requestable: true, owner: { name: 'Bob Stone' }, accessProfileCount: 1, entitlementCount: 2, accessProfiles: [{ id: 'ap-fin', name: 'Finance Apps' }] },
|
|
501
|
+
{ id: 'r-ops', name: 'Operations', enabled: true, requestable: false, owner: null, accessProfileCount: 0, entitlementCount: 1, modified: daysAgo(50), accessProfiles: [{ id: 'ap-vpn', name: 'VPN' }] },
|
|
502
|
+
],
|
|
503
|
+
accessprofiles: [
|
|
504
|
+
{ id: 'ap-fin', name: 'Finance Apps', enabled: true, requestable: true, owner: { name: 'Bob Stone' }, source: src('src-sf'), entitlementCount: 1, entitlements: [{ id: 'ent-x3', name: 'SF User', source: src('src-sf') }] },
|
|
505
|
+
{ id: 'ap-vpn', name: 'VPN', enabled: true, requestable: true, source: src('src-ad'), entitlementCount: 1, modified: daysAgo(70), entitlements: [{ id: 'e-vpn', name: 'VPN Users', source: src('src-ad') }] },
|
|
506
|
+
],
|
|
507
|
+
accountactivities: [
|
|
508
|
+
{ id: 'aa1', action: 'Create Account', status: 'FAILED', stage: 'Completed', recipient: { id: 'id-alice', name: 'Alice Ng' }, requester: { name: 'System' }, sources: 'Salesforce', errors: ['Duplicate username alice@sf.example.com'], created: daysAgo(0.3), trackingNumber: 'tr1' },
|
|
509
|
+
{ id: 'aa4', action: 'Create Account', status: 'FAILED', stage: 'Completed', recipient: { id: 'id-eve', name: 'Eve Ward' }, requester: { name: 'System' }, sources: 'Salesforce', errors: ['Duplicate username eve@sf.example.com'], created: daysAgo(0.25), trackingNumber: 'tr4' },
|
|
510
|
+
{ id: 'aa2', action: 'Disable Account', status: 'COMPLETE', stage: 'Completed', recipient: { id: 'id-carl', name: 'Carl Diaz' }, sources: 'Active Directory', errors: [], created: daysAgo(0.2), modified: daysAgo(0.1), accountRequests: [{ op: 'Disable', provisioningTarget: { name: 'Active Directory' }, result: { status: 'COMMITTED' } }] },
|
|
511
|
+
{ id: 'aa5', action: 'Disable Account', status: 'PENDING', stage: 'Committed', recipient: { id: 'id-dana', name: 'Dana Fox' }, sources: 'Salesforce', errors: [], created: daysAgo(2), modified: daysAgo(2), accountRequests: [{ op: 'Disable', provisioningTarget: { name: 'Salesforce' }, result: { status: 'PENDING' } }] },
|
|
512
|
+
{ id: 'aa6', action: 'Delete Account', status: 'COMPLETE', stage: 'Completed', recipient: { id: 'id-carl', name: 'Carl Diaz' }, sources: 'Salesforce', errors: [], created: daysAgo(6), modified: daysAgo(3), accountRequests: [{ op: 'Delete', provisioningTarget: { name: 'Salesforce' }, result: { status: 'COMMITTED' } }] },
|
|
513
|
+
{ id: 'aa7', action: 'Lifecycle State Refresh', status: 'FAILED', stage: 'Completed', recipient: { id: 'id-u0004', name: 'User 0004' }, requester: { name: 'System' }, sources: 'Active Directory', errors: ['Password does not meet the domain policy'], created: daysAgo(30), accountRequests: [{ op: 'Create', provisioningTarget: { name: 'Active Directory' }, source: { id: 'src-ad', name: 'Active Directory' }, result: { status: 'FAILED', errors: ['Password does not meet the domain policy'] } }] },
|
|
514
|
+
{ id: 'aa8', action: 'Lifecycle State Refresh', status: 'COMPLETE', stage: 'Completed', recipient: { id: 'id-u0008', name: 'User 0008' }, requester: { name: 'System' }, sources: 'Active Directory', errors: [], created: daysAgo(7.5), accountRequests: [{ op: 'Create', provisioningTarget: { name: 'Active Directory' }, source: { id: 'src-ad', name: 'Active Directory' }, result: { status: 'COMMITTED' } }] },
|
|
515
|
+
{ id: 'aa3', action: 'Modify Account', status: 'FAILED', stage: 'Completed', recipient: { id: 'id-dana', name: 'Dana Fox' }, sources: 'Active Directory', errors: ['Timed out'], created: daysAgo(4) },
|
|
516
|
+
],
|
|
517
|
+
events: [
|
|
518
|
+
{ id: 'ev4', name: 'Aggregate Source Account Failed', type: 'SOURCE_MANAGEMENT', status: 'FAILED', technicalName: 'SOURCE_ACCOUNT_AGGREGATE_FAILED', actor: { name: 'Scheduler' }, operation: 'AGGREGATE', target: { name: 'Salesforce [source]' }, created: daysAgo(0.4), attributes: { sourceName: 'Salesforce', errors: 'Login failed' } },
|
|
519
|
+
{ id: 'ev5', name: 'Aggregate Source Account Passed', type: 'SOURCE_MANAGEMENT', status: 'PASSED', technicalName: 'SOURCE_ACCOUNT_AGGREGATE_PASSED', actor: { name: 'Scheduler' }, operation: 'AGGREGATE', target: { name: 'Active Directory [source]' }, created: daysAgo(0.6), attributes: { sourceName: 'Active Directory' } },
|
|
520
|
+
{ id: 'ev6', name: 'Aggregate Source Account Passed', type: 'SOURCE_MANAGEMENT', status: 'PASSED', technicalName: 'SOURCE_ACCOUNT_AGGREGATE_PASSED', actor: { name: 'Scheduler' }, operation: 'AGGREGATE', target: { name: 'Active Directory [source]' }, created: daysAgo(1.6), attributes: { sourceName: 'Active Directory' } },
|
|
521
|
+
{ id: 'ev1', name: 'Create Account Failed', type: 'PROVISIONING', status: 'FAILED', technicalName: 'ACCOUNT_CREATE_FAILED', actor: { name: 'System' }, target: { name: 'alice' }, created: daysAgo(2), trackingNumber: 't1' },
|
|
522
|
+
{ id: 'ev2', name: 'Add Entitlement Passed', type: 'ACCESS_ITEM', status: 'PASSED', technicalName: 'ENTITLEMENT_ADD_PASSED', actor: { name: 'Alice Ng' }, target: { name: 'dana' }, created: daysAgo(0.5) },
|
|
523
|
+
{ id: 'ev7', name: 'Create Account Failed', type: 'PROVISIONING', status: 'FAILED', technicalName: 'ACCOUNT_CREATE_FAILED', actor: { name: 'System' }, target: { name: 'user0004' }, created: daysAgo(30), attributes: { sourceName: 'Active Directory', errors: 'Password does not meet the domain policy' } },
|
|
524
|
+
{ id: 'ev8', name: 'Change Identity Lifecycle State Passed', type: 'IDENTITY_MANAGEMENT', status: 'PASSED', technicalName: 'IDENTITY_LIFECYCLE_CHANGE_PASSED', actor: { name: 'System' }, target: { name: 'user0008' }, created: daysAgo(7.6), attributes: { cloudLifecycleStateBefore: 'prehire', cloudLifecycleStateAfter: 'active' } },
|
|
525
|
+
{ id: 'ev3', name: 'Disable Account Failed', type: 'PROVISIONING', status: 'FAILED', technicalName: 'ACCOUNT_DISABLE_FAILED', actor: { name: 'System' }, target: { name: 'carl' }, created: daysAgo(20) },
|
|
526
|
+
],
|
|
527
|
+
};
|
|
528
|
+
SEARCH_INDEXES['entitlements'] = ENTITLEMENTS;
|
|
529
|
+
function matchFilter(doc, filters) {
|
|
530
|
+
if (!filters)
|
|
531
|
+
return true;
|
|
532
|
+
// Supports the "field eq value" filters identityscope and the tests send.
|
|
533
|
+
for (const raw0 of filters.split(/\s+and\s+/i)) {
|
|
534
|
+
const part = raw0.trim().replace(/^\((.*)\)$/, '$1');
|
|
535
|
+
const inList = /^([\w.]+)\s+in\s+\((.*)\)$/.exec(part.trim());
|
|
536
|
+
if (inList) {
|
|
537
|
+
const wanted = JSON.parse(`[${inList[2]}]`);
|
|
538
|
+
const actual = inList[1].split('.').reduce((o, k) => o?.[k], doc);
|
|
539
|
+
if (!wanted.includes(actual))
|
|
540
|
+
return false;
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
// "created ge 2026-01-01T00:00:00Z": date comparisons, as ISC documents for created and modified.
|
|
544
|
+
const cmp = /^([\w.]+)\s+(ge|gt|le|lt)\s+"?([^"\s]+)"?$/.exec(part.trim());
|
|
545
|
+
if (cmp) {
|
|
546
|
+
const actual = Date.parse(String(cmp[1].split('.').reduce((o, k) => o?.[k], doc) ?? ''));
|
|
547
|
+
const wanted = Date.parse(cmp[3]);
|
|
548
|
+
if (!Number.isFinite(actual) || !Number.isFinite(wanted))
|
|
549
|
+
return false;
|
|
550
|
+
if (cmp[2] === 'ge' ? actual < wanted : cmp[2] === 'gt' ? actual <= wanted : cmp[2] === 'le' ? actual > wanted : actual >= wanted)
|
|
551
|
+
return false;
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
const m = /^([\w.]+)\s+eq\s+(.+)$/.exec(part.trim());
|
|
555
|
+
if (!m)
|
|
556
|
+
throw Object.assign(new Error(`unsupported filter ${part}`), { status: 400 });
|
|
557
|
+
const [, field, raw] = m;
|
|
558
|
+
const expected = raw.startsWith('"') ? JSON.parse(raw) : raw === 'true' ? true : raw === 'false' ? false : raw;
|
|
559
|
+
const actual = field.split('.').reduce((o, k) => o?.[k], doc);
|
|
560
|
+
if (actual !== expected)
|
|
561
|
+
return false;
|
|
562
|
+
}
|
|
563
|
+
return true;
|
|
564
|
+
}
|
|
565
|
+
function lexQuery(q) {
|
|
566
|
+
const out = [];
|
|
567
|
+
const re = /\s*(?:(\()|(\))|@(\w+)\(|((?:[^\s()":]|\\.)+:(?:"(?:[^"\\]|\\.)*"|(?=\()|[^\s()]+)|"(?:[^"\\]|\\.)*"|[^\s()]+))/gy;
|
|
568
|
+
let m;
|
|
569
|
+
let last = 0;
|
|
570
|
+
while ((m = re.exec(q))) {
|
|
571
|
+
last = re.lastIndex;
|
|
572
|
+
if (m[1])
|
|
573
|
+
out.push({ t: 'lp', v: '(' });
|
|
574
|
+
else if (m[2])
|
|
575
|
+
out.push({ t: 'rp', v: ')' });
|
|
576
|
+
else if (m[3])
|
|
577
|
+
out.push({ t: 'at', v: m[3] });
|
|
578
|
+
else if (m[4] === 'AND')
|
|
579
|
+
out.push({ t: 'and', v: m[4] });
|
|
580
|
+
else if (m[4] === 'OR')
|
|
581
|
+
out.push({ t: 'or', v: m[4] });
|
|
582
|
+
else if (m[4] === 'NOT')
|
|
583
|
+
out.push({ t: 'not', v: m[4] });
|
|
584
|
+
else
|
|
585
|
+
out.push({ t: 'word', v: m[4] });
|
|
586
|
+
}
|
|
587
|
+
if (q.slice(last).trim())
|
|
588
|
+
throw new Error('unreadable');
|
|
589
|
+
return out;
|
|
590
|
+
}
|
|
591
|
+
const pathValues = (doc, path) => {
|
|
592
|
+
let cur = [doc];
|
|
593
|
+
for (const k of path.split('.'))
|
|
594
|
+
cur = cur.flatMap((o) => (Array.isArray(o) ? o : [o])).map((o) => (o && typeof o === 'object' ? o[k] : undefined));
|
|
595
|
+
return cur.flatMap((o) => (Array.isArray(o) ? o : [o]));
|
|
596
|
+
};
|
|
597
|
+
const present = (v) => v !== undefined && v !== null && !(Array.isArray(v) && v.length === 0) && !(typeof v === 'object' && Object.keys(v).length === 0);
|
|
598
|
+
function matchValue(actual, raw) {
|
|
599
|
+
const range = /^(>=|<=|>|<)(.+)$/.exec(raw);
|
|
600
|
+
if (range) {
|
|
601
|
+
const want = range[2].replace(/^"|"$/g, '');
|
|
602
|
+
return actual.some((a) => {
|
|
603
|
+
if (a === undefined || a === null)
|
|
604
|
+
return false;
|
|
605
|
+
const [x, y] = Number.isFinite(Date.parse(String(a))) && Number.isFinite(Date.parse(want)) && Number.isNaN(Number(want)) ? [Date.parse(String(a)), Date.parse(want)] : [Number(a), Number(want)];
|
|
606
|
+
return range[1] === '>=' ? x >= y : range[1] === '<=' ? x <= y : range[1] === '>' ? x > y : x < y;
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
if (/^[\[{]/.test(raw))
|
|
610
|
+
return true;
|
|
611
|
+
const want = (raw.startsWith('"') ? raw.slice(1, -1).replace(/\\(.)/g, '$1') : raw.replace(/\\(.)/g, '$1')).toLowerCase();
|
|
612
|
+
if (!raw.startsWith('"') && want.includes('*')) {
|
|
613
|
+
const re = new RegExp(`^${want.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*')}$`);
|
|
614
|
+
return actual.some((a) => a !== undefined && a !== null && re.test(String(a).toLowerCase()));
|
|
615
|
+
}
|
|
616
|
+
return actual.some((a) => a !== undefined && a !== null && String(a).toLowerCase() === want);
|
|
617
|
+
}
|
|
618
|
+
function matchQuery(doc, q) {
|
|
619
|
+
if (q === '*' || q.trim() === '')
|
|
620
|
+
return true;
|
|
621
|
+
let toks;
|
|
622
|
+
try {
|
|
623
|
+
toks = lexQuery(q);
|
|
624
|
+
}
|
|
625
|
+
catch {
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
628
|
+
let i = 0;
|
|
629
|
+
const peek = () => toks[i];
|
|
630
|
+
const parseOr = (d) => {
|
|
631
|
+
let v = parseAnd(d);
|
|
632
|
+
while (peek()?.t === 'or') {
|
|
633
|
+
i++;
|
|
634
|
+
const r = parseAnd(d);
|
|
635
|
+
v = v || r;
|
|
636
|
+
}
|
|
637
|
+
return v;
|
|
638
|
+
};
|
|
639
|
+
const parseAnd = (d) => {
|
|
640
|
+
let v = parseNot(d);
|
|
641
|
+
while (peek() && peek().t !== 'rp' && peek().t !== 'or') {
|
|
642
|
+
if (peek().t === 'and')
|
|
643
|
+
i++;
|
|
644
|
+
const r = parseNot(d);
|
|
645
|
+
v = v && r;
|
|
646
|
+
}
|
|
647
|
+
return v;
|
|
648
|
+
};
|
|
649
|
+
const parseNot = (d) => {
|
|
650
|
+
if (peek()?.t === 'not') {
|
|
651
|
+
i++;
|
|
652
|
+
return !parseNot(d);
|
|
653
|
+
}
|
|
654
|
+
return parsePrimary(d);
|
|
655
|
+
};
|
|
656
|
+
const parsePrimary = (d) => {
|
|
657
|
+
const t = toks[i++];
|
|
658
|
+
if (!t)
|
|
659
|
+
throw new Error('unreadable');
|
|
660
|
+
if (t.t === 'lp') {
|
|
661
|
+
const v = parseOr(d);
|
|
662
|
+
if (toks[i++]?.t !== 'rp')
|
|
663
|
+
throw new Error('unreadable');
|
|
664
|
+
return v;
|
|
665
|
+
}
|
|
666
|
+
if (t.t === 'at') {
|
|
667
|
+
// Each item of the list is tried on its own, as a nested query does.
|
|
668
|
+
const items = d[t.v];
|
|
669
|
+
const start = i;
|
|
670
|
+
let any = false;
|
|
671
|
+
for (const item of Array.isArray(items) && items.length ? items : [undefined]) {
|
|
672
|
+
i = start;
|
|
673
|
+
const v = parseOr(item ?? {});
|
|
674
|
+
if (item !== undefined && v)
|
|
675
|
+
any = true;
|
|
676
|
+
}
|
|
677
|
+
if (toks[i++]?.t !== 'rp')
|
|
678
|
+
throw new Error('unreadable');
|
|
679
|
+
return any;
|
|
680
|
+
}
|
|
681
|
+
if (t.t !== 'word')
|
|
682
|
+
throw new Error('unreadable');
|
|
683
|
+
const colon = t.v.search(/(?<!\\):/);
|
|
684
|
+
if (colon < 0)
|
|
685
|
+
return true; // free text
|
|
686
|
+
const field = t.v.slice(0, colon);
|
|
687
|
+
const raw = t.v.slice(colon + 1);
|
|
688
|
+
if (raw === '' && peek()?.t === 'lp') {
|
|
689
|
+
// field:(a OR b)
|
|
690
|
+
i++;
|
|
691
|
+
const options = [];
|
|
692
|
+
while (peek() && peek().t !== 'rp') {
|
|
693
|
+
const o = toks[i++];
|
|
694
|
+
if (o.t === 'word')
|
|
695
|
+
options.push(o.v);
|
|
696
|
+
}
|
|
697
|
+
i++;
|
|
698
|
+
const actual = pathValues(d, field);
|
|
699
|
+
return options.some((o) => matchValue(actual, o));
|
|
700
|
+
}
|
|
701
|
+
if (field === '_exists_')
|
|
702
|
+
return pathValues(d, raw).some(present);
|
|
703
|
+
return matchValue(pathValues(d, field), raw);
|
|
704
|
+
};
|
|
705
|
+
try {
|
|
706
|
+
const v = parseOr(doc);
|
|
707
|
+
return i >= toks.length ? v : true;
|
|
708
|
+
}
|
|
709
|
+
catch {
|
|
710
|
+
return true;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
export async function startMockIsc(opts = {}) {
|
|
714
|
+
const clientId = opts.clientId ?? 'test-client';
|
|
715
|
+
const clientSecret = opts.clientSecret ?? 'test-secret';
|
|
716
|
+
const tokens = new Set();
|
|
717
|
+
const log = [];
|
|
718
|
+
const hits = new Map();
|
|
719
|
+
let expired = !opts.expireTokenOnce;
|
|
720
|
+
const state = { tokensIssued: 0 };
|
|
721
|
+
const send = (res, status, data, headers = {}) => {
|
|
722
|
+
res.writeHead(status, { 'content-type': 'application/json', ...headers });
|
|
723
|
+
res.end(JSON.stringify(data));
|
|
724
|
+
};
|
|
725
|
+
const codes = new Map();
|
|
726
|
+
const refreshTokens = new Set();
|
|
727
|
+
const oauthClient = opts.oauthClientId ?? 'reports-app';
|
|
728
|
+
const signIn = { refreshed: 0 };
|
|
729
|
+
const handler = async (req, res) => {
|
|
730
|
+
const url = new URL(req.url ?? '/', 'http://localhost');
|
|
731
|
+
const chunks = [];
|
|
732
|
+
for await (const c of req)
|
|
733
|
+
chunks.push(c);
|
|
734
|
+
const raw = Buffer.concat(chunks).toString('utf8');
|
|
735
|
+
const entry = { method: req.method ?? '', path: url.pathname, query: Object.fromEntries(url.searchParams), status: 200 };
|
|
736
|
+
if (opts.keepLog !== false)
|
|
737
|
+
log.push(entry);
|
|
738
|
+
const reply = (status, data, headers) => {
|
|
739
|
+
entry.status = status;
|
|
740
|
+
send(res, status, data, headers);
|
|
741
|
+
};
|
|
742
|
+
try {
|
|
743
|
+
if (url.pathname === '/oauth/info' && req.method === 'GET') {
|
|
744
|
+
return reply(200, { authorizeEndpoint: `http://${req.headers.host}/oauth/authorize` });
|
|
745
|
+
}
|
|
746
|
+
if (url.pathname === '/oauth/authorize' && req.method === 'GET') {
|
|
747
|
+
const q = url.searchParams;
|
|
748
|
+
const redirect = q.get('redirect_uri') ?? '';
|
|
749
|
+
if (q.get('client_id') !== oauthClient || !/^http:\/\/localhost:\d+\/callback$/.test(redirect))
|
|
750
|
+
return reply(400, { error: 'invalid_client' });
|
|
751
|
+
if (q.get('code_challenge_method') !== 'S256' || !q.get('code_challenge'))
|
|
752
|
+
return reply(400, { error: 'pkce_required' });
|
|
753
|
+
const target = new URL(redirect);
|
|
754
|
+
target.searchParams.set('state', q.get('state') ?? '');
|
|
755
|
+
if (opts.denyLogin)
|
|
756
|
+
target.searchParams.set('error', 'access_denied');
|
|
757
|
+
else {
|
|
758
|
+
const code = `code-${codes.size + 1}`;
|
|
759
|
+
codes.set(code, { challenge: q.get('code_challenge'), redirect, client: q.get('client_id') });
|
|
760
|
+
target.searchParams.set('code', code);
|
|
761
|
+
}
|
|
762
|
+
entry.status = 302;
|
|
763
|
+
res.writeHead(302, { location: target.toString() });
|
|
764
|
+
res.end();
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
if (url.pathname === '/oauth/token' && req.method === 'POST' && new URLSearchParams(raw).get('grant_type') !== 'client_credentials') {
|
|
768
|
+
const form = new URLSearchParams(raw);
|
|
769
|
+
const issue = () => {
|
|
770
|
+
const payload = Buffer.from(JSON.stringify({ user_name: 'alice', tenant_id: 't1' })).toString('base64url');
|
|
771
|
+
const token = `h.${payload}.s${++state.tokensIssued}`;
|
|
772
|
+
tokens.add(token);
|
|
773
|
+
const refresh = `refresh-${state.tokensIssued}`;
|
|
774
|
+
refreshTokens.add(refresh);
|
|
775
|
+
return reply(200, { access_token: token, refresh_token: refresh, token_type: 'bearer', expires_in: opts.signInTokenSeconds ?? 749 });
|
|
776
|
+
};
|
|
777
|
+
if (form.get('grant_type') === 'authorization_code') {
|
|
778
|
+
const c = codes.get(form.get('code') ?? '');
|
|
779
|
+
codes.delete(form.get('code') ?? '');
|
|
780
|
+
const challenge = createHash('sha256').update(form.get('code_verifier') ?? '').digest('base64url');
|
|
781
|
+
if (!c || c.redirect !== form.get('redirect_uri') || c.client !== form.get('client_id') || c.challenge !== challenge) {
|
|
782
|
+
return reply(400, { error: 'invalid_grant', error_description: 'Invalid authorization code' });
|
|
783
|
+
}
|
|
784
|
+
return issue();
|
|
785
|
+
}
|
|
786
|
+
if (form.get('grant_type') === 'refresh_token') {
|
|
787
|
+
if (!refreshTokens.delete(form.get('refresh_token') ?? '') || form.get('client_id') !== oauthClient)
|
|
788
|
+
return reply(400, { error: 'invalid_grant' });
|
|
789
|
+
signIn.refreshed++;
|
|
790
|
+
return issue();
|
|
791
|
+
}
|
|
792
|
+
return reply(400, { error: 'unsupported_grant_type' });
|
|
793
|
+
}
|
|
794
|
+
if (url.pathname === '/oauth/token' && req.method === 'POST') {
|
|
795
|
+
const form = new URLSearchParams(raw);
|
|
796
|
+
if (form.get('grant_type') !== 'client_credentials' || form.get('client_id') !== clientId || form.get('client_secret') !== clientSecret) {
|
|
797
|
+
return reply(401, { error: 'invalid_client' });
|
|
798
|
+
}
|
|
799
|
+
const token = `tok-${++state.tokensIssued}`;
|
|
800
|
+
tokens.add(token);
|
|
801
|
+
return reply(200, { access_token: token, token_type: 'bearer', expires_in: 749 });
|
|
802
|
+
}
|
|
803
|
+
const auth = req.headers['authorization'] ?? '';
|
|
804
|
+
const token = auth.replace(/^Bearer\s+/i, '');
|
|
805
|
+
if (!tokens.has(token))
|
|
806
|
+
return reply(401, { error: 'unauthorized' });
|
|
807
|
+
if (!expired) {
|
|
808
|
+
expired = true;
|
|
809
|
+
tokens.delete(token);
|
|
810
|
+
return reply(401, { error: 'expired' });
|
|
811
|
+
}
|
|
812
|
+
// NERM (same token as ISC), under /nerm: GET only, like a read-only token would see it.
|
|
813
|
+
if (url.pathname.startsWith('/nerm/')) {
|
|
814
|
+
if (req.method !== 'GET')
|
|
815
|
+
return reply(403, { error: 'read-only token' });
|
|
816
|
+
const key = url.pathname.slice(6).replace(/^profile_types\/[^/]+\//, '');
|
|
817
|
+
const items = NERM_DATA[key];
|
|
818
|
+
if (!items)
|
|
819
|
+
return reply(404, { error: 'not found' });
|
|
820
|
+
const off = Number(url.searchParams.get('offset') ?? 0);
|
|
821
|
+
const lim = Number(url.searchParams.get('limit') ?? 100);
|
|
822
|
+
return reply(200, { [key]: items.slice(off, off + lim), _metadata: { total: items.length, limit: lim, offset: off } });
|
|
823
|
+
}
|
|
824
|
+
const n = (hits.get(url.pathname) ?? 0) + 1;
|
|
825
|
+
hits.set(url.pathname, n);
|
|
826
|
+
if (opts.rateLimitFirst && n <= opts.rateLimitFirst)
|
|
827
|
+
return reply(429, { message: ' Rate Limit Exceeded ' }, { 'retry-after': '2' });
|
|
828
|
+
const limit = Number(url.searchParams.get('limit') ?? 250);
|
|
829
|
+
const offset = Number(url.searchParams.get('offset') ?? 0);
|
|
830
|
+
const filters = url.searchParams.get('filters') ?? undefined;
|
|
831
|
+
const list = (all, o = {}) => {
|
|
832
|
+
if (limit > 250)
|
|
833
|
+
return reply(400, { messages: [{ text: 'limit must be at most 250' }] });
|
|
834
|
+
const matched = o.ignoreFilters ? all : all.filter((d) => matchFilter(d, filters));
|
|
835
|
+
const start = o.ignoreOffset ? 0 : offset;
|
|
836
|
+
const headers = url.searchParams.get('count') === 'true' ? { 'x-total-count': String(matched.length) } : {};
|
|
837
|
+
return reply(200, matched.slice(start, start + limit), headers);
|
|
838
|
+
};
|
|
839
|
+
// SP-Config export of cloud rules: the job is in progress on the first status read, then complete.
|
|
840
|
+
if (url.pathname === '/sp-config/v1/export' && req.method === 'POST') {
|
|
841
|
+
SP_CONFIG.started.push(JSON.parse(raw || '{}'));
|
|
842
|
+
SP_CONFIG.polls = 0;
|
|
843
|
+
return reply(202, { jobId: 'exp-1', status: 'NOT_STARTED', type: 'EXPORT' });
|
|
844
|
+
}
|
|
845
|
+
if (url.pathname === '/sp-config/v1/export/exp-1')
|
|
846
|
+
return reply(200, { jobId: 'exp-1', type: 'EXPORT', status: SP_CONFIG.polls++ ? 'COMPLETE' : 'IN_PROGRESS' });
|
|
847
|
+
if (url.pathname === '/sp-config/v1/export/exp-1/download')
|
|
848
|
+
return reply(200, { version: 1, tenant: 'acme', objects: SP_CONFIG.rules.map((r) => ({ version: 1, self: { type: 'RULE', id: r.id, name: r.name }, object: r, jwsHeader: 'h', jwsSignature: 'sig-' + r.id })) });
|
|
849
|
+
const diag = /^\/sources\/v1\/([^/]+)\/connector\/(check-connection|ping-cluster|peek-resource-objects)$/.exec(url.pathname);
|
|
850
|
+
if (diag && req.method === 'POST') {
|
|
851
|
+
if (diag[2] === 'peek-resource-objects') {
|
|
852
|
+
const b = JSON.parse(raw || '{}');
|
|
853
|
+
entry.body = b;
|
|
854
|
+
return reply(200, { id: diag[1], name: 'Active Directory', objectCount: 1, elapsedMillis: 120, resourceObjects: [{ identity: 'CN=Alice Ng', name: 'alice', objectType: 'account', attributes: { sAMAccountName: 'alice', userPassword: 'x' } }].slice(0, b.maxCount ?? 10) });
|
|
855
|
+
}
|
|
856
|
+
return reply(200, { id: diag[1], name: 'Active Directory', status: 'SUCCESS', elapsedMillis: 840, details: {} });
|
|
857
|
+
}
|
|
858
|
+
if (url.pathname === '/search/v1' && req.method === 'POST') {
|
|
859
|
+
const body = JSON.parse(raw);
|
|
860
|
+
entry.body = body;
|
|
861
|
+
if (limit > 10_000)
|
|
862
|
+
return reply(400, { messages: [{ text: 'limit must be at most 10000' }] });
|
|
863
|
+
const index = body.indices?.[0] ?? '';
|
|
864
|
+
const docs = (SEARCH_INDEXES[index] ?? []).filter((d) => matchQuery(d, body.query?.query ?? '*'));
|
|
865
|
+
const sorted = [...docs].sort((a, b) => String(a['id']).localeCompare(String(b['id'])));
|
|
866
|
+
let start = 0;
|
|
867
|
+
if (body.searchAfter?.[0] !== undefined)
|
|
868
|
+
start = sorted.findIndex((d) => String(d['id']) > body.searchAfter[0]);
|
|
869
|
+
if (start < 0)
|
|
870
|
+
start = sorted.length;
|
|
871
|
+
if (!body.searchAfter && offset + limit > 10_000)
|
|
872
|
+
return reply(400, { messages: [{ text: 'result window is too large' }] });
|
|
873
|
+
// queryResultFilter.includes: only the named fields come back, as in ISC.
|
|
874
|
+
const inc = body.queryResultFilter?.includes;
|
|
875
|
+
const only = (d) => {
|
|
876
|
+
if (!inc?.length)
|
|
877
|
+
return d;
|
|
878
|
+
const out = {};
|
|
879
|
+
for (const path of inc) {
|
|
880
|
+
const [top, ...rest] = path.split('.');
|
|
881
|
+
if (!(top in d))
|
|
882
|
+
continue;
|
|
883
|
+
if (!rest.length || typeof d[top] !== 'object' || d[top] === null || Array.isArray(d[top]))
|
|
884
|
+
out[top] = d[top];
|
|
885
|
+
else {
|
|
886
|
+
const sub = (out[top] ?? {});
|
|
887
|
+
const v = rest.reduce((o, k) => o?.[k], d[top]);
|
|
888
|
+
if (v !== undefined)
|
|
889
|
+
rest.reduce((o, k, i) => (i === rest.length - 1 ? ((o[k] = v), o) : (o[k] ??= {})), sub);
|
|
890
|
+
if (out[top] === undefined || typeof out[top] === 'object')
|
|
891
|
+
out[top] = sub;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
return out;
|
|
895
|
+
};
|
|
896
|
+
if (opts.searchLimitBytes) {
|
|
897
|
+
const size = JSON.stringify(sorted.slice(start + (body.searchAfter ? 0 : offset), start + (body.searchAfter ? 0 : offset) + limit).map(only)).length;
|
|
898
|
+
if (size > opts.searchLimitBytes)
|
|
899
|
+
return reply(413, { messages: [{ text: 'The result of this search request exceeds the size limit. Adjust the parameters of your request to reduce the size of your result.' }] });
|
|
900
|
+
}
|
|
901
|
+
const countHeader = url.searchParams.get('count') === 'true' ? { 'x-total-count': String(docs.length) } : {};
|
|
902
|
+
entry.status = 200;
|
|
903
|
+
res.writeHead(200, { 'content-type': 'application/json', ...countHeader });
|
|
904
|
+
res.end(JSON.stringify(sorted.slice(start + (body.searchAfter ? 0 : offset), start + (body.searchAfter ? 0 : offset) + limit).map(only)));
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
if (req.method !== 'GET')
|
|
908
|
+
return reply(405, { error: 'method not allowed' });
|
|
909
|
+
switch (url.pathname) {
|
|
910
|
+
case '/sources/v1':
|
|
911
|
+
return list(SOURCES);
|
|
912
|
+
case '/accounts/v1': {
|
|
913
|
+
// "identityId in (...)": the people's own accounts, with attributes (transform lab).
|
|
914
|
+
const ids = /^identityId in \((.*)\)$/.exec(url.searchParams.get('filters') ?? '');
|
|
915
|
+
if (ids) {
|
|
916
|
+
const want = new Set([...ids[1].matchAll(/"([^"]+)"/g)].map((m) => m[1]));
|
|
917
|
+
const docs = SEARCH_INDEXES['identities']
|
|
918
|
+
.filter((i) => want.has(String(i['id'])))
|
|
919
|
+
.flatMap((i) => (i['accounts'] ?? []).map((a) => ({ ...a, identityId: i['id'], sourceId: a['source'].id, sourceName: a['source'].name, nativeIdentity: a['accountId'], attributes: LAB_ACCOUNT_ATTRIBUTES[String(a['id'])] ?? (a['source'].name === 'Workday' && i['email'] ? { EMAIL: i['email'] } : {}) })));
|
|
920
|
+
return list(docs);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
// falls through
|
|
924
|
+
case '/accounts/v1#all':
|
|
925
|
+
return list([...UNCORRELATED, ...CORRELATED_ACCOUNTS], {
|
|
926
|
+
ignoreOffset: opts.repeatPages,
|
|
927
|
+
ignoreFilters: opts.ignoreAccountFilters,
|
|
928
|
+
});
|
|
929
|
+
case '/entitlements/v1':
|
|
930
|
+
return list(ENTITLEMENTS);
|
|
931
|
+
case '/campaigns/v1':
|
|
932
|
+
return list(CAMPAIGNS);
|
|
933
|
+
case '/certifications/v1': {
|
|
934
|
+
const m = /campaign\.id eq "([^"]+)"/.exec(url.searchParams.get('filters') ?? '');
|
|
935
|
+
return list((m ? CERTIFICATIONS.filter((c) => c.campaign.id === m[1]) : CERTIFICATIONS));
|
|
936
|
+
}
|
|
937
|
+
case '/access-request-status/v1':
|
|
938
|
+
return list(ACCESS_REQUESTS);
|
|
939
|
+
case '/identity-profiles/v1':
|
|
940
|
+
return list(IDENTITY_PROFILES);
|
|
941
|
+
case '/managed-clusters/v1':
|
|
942
|
+
return list(CLUSTERS);
|
|
943
|
+
case '/managed-clients/v1':
|
|
944
|
+
return list(CLIENTS);
|
|
945
|
+
case '/workflows/v1':
|
|
946
|
+
return list(WORKFLOWS);
|
|
947
|
+
case '/transforms/v1':
|
|
948
|
+
return list(TRANSFORMS);
|
|
949
|
+
case '/personal-access-tokens/v1':
|
|
950
|
+
return list((url.searchParams.get('owner-id') === 'me' ? PERSONAL_ACCESS_TOKENS.filter((p) => p.owner.id === 'id-alice') : PERSONAL_ACCESS_TOKENS));
|
|
951
|
+
case '/oauth-clients/v1':
|
|
952
|
+
return list(OAUTH_CLIENTS);
|
|
953
|
+
case '/connector-rules/v1':
|
|
954
|
+
return list(CONNECTOR_RULES);
|
|
955
|
+
case '/form-definitions/v1':
|
|
956
|
+
return reply(200, FORM_DEFINITIONS);
|
|
957
|
+
}
|
|
958
|
+
if (url.pathname === '/password-policies/v1' && req.headers['x-sailpoint-experimental'] !== 'true')
|
|
959
|
+
return reply(400, { messages: [{ text: "Experimental Header 'X-SailPoint-Experimental' is missing or invalid." }] });
|
|
960
|
+
if (CONFIG_LISTS[url.pathname])
|
|
961
|
+
return list(CONFIG_LISTS[url.pathname]);
|
|
962
|
+
const runs = /^\/workflows\/v1\/([^/]+)\/executions$/.exec(url.pathname);
|
|
963
|
+
// Like ISC: pages above a size are refused as "too much data" (EXECUTIONS.maxPage), and with
|
|
964
|
+
// EXECUTIONS.onlyFiltered only the failed-runs filter is accepted.
|
|
965
|
+
if (runs) {
|
|
966
|
+
const limit = Number(url.searchParams.get('limit') ?? 250);
|
|
967
|
+
const filtered = url.searchParams.get('filters') === 'status eq "Failed"';
|
|
968
|
+
if (limit > EXECUTIONS.maxPage || (EXECUTIONS.onlyFiltered && !filtered))
|
|
969
|
+
return reply(400, { messages: [{ text: 'execution history query requests too much data; narrow the request and try again' }] });
|
|
970
|
+
if (filtered) {
|
|
971
|
+
const all = (WORKFLOW_RUNS[runs[1]] ?? []).filter((r) => r.status === 'Failed');
|
|
972
|
+
const off = Number(url.searchParams.get('offset') ?? 0);
|
|
973
|
+
return reply(200, all.slice(off, off + limit));
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
if (runs)
|
|
977
|
+
return list(WORKFLOW_RUNS[runs[1]] ?? []);
|
|
978
|
+
const hist = /^\/workflow-executions\/v1\/([^/]+)\/history-v2$/.exec(url.pathname);
|
|
979
|
+
if (hist)
|
|
980
|
+
return WORKFLOW_HISTORY[hist[1]] ? reply(200, WORKFLOW_HISTORY[hist[1]]) : reply(404, { messages: [{ text: 'execution archived or not found' }] });
|
|
981
|
+
const lcs = /^\/identity-profiles\/v1\/([^/]+)\/lifecycle-states$/.exec(url.pathname);
|
|
982
|
+
if (lcs)
|
|
983
|
+
return reply(200, LIFECYCLE_STATES[lcs[1]] ?? []);
|
|
984
|
+
const pol = /^\/sources\/v1\/([^/]+)\/provisioning-policies$/.exec(url.pathname);
|
|
985
|
+
if (pol)
|
|
986
|
+
return reply(200, PROVISIONING_POLICIES[pol[1]] ?? []);
|
|
987
|
+
const srcOne = /^\/sources\/v1\/([^/]+)$/.exec(url.pathname);
|
|
988
|
+
if (srcOne && req.method === 'GET')
|
|
989
|
+
return SOURCE_DETAILS[srcOne[1]] ? reply(200, SOURCE_DETAILS[srcOne[1]]) : reply(404, { messages: [{ text: 'not found' }] });
|
|
990
|
+
const role = /^\/roles\/v1\/([^/]+)$/.exec(url.pathname);
|
|
991
|
+
if (role)
|
|
992
|
+
return ROLE_DEFINITIONS[role[1]] ? reply(200, ROLE_DEFINITIONS[role[1]]) : reply(404, { messages: [{ text: 'role not found' }] });
|
|
993
|
+
if (/^\/entitlements\/v1\/[^/]+\/entitlement-request-config$/.test(url.pathname))
|
|
994
|
+
return reply(200, { accessRequestConfig: { approvalSchemes: [{ approverType: 'ENTITLEMENT_OWNER', approverId: null }] }, revocationRequestConfig: { approvalSchemes: [] } });
|
|
995
|
+
if (url.pathname === '/sources/v1/src-ad/attribute-sync-config')
|
|
996
|
+
return reply(200, { source: { id: 'src-ad', name: 'Active Directory' }, attributes: [{ name: 'email', displayName: 'Email', enabled: true, target: 'mail' }, { name: 'department', displayName: 'Department', enabled: true, target: 'department' }] });
|
|
997
|
+
const m = /^\/certifications\/v1\/([^/]+)\/access-review-items$/.exec(url.pathname);
|
|
998
|
+
if (m)
|
|
999
|
+
return list((REVIEW_ITEMS[m[1]] ?? []));
|
|
1000
|
+
return reply(404, { error: 'not found' });
|
|
1001
|
+
}
|
|
1002
|
+
catch (e) {
|
|
1003
|
+
return reply(e.status ?? 500, { error: e.message });
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
const server = createServer((req, res) => {
|
|
1007
|
+
handler(req, res).catch((e) => send(res, 500, { error: String(e) }));
|
|
1008
|
+
});
|
|
1009
|
+
await new Promise((r) => server.listen(0, '127.0.0.1', r));
|
|
1010
|
+
const port = server.address().port;
|
|
1011
|
+
return {
|
|
1012
|
+
url: `http://127.0.0.1:${port}`,
|
|
1013
|
+
log,
|
|
1014
|
+
get tokensIssued() {
|
|
1015
|
+
return state.tokensIssued;
|
|
1016
|
+
},
|
|
1017
|
+
get refreshes() {
|
|
1018
|
+
return signIn.refreshed;
|
|
1019
|
+
},
|
|
1020
|
+
close: () => new Promise((r) => server.close(() => r())),
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
//# sourceMappingURL=tenant.js.map
|