@j-schreiber/sf-cli-security-audit 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -22
- package/messages/org.audit.init.md +3 -3
- package/messages/org.audit.run.md +11 -3
- package/messages/org.scan.user-perms.md +7 -5
- package/messages/rules.enforceClassificationPresets.md +4 -0
- package/messages/rules.users.md +12 -0
- package/oclif.lock +365 -71
- package/oclif.manifest.json +2 -253
- package/package.json +1 -1
- package/lib/commands/org/audit/init.d.ts +0 -19
- package/lib/commands/org/audit/init.js +0 -72
- package/lib/commands/org/audit/init.js.map +0 -1
- package/lib/commands/org/audit/run.d.ts +0 -22
- package/lib/commands/org/audit/run.js +0 -119
- package/lib/commands/org/audit/run.js.map +0 -1
- package/lib/commands/org/scan/user-perms.d.ts +0 -20
- package/lib/commands/org/scan/user-perms.js +0 -87
- package/lib/commands/org/scan/user-perms.js.map +0 -1
- package/lib/libs/conf-init/auditConfig.d.ts +0 -35
- package/lib/libs/conf-init/auditConfig.js +0 -41
- package/lib/libs/conf-init/auditConfig.js.map +0 -1
- package/lib/libs/conf-init/permissionsClassification.d.ts +0 -17
- package/lib/libs/conf-init/permissionsClassification.js +0 -80
- package/lib/libs/conf-init/permissionsClassification.js.map +0 -1
- package/lib/libs/conf-init/policyConfigs.d.ts +0 -31
- package/lib/libs/conf-init/policyConfigs.js +0 -91
- package/lib/libs/conf-init/policyConfigs.js.map +0 -1
- package/lib/libs/conf-init/presets/loose.d.ts +0 -6
- package/lib/libs/conf-init/presets/loose.js +0 -51
- package/lib/libs/conf-init/presets/loose.js.map +0 -1
- package/lib/libs/conf-init/presets/none.d.ts +0 -30
- package/lib/libs/conf-init/presets/none.js +0 -54
- package/lib/libs/conf-init/presets/none.js.map +0 -1
- package/lib/libs/conf-init/presets/strict.d.ts +0 -4
- package/lib/libs/conf-init/presets/strict.js +0 -45
- package/lib/libs/conf-init/presets/strict.js.map +0 -1
- package/lib/libs/conf-init/presets.d.ts +0 -7
- package/lib/libs/conf-init/presets.js +0 -20
- package/lib/libs/conf-init/presets.js.map +0 -1
- package/lib/libs/core/auditRun.d.ts +0 -36
- package/lib/libs/core/auditRun.js +0 -86
- package/lib/libs/core/auditRun.js.map +0 -1
- package/lib/libs/core/classification-types.d.ts +0 -20
- package/lib/libs/core/classification-types.js +0 -23
- package/lib/libs/core/classification-types.js.map +0 -1
- package/lib/libs/core/constants.d.ts +0 -11
- package/lib/libs/core/constants.js +0 -20
- package/lib/libs/core/constants.js.map +0 -1
- package/lib/libs/core/file-mgmt/auditConfigFileManager.d.ts +0 -48
- package/lib/libs/core/file-mgmt/auditConfigFileManager.js +0 -139
- package/lib/libs/core/file-mgmt/auditConfigFileManager.js.map +0 -1
- package/lib/libs/core/file-mgmt/schema.d.ts +0 -122
- package/lib/libs/core/file-mgmt/schema.js +0 -59
- package/lib/libs/core/file-mgmt/schema.js.map +0 -1
- package/lib/libs/core/mdapi/mdapiRetriever.d.ts +0 -54
- package/lib/libs/core/mdapi/mdapiRetriever.js +0 -123
- package/lib/libs/core/mdapi/mdapiRetriever.js.map +0 -1
- package/lib/libs/core/mdapi/metadataRegistryEntry.d.ts +0 -40
- package/lib/libs/core/mdapi/metadataRegistryEntry.js +0 -46
- package/lib/libs/core/mdapi/metadataRegistryEntry.js.map +0 -1
- package/lib/libs/core/mdapi/namedMetadataToolingQueryable.d.ts +0 -33
- package/lib/libs/core/mdapi/namedMetadataToolingQueryable.js +0 -41
- package/lib/libs/core/mdapi/namedMetadataToolingQueryable.js.map +0 -1
- package/lib/libs/core/mdapi/namedMetadataType.d.ts +0 -20
- package/lib/libs/core/mdapi/namedMetadataType.js +0 -41
- package/lib/libs/core/mdapi/namedMetadataType.js.map +0 -1
- package/lib/libs/core/mdapi/singletonMetadataType.d.ts +0 -21
- package/lib/libs/core/mdapi/singletonMetadataType.js +0 -37
- package/lib/libs/core/mdapi/singletonMetadataType.js.map +0 -1
- package/lib/libs/core/policies/connectedAppPolicy.d.ts +0 -10
- package/lib/libs/core/policies/connectedAppPolicy.js +0 -78
- package/lib/libs/core/policies/connectedAppPolicy.js.map +0 -1
- package/lib/libs/core/policies/permissionSetPolicy.d.ts +0 -11
- package/lib/libs/core/policies/permissionSetPolicy.js +0 -62
- package/lib/libs/core/policies/permissionSetPolicy.js.map +0 -1
- package/lib/libs/core/policies/policy.d.ts +0 -31
- package/lib/libs/core/policies/policy.js +0 -100
- package/lib/libs/core/policies/policy.js.map +0 -1
- package/lib/libs/core/policies/profilePolicy.d.ts +0 -11
- package/lib/libs/core/policies/profilePolicy.js +0 -64
- package/lib/libs/core/policies/profilePolicy.js.map +0 -1
- package/lib/libs/core/policies/salesforceStandardTypes.d.ts +0 -53
- package/lib/libs/core/policies/salesforceStandardTypes.js +0 -2
- package/lib/libs/core/policies/salesforceStandardTypes.js.map +0 -1
- package/lib/libs/core/policies/userPolicy.d.ts +0 -11
- package/lib/libs/core/policies/userPolicy.js +0 -104
- package/lib/libs/core/policies/userPolicy.js.map +0 -1
- package/lib/libs/core/policy-types.d.ts +0 -18
- package/lib/libs/core/policy-types.js +0 -28
- package/lib/libs/core/policy-types.js.map +0 -1
- package/lib/libs/core/policyRegistry.d.ts +0 -23
- package/lib/libs/core/policyRegistry.js +0 -38
- package/lib/libs/core/policyRegistry.js.map +0 -1
- package/lib/libs/core/registries/connectedApps.d.ts +0 -13
- package/lib/libs/core/registries/connectedApps.js +0 -13
- package/lib/libs/core/registries/connectedApps.js.map +0 -1
- package/lib/libs/core/registries/permissionSets.d.ts +0 -11
- package/lib/libs/core/registries/permissionSets.js +0 -11
- package/lib/libs/core/registries/permissionSets.js.map +0 -1
- package/lib/libs/core/registries/profiles.d.ts +0 -11
- package/lib/libs/core/registries/profiles.js +0 -13
- package/lib/libs/core/registries/profiles.js.map +0 -1
- package/lib/libs/core/registries/ruleRegistry.d.ts +0 -37
- package/lib/libs/core/registries/ruleRegistry.js +0 -48
- package/lib/libs/core/registries/ruleRegistry.js.map +0 -1
- package/lib/libs/core/registries/rules/allUsedAppsUnderManagement.d.ts +0 -7
- package/lib/libs/core/registries/rules/allUsedAppsUnderManagement.js +0 -23
- package/lib/libs/core/registries/rules/allUsedAppsUnderManagement.js.map +0 -1
- package/lib/libs/core/registries/rules/enforceCustomPermsClassificationOnProfiles.d.ts +0 -7
- package/lib/libs/core/registries/rules/enforceCustomPermsClassificationOnProfiles.js +0 -52
- package/lib/libs/core/registries/rules/enforceCustomPermsClassificationOnProfiles.js.map +0 -1
- package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnPermSets.d.ts +0 -7
- package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnPermSets.js +0 -52
- package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnPermSets.js.map +0 -1
- package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnProfiles.d.ts +0 -7
- package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnProfiles.js +0 -54
- package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnProfiles.js.map +0 -1
- package/lib/libs/core/registries/rules/noInactiveUsers.d.ts +0 -9
- package/lib/libs/core/registries/rules/noInactiveUsers.js +0 -44
- package/lib/libs/core/registries/rules/noInactiveUsers.js.map +0 -1
- package/lib/libs/core/registries/rules/noOtherApexApiLogins.d.ts +0 -7
- package/lib/libs/core/registries/rules/noOtherApexApiLogins.js +0 -24
- package/lib/libs/core/registries/rules/noOtherApexApiLogins.js.map +0 -1
- package/lib/libs/core/registries/rules/noUserCanSelfAuthorize.d.ts +0 -7
- package/lib/libs/core/registries/rules/noUserCanSelfAuthorize.js +0 -31
- package/lib/libs/core/registries/rules/noUserCanSelfAuthorize.js.map +0 -1
- package/lib/libs/core/registries/rules/policyRule.d.ts +0 -19
- package/lib/libs/core/registries/rules/policyRule.js +0 -31
- package/lib/libs/core/registries/rules/policyRule.js.map +0 -1
- package/lib/libs/core/registries/types.d.ts +0 -37
- package/lib/libs/core/registries/types.js +0 -11
- package/lib/libs/core/registries/types.js.map +0 -1
- package/lib/libs/core/registries/users.d.ts +0 -26
- package/lib/libs/core/registries/users.js +0 -10
- package/lib/libs/core/registries/users.js.map +0 -1
- package/lib/libs/core/result-types.d.ts +0 -172
- package/lib/libs/core/result-types.js +0 -2
- package/lib/libs/core/result-types.js.map +0 -1
- package/lib/libs/core/utils.d.ts +0 -12
- package/lib/libs/core/utils.js +0 -31
- package/lib/libs/core/utils.js.map +0 -1
- package/lib/libs/quick-scan/types.d.ts +0 -17
- package/lib/libs/quick-scan/types.js +0 -2
- package/lib/libs/quick-scan/types.js.map +0 -1
- package/lib/libs/quick-scan/userPermissionScanner.d.ts +0 -22
- package/lib/libs/quick-scan/userPermissionScanner.js +0 -75
- package/lib/libs/quick-scan/userPermissionScanner.js.map +0 -1
- package/lib/ux/auditRunMultiStage.d.ts +0 -65
- package/lib/ux/auditRunMultiStage.js +0 -120
- package/lib/ux/auditRunMultiStage.js.map +0 -1
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// import fs from 'node:fs';
|
|
2
|
-
import EventEmitter from 'node:events';
|
|
3
|
-
import { loadAuditConfig } from './file-mgmt/auditConfigFileManager.js';
|
|
4
|
-
import { policyDefs } from './policyRegistry.js';
|
|
5
|
-
export function startAuditRun(directoryPath) {
|
|
6
|
-
const conf = loadAuditConfig(directoryPath);
|
|
7
|
-
return new AuditRun(conf);
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Instance of an audit run that manages high-level operations
|
|
11
|
-
*/
|
|
12
|
-
export default class AuditRun extends EventEmitter {
|
|
13
|
-
configs;
|
|
14
|
-
executablePolicies;
|
|
15
|
-
constructor(configs) {
|
|
16
|
-
super();
|
|
17
|
-
this.configs = configs;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Loads all policies, resolves entities and caches the results.
|
|
21
|
-
*
|
|
22
|
-
* @param targetOrgConnection
|
|
23
|
-
*/
|
|
24
|
-
async resolve(targetOrgConnection) {
|
|
25
|
-
if (this.executablePolicies) {
|
|
26
|
-
return this.executablePolicies;
|
|
27
|
-
}
|
|
28
|
-
this.executablePolicies = this.loadPolicies(this.configs);
|
|
29
|
-
const resolveResultPromises = [];
|
|
30
|
-
Object.values(this.executablePolicies).forEach((executable) => {
|
|
31
|
-
resolveResultPromises.push(executable.resolve({ targetOrgConnection }));
|
|
32
|
-
});
|
|
33
|
-
await Promise.all(resolveResultPromises);
|
|
34
|
-
return this.executablePolicies;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Executes an initialised audit run. Resolves policies entities
|
|
38
|
-
* and executes all rules.
|
|
39
|
-
*
|
|
40
|
-
* @param targetOrgConnection
|
|
41
|
-
* @returns
|
|
42
|
-
*/
|
|
43
|
-
async execute(targetCon) {
|
|
44
|
-
this.executablePolicies = await this.resolve(targetCon);
|
|
45
|
-
const results = await runPolicies(this.executablePolicies, targetCon);
|
|
46
|
-
return {
|
|
47
|
-
auditDate: new Date().toISOString(),
|
|
48
|
-
isCompliant: isCompliant(results),
|
|
49
|
-
policies: results,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
loadPolicies(config) {
|
|
53
|
-
const pols = {};
|
|
54
|
-
Object.entries(config.policies).forEach(([policyName, policyConfig]) => {
|
|
55
|
-
const policy = new policyDefs[policyName].handler(policyConfig.content, config);
|
|
56
|
-
policy.addListener('entityresolve', (resolveStats) => {
|
|
57
|
-
this.emit(`entityresolve-${policyName}`, { policyName, ...resolveStats });
|
|
58
|
-
});
|
|
59
|
-
pols[policyName] = policy;
|
|
60
|
-
});
|
|
61
|
-
return pols;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function isCompliant(results) {
|
|
65
|
-
const list = Object.values(results);
|
|
66
|
-
if (list.length === 0) {
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
return list.reduce((prevVal, currentVal) => prevVal && currentVal.isCompliant, list[0].isCompliant);
|
|
70
|
-
}
|
|
71
|
-
async function runPolicies(policies, targetOrgConnection) {
|
|
72
|
-
const resultsArray = [];
|
|
73
|
-
const policiesList = [];
|
|
74
|
-
Object.entries(policies).forEach(([policyKey, executable]) => {
|
|
75
|
-
policiesList.push(policyKey);
|
|
76
|
-
resultsArray.push(executable.run({ targetOrgConnection }));
|
|
77
|
-
});
|
|
78
|
-
const arrayResult = await Promise.all(resultsArray);
|
|
79
|
-
const results = {};
|
|
80
|
-
arrayResult.forEach((policyResult) => {
|
|
81
|
-
const policyKey = policiesList[arrayResult.indexOf(policyResult)];
|
|
82
|
-
results[policyKey] = policyResult;
|
|
83
|
-
});
|
|
84
|
-
return results;
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=auditRun.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auditRun.js","sourceRoot":"","sources":["../../../src/libs/core/auditRun.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,OAAO,YAAY,MAAM,aAAa,CAAC;AAIvC,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAe,MAAM,qBAAqB,CAAC;AAM9D,MAAM,UAAU,aAAa,CAAC,aAAqB;IACjD,MAAM,IAAI,GAAG,eAAe,CAAC,aAAa,CAAC,CAAC;IAC5C,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAQD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,YAAY;IAGtB;IAFlB,kBAAkB,CAAa;IAEvC,YAA0B,OAAuB;QAC/C,KAAK,EAAE,CAAC;QADgB,YAAO,GAAP,OAAO,CAAgB;IAEjD,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,OAAO,CAAC,mBAA+B;QAClD,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC,kBAAkB,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,YAAY,CAAC,IAA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IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { NamedPermissionsClassification } from './file-mgmt/schema.js';
|
|
2
|
-
/**
|
|
3
|
-
* Enum to classify user and custom permissions.
|
|
4
|
-
*/
|
|
5
|
-
export declare enum PermissionRiskLevel {
|
|
6
|
-
/** Blacklisted permissions that are considered too critical and not allowed */
|
|
7
|
-
BLOCKED = "Blocked",
|
|
8
|
-
/** Developer permissions, allow to modify the application */
|
|
9
|
-
CRITICAL = "Critical",
|
|
10
|
-
/** Admin permissions, allow to manage users and change permissions */
|
|
11
|
-
HIGH = "High",
|
|
12
|
-
/** Elevated business permissions for privileged users */
|
|
13
|
-
MEDIUM = "Medium",
|
|
14
|
-
/** Regular user permissions, typically needed for day-to-day work */
|
|
15
|
-
LOW = "Low",
|
|
16
|
-
/** Not categorized or unknown permission. Will be ignored but create a warning */
|
|
17
|
-
UNKNOWN = "Unknown"
|
|
18
|
-
}
|
|
19
|
-
export declare function resolveRiskLevelOrdinalValue(value: string): number;
|
|
20
|
-
export declare const classificationSorter: (a: NamedPermissionsClassification, b: NamedPermissionsClassification) => number;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enum to classify user and custom permissions.
|
|
3
|
-
*/
|
|
4
|
-
export var PermissionRiskLevel;
|
|
5
|
-
(function (PermissionRiskLevel) {
|
|
6
|
-
/** Blacklisted permissions that are considered too critical and not allowed */
|
|
7
|
-
PermissionRiskLevel["BLOCKED"] = "Blocked";
|
|
8
|
-
/** Developer permissions, allow to modify the application */
|
|
9
|
-
PermissionRiskLevel["CRITICAL"] = "Critical";
|
|
10
|
-
/** Admin permissions, allow to manage users and change permissions */
|
|
11
|
-
PermissionRiskLevel["HIGH"] = "High";
|
|
12
|
-
/** Elevated business permissions for privileged users */
|
|
13
|
-
PermissionRiskLevel["MEDIUM"] = "Medium";
|
|
14
|
-
/** Regular user permissions, typically needed for day-to-day work */
|
|
15
|
-
PermissionRiskLevel["LOW"] = "Low";
|
|
16
|
-
/** Not categorized or unknown permission. Will be ignored but create a warning */
|
|
17
|
-
PermissionRiskLevel["UNKNOWN"] = "Unknown";
|
|
18
|
-
})(PermissionRiskLevel || (PermissionRiskLevel = {}));
|
|
19
|
-
export function resolveRiskLevelOrdinalValue(value) {
|
|
20
|
-
return Object.keys(PermissionRiskLevel).indexOf(value.toUpperCase());
|
|
21
|
-
}
|
|
22
|
-
export const classificationSorter = (a, b) => resolveRiskLevelOrdinalValue(a.classification) - resolveRiskLevelOrdinalValue(b.classification);
|
|
23
|
-
//# sourceMappingURL=classification-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classification-types.js","sourceRoot":"","sources":["../../../src/libs/core/classification-types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,mBAaX;AAbD,WAAY,mBAAmB;IAC7B,+EAA+E;IAC/E,0CAAmB,CAAA;IACnB,6DAA6D;IAC7D,4CAAqB,CAAA;IACrB,sEAAsE;IACtE,oCAAa,CAAA;IACb,yDAAyD;IACzD,wCAAiB,CAAA;IACjB,qEAAqE;IACrE,kCAAW,CAAA;IACX,kFAAkF;IAClF,0CAAmB,CAAA;AACrB,CAAC,EAbW,mBAAmB,KAAnB,mBAAmB,QAa9B;AAED,MAAM,UAAU,4BAA4B,CAAC,KAAa;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAiC,EAAE,CAAiC,EAAU,EAAE,CACnH,4BAA4B,CAAC,CAAC,CAAC,cAAc,CAAC,GAAG,4BAA4B,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const CUSTOM_PERMS_QUERY = "SELECT Id,MasterLabel,DeveloperName FROM CustomPermission";
|
|
2
|
-
export declare const PROFILES_QUERY = "SELECT Profile.Name,Profile.UserType,IsCustom FROM PermissionSet WHERE IsOwnedByProfile = TRUE";
|
|
3
|
-
export declare const PERMISSION_SETS_QUERY = "SELECT Name,Label,IsCustom,NamespacePrefix FROM PermissionSet WHERE IsOwnedByProfile = FALSE AND NamespacePrefix = NULL";
|
|
4
|
-
export declare const CONNECTED_APPS_QUERY = "SELECT Name,OptionsAllowAdminApprovedUsersOnly FROM ConnectedApplication";
|
|
5
|
-
export declare const OAUTH_TOKEN_QUERY = "SELECT User.Username,UseCount,AppName FROM OauthToken";
|
|
6
|
-
export declare const ACTIVE_USERS_QUERY = "SELECT Id,Username,UserType FROM User WHERE IsActive = TRUE AND UserType IN ('Standard') LIMIT 2000";
|
|
7
|
-
export declare const ACTIVE_USERS_DETAILS_QUERY = "SELECT Id,Username,Profile.Name,CreatedDate,LastLoginDate FROM User WHERE IsActive = TRUE AND UserType IN ('Standard') LIMIT 2000";
|
|
8
|
-
export declare const USERS_PERMSET_ASSIGNMENTS_QUERY = "SELECT AssigneeId,PermissionSet.Name FROM PermissionSetAssignment WHERE PermissionSet.IsOwnedByProfile = FALSE AND PermissionSet.NamespacePrefix = NULL";
|
|
9
|
-
export declare const buildPermsetAssignmentsQuery: (userIds: string[]) => string;
|
|
10
|
-
export declare const buildLoginHistoryQuery: (daysToAnalayse?: number) => string;
|
|
11
|
-
export declare const RETRIEVE_CACHE: string;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
// QUERIES
|
|
3
|
-
export const CUSTOM_PERMS_QUERY = 'SELECT Id,MasterLabel,DeveloperName FROM CustomPermission';
|
|
4
|
-
export const PROFILES_QUERY = 'SELECT Profile.Name,Profile.UserType,IsCustom FROM PermissionSet WHERE IsOwnedByProfile = TRUE';
|
|
5
|
-
export const PERMISSION_SETS_QUERY = 'SELECT Name,Label,IsCustom,NamespacePrefix FROM PermissionSet WHERE IsOwnedByProfile = FALSE AND NamespacePrefix = NULL';
|
|
6
|
-
export const CONNECTED_APPS_QUERY = 'SELECT Name,OptionsAllowAdminApprovedUsersOnly FROM ConnectedApplication';
|
|
7
|
-
export const OAUTH_TOKEN_QUERY = 'SELECT User.Username,UseCount,AppName FROM OauthToken';
|
|
8
|
-
export const ACTIVE_USERS_QUERY = "SELECT Id,Username,UserType FROM User WHERE IsActive = TRUE AND UserType IN ('Standard') LIMIT 2000";
|
|
9
|
-
export const ACTIVE_USERS_DETAILS_QUERY = "SELECT Id,Username,Profile.Name,CreatedDate,LastLoginDate FROM User WHERE IsActive = TRUE AND UserType IN ('Standard') LIMIT 2000";
|
|
10
|
-
export const USERS_PERMSET_ASSIGNMENTS_QUERY = 'SELECT AssigneeId,PermissionSet.Name FROM PermissionSetAssignment WHERE PermissionSet.IsOwnedByProfile = FALSE AND PermissionSet.NamespacePrefix = NULL';
|
|
11
|
-
// DYNAMIC QUERIES
|
|
12
|
-
export const buildPermsetAssignmentsQuery = (userIds) => `${USERS_PERMSET_ASSIGNMENTS_QUERY} WHERE AssigneeId IN (${userIds.map((userId) => `'${userId}'`).join(',')})`;
|
|
13
|
-
export const buildLoginHistoryQuery = (daysToAnalayse) => daysToAnalayse
|
|
14
|
-
? `${USERS_LOGIN_HISTORY_QUERY} WHERE LoginTime >= LAST_N_DAYS:${daysToAnalayse} GROUP BY LoginType,Application,UserId`
|
|
15
|
-
: `${USERS_LOGIN_HISTORY_QUERY} GROUP BY LoginType,Application,UserId`;
|
|
16
|
-
// PATHS
|
|
17
|
-
export const RETRIEVE_CACHE = path.join('.jsc', 'retrieves');
|
|
18
|
-
// BASE QUERIES
|
|
19
|
-
const USERS_LOGIN_HISTORY_QUERY = 'SELECT LoginType,Application,UserId,COUNT(Id)LoginCount,MAX(LoginTime)LastLogin FROM LoginHistory';
|
|
20
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/libs/core/constants.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,UAAU;AACV,MAAM,CAAC,MAAM,kBAAkB,GAAG,2DAA2D,CAAC;AAC9F,MAAM,CAAC,MAAM,cAAc,GACzB,gGAAgG,CAAC;AACnG,MAAM,CAAC,MAAM,qBAAqB,GAChC,yHAAyH,CAAC;AAC5H,MAAM,CAAC,MAAM,oBAAoB,GAAG,0EAA0E,CAAC;AAC/G,MAAM,CAAC,MAAM,iBAAiB,GAAG,uDAAuD,CAAC;AACzF,MAAM,CAAC,MAAM,kBAAkB,GAC7B,qGAAqG,CAAC;AACxG,MAAM,CAAC,MAAM,0BAA0B,GACrC,mIAAmI,CAAC;AACtI,MAAM,CAAC,MAAM,+BAA+B,GAC1C,yJAAyJ,CAAC;AAE5J,kBAAkB;AAClB,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,OAAiB,EAAU,EAAE,CACxE,GAAG,+BAA+B,yBAAyB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAEjH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,cAAuB,EAAU,EAAE,CACxE,cAAc;IACZ,CAAC,CAAC,GAAG,yBAAyB,mCAAmC,cAAc,wCAAwC;IACvH,CAAC,CAAC,GAAG,yBAAyB,wCAAwC,CAAC;AAE3E,QAAQ;AACR,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAE7D,eAAe;AACf,MAAM,yBAAyB,GAC7B,mGAAmG,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { PathLike } from 'node:fs';
|
|
2
|
-
import { AuditRunConfig } from './schema.js';
|
|
3
|
-
/**
|
|
4
|
-
* Loads an audit run config with the default file manager
|
|
5
|
-
*
|
|
6
|
-
* @param dirPath
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
export declare const loadAuditConfig: (dirPath: string) => AuditRunConfig;
|
|
10
|
-
/**
|
|
11
|
-
* Saves a new or modified audit run config with the default file manager
|
|
12
|
-
*
|
|
13
|
-
* @param dirPath
|
|
14
|
-
* @param conf
|
|
15
|
-
*/
|
|
16
|
-
export declare const saveAuditConfig: (dirPath: string, conf: AuditRunConfig) => void;
|
|
17
|
-
/**
|
|
18
|
-
* The file manager streamlines initialisation of an audit config from
|
|
19
|
-
* a source directory and writing updated content back to disk. The directory
|
|
20
|
-
* structure is configurable, but most of the time using the default file manager
|
|
21
|
-
* will be enough.
|
|
22
|
-
*/
|
|
23
|
-
export default class AuditConfigFileManager {
|
|
24
|
-
private directoryStructure;
|
|
25
|
-
constructor();
|
|
26
|
-
/**
|
|
27
|
-
* Parses a directory path for policy and classification files
|
|
28
|
-
* and initialises an audit config from file contents.
|
|
29
|
-
*
|
|
30
|
-
* @param dirPath
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
parse(dirPath: PathLike): AuditRunConfig;
|
|
34
|
-
/**
|
|
35
|
-
* Writes a full audit config to disk. If the config was not
|
|
36
|
-
* saved yet, initialises filePath on each element.
|
|
37
|
-
*
|
|
38
|
-
* @param dirPath
|
|
39
|
-
* @param subdirName
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
save(targetDirPath: string, conf: AuditRunConfig): void;
|
|
43
|
-
private parseSubdir;
|
|
44
|
-
private writeClassifications;
|
|
45
|
-
private writePolicies;
|
|
46
|
-
private validateDependencies;
|
|
47
|
-
}
|
|
48
|
-
export declare const DefaultFileManager: AuditConfigFileManager;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import yaml from 'js-yaml';
|
|
4
|
-
import { Messages } from '@salesforce/core';
|
|
5
|
-
import { isEmpty } from '../utils.js';
|
|
6
|
-
import { classificationDefs, policyDefs } from '../policyRegistry.js';
|
|
7
|
-
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
8
|
-
const messages = Messages.loadMessages('@j-schreiber/sf-cli-security-audit', 'org.audit.run');
|
|
9
|
-
/**
|
|
10
|
-
* Loads an audit run config with the default file manager
|
|
11
|
-
*
|
|
12
|
-
* @param dirPath
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
export const loadAuditConfig = (dirPath) => DefaultFileManager.parse(dirPath);
|
|
16
|
-
/**
|
|
17
|
-
* Saves a new or modified audit run config with the default file manager
|
|
18
|
-
*
|
|
19
|
-
* @param dirPath
|
|
20
|
-
* @param conf
|
|
21
|
-
*/
|
|
22
|
-
export const saveAuditConfig = (dirPath, conf) => {
|
|
23
|
-
DefaultFileManager.save(dirPath, conf);
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* The file manager streamlines initialisation of an audit config from
|
|
27
|
-
* a source directory and writing updated content back to disk. The directory
|
|
28
|
-
* structure is configurable, but most of the time using the default file manager
|
|
29
|
-
* will be enough.
|
|
30
|
-
*/
|
|
31
|
-
export default class AuditConfigFileManager {
|
|
32
|
-
directoryStructure;
|
|
33
|
-
constructor() {
|
|
34
|
-
this.directoryStructure = {
|
|
35
|
-
policies: policyDefs,
|
|
36
|
-
classifications: classificationDefs,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Parses a directory path for policy and classification files
|
|
41
|
-
* and initialises an audit config from file contents.
|
|
42
|
-
*
|
|
43
|
-
* @param dirPath
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
parse(dirPath) {
|
|
47
|
-
const classifications = this.parseSubdir(dirPath, 'classifications');
|
|
48
|
-
const policies = this.parseSubdir(dirPath, 'policies');
|
|
49
|
-
const conf = { classifications, policies };
|
|
50
|
-
assertIsMinimalConfig(conf, dirPath);
|
|
51
|
-
this.validateDependencies(conf);
|
|
52
|
-
return conf;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Writes a full audit config to disk. If the config was not
|
|
56
|
-
* saved yet, initialises filePath on each element.
|
|
57
|
-
*
|
|
58
|
-
* @param dirPath
|
|
59
|
-
* @param subdirName
|
|
60
|
-
* @returns
|
|
61
|
-
*/
|
|
62
|
-
save(targetDirPath, conf) {
|
|
63
|
-
this.writeClassifications(conf.classifications, targetDirPath);
|
|
64
|
-
this.writePolicies(conf.policies, targetDirPath);
|
|
65
|
-
}
|
|
66
|
-
parseSubdir(dirPath, subdirName) {
|
|
67
|
-
const parseResults = {};
|
|
68
|
-
Object.entries(this.directoryStructure[subdirName]).forEach(([fileName, fileConfig]) => {
|
|
69
|
-
const filePath = path.join(dirPath.toString(), subdirName, `${fileName}.yml`);
|
|
70
|
-
if (fs.existsSync(filePath)) {
|
|
71
|
-
const fileContent = yaml.load(fs.readFileSync(filePath, 'utf-8'));
|
|
72
|
-
const content = fileConfig.schema.parse(fileContent);
|
|
73
|
-
parseResults[fileName] = { filePath, content };
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return parseResults;
|
|
77
|
-
}
|
|
78
|
-
writeClassifications(content, targetDirPath) {
|
|
79
|
-
const dirPath = path.join(targetDirPath.toString(), 'classifications');
|
|
80
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
81
|
-
const dirConf = this.directoryStructure.classifications;
|
|
82
|
-
Object.entries(content).forEach(([fileKey, confFile]) => {
|
|
83
|
-
const fileDef = dirConf[fileKey];
|
|
84
|
-
if (fileDef && !isEmpty(confFile.content)) {
|
|
85
|
-
// eslint-disable-next-line no-param-reassign
|
|
86
|
-
confFile.filePath = path.join(dirPath, `${fileKey}.yml`);
|
|
87
|
-
fs.writeFileSync(confFile.filePath, yaml.dump(confFile.content));
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
writePolicies(content, targetDirPath) {
|
|
92
|
-
const dirPath = path.join(targetDirPath.toString(), 'policies');
|
|
93
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
94
|
-
const dirConf = this.directoryStructure.policies;
|
|
95
|
-
Object.entries(content).forEach(([fileKey, confFile]) => {
|
|
96
|
-
const fileDef = dirConf[fileKey];
|
|
97
|
-
if (fileDef && !isEmpty(confFile.content)) {
|
|
98
|
-
// eslint-disable-next-line no-param-reassign
|
|
99
|
-
confFile.filePath = path.join(dirPath, `${fileKey}.yml`);
|
|
100
|
-
fs.writeFileSync(confFile.filePath, yaml.dump(confFile.content));
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
validateDependencies(conf) {
|
|
105
|
-
Object.keys(conf.policies).forEach((policyName) => {
|
|
106
|
-
const policyDef = this.directoryStructure.policies[policyName];
|
|
107
|
-
if (policyDef?.dependencies) {
|
|
108
|
-
policyDef.dependencies.forEach((dependency) => {
|
|
109
|
-
if (!dependencyExists(dependency.path, conf)) {
|
|
110
|
-
throw messages.createError(dependency.errorName);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
function dependencyExists(fullPath, rootNode) {
|
|
118
|
-
const dep = traverseDependencyPath(fullPath, rootNode);
|
|
119
|
-
return Boolean(dep);
|
|
120
|
-
}
|
|
121
|
-
function traverseDependencyPath(remainingPath, rootNode) {
|
|
122
|
-
if (remainingPath.length >= 2) {
|
|
123
|
-
return traverseDependencyPath(remainingPath.slice(1), rootNode[remainingPath[0]]);
|
|
124
|
-
}
|
|
125
|
-
else if (remainingPath.length === 0) {
|
|
126
|
-
return undefined;
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
return rootNode[remainingPath[0]];
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
function assertIsMinimalConfig(conf, dirPath) {
|
|
133
|
-
if (Object.keys(conf.policies).length === 0) {
|
|
134
|
-
const formattedDirPath = !dirPath || dirPath.toString().length === 0 ? '<root-dir>' : dirPath.toString();
|
|
135
|
-
throw messages.createError('NoAuditConfigFound', [formattedDirPath]);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
export const DefaultFileManager = new AuditConfigFileManager();
|
|
139
|
-
//# sourceMappingURL=auditConfigFileManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auditConfigFileManager.js","sourceRoot":"","sources":["../../../../src/libs/core/file-mgmt/auditConfigFileManager.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAgB,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAuB,UAAU,EAAe,MAAM,sBAAsB,CAAC;AAGxG,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,oCAAoC,EAAE,eAAe,CAAC,CAAC;AAE9F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAe,EAAkB,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAEtG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAe,EAAE,IAAoB,EAAQ,EAAE;IAC7E,kBAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAsB;IACjC,kBAAkB,CAAC;IAE3B;QACE,IAAI,CAAC,kBAAkB,GAAG;YACxB,QAAQ,EAAE,UAAU;YACpB,eAAe,E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AAC,CAAC;IACvD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;AACtB,CAAC;AAED,SAAS,sBAAsB,CAAC,aAAuB,EAAE,QAAiC;IACxF,IAAI,aAAa,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,sBAAsB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAA4B,CAAC,CAAC;IAC/G,CAAC;SAAM,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC;IACnB,CAAC;SAAM,CAAC;QACN,OAAO,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAoB,EAAE,OAAiB;IACpE,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5C,MAAM,gBAAgB,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzG,MAAM,QAAQ,CAAC,WAAW,CAAC,oBAAoB,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
import { PermissionRiskLevel } from '../classification-types.js';
|
|
3
|
-
import { ProfilesRiskPreset } from '../policy-types.js';
|
|
4
|
-
declare const PermissionsClassificationSchema: z.ZodObject<{
|
|
5
|
-
label: z.ZodOptional<z.ZodString>;
|
|
6
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
7
|
-
classification: z.ZodEnum<typeof PermissionRiskLevel>;
|
|
8
|
-
}, z.z.core.$strip>;
|
|
9
|
-
declare const PermsClassificationsMapSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
10
|
-
label: z.ZodOptional<z.ZodString>;
|
|
11
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
12
|
-
classification: z.ZodEnum<typeof PermissionRiskLevel>;
|
|
13
|
-
}, z.z.core.$strip>>;
|
|
14
|
-
declare const NamedPermissionsClassificationSchema: z.ZodObject<{
|
|
15
|
-
label: z.ZodOptional<z.ZodString>;
|
|
16
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
17
|
-
classification: z.ZodEnum<typeof PermissionRiskLevel>;
|
|
18
|
-
name: z.ZodString;
|
|
19
|
-
}, z.z.core.$strip>;
|
|
20
|
-
declare const PolicyRuleConfigSchema: z.ZodObject<{
|
|
21
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
22
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
23
|
-
}, z.z.core.$strip>;
|
|
24
|
-
declare const RuleMapSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
25
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
26
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
27
|
-
}, z.z.core.$strip>>;
|
|
28
|
-
declare const PermSetConfig: z.ZodObject<{
|
|
29
|
-
preset: z.ZodEnum<typeof ProfilesRiskPreset>;
|
|
30
|
-
}, z.z.core.$strip>;
|
|
31
|
-
declare const PermSetMap: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
32
|
-
preset: z.ZodEnum<typeof ProfilesRiskPreset>;
|
|
33
|
-
}, z.z.core.$strip>>;
|
|
34
|
-
export declare const UsersPolicyConfig: z.ZodObject<{
|
|
35
|
-
defaultRoleForMissingUsers: z.ZodDefault<z.ZodEnum<typeof ProfilesRiskPreset>>;
|
|
36
|
-
analyseLastNDaysOfLoginHistory: z.ZodOptional<z.ZodNumber>;
|
|
37
|
-
}, z.z.core.$strip>;
|
|
38
|
-
export declare const NoInactiveUsersOptionsSchema: z.ZodObject<{
|
|
39
|
-
daysAfterUserIsInactive: z.ZodDefault<z.ZodNumber>;
|
|
40
|
-
}, z.z.core.$strip>;
|
|
41
|
-
export declare const PolicyFileSchema: z.ZodObject<{
|
|
42
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
43
|
-
rules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
44
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
45
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
46
|
-
}, z.z.core.$strip>>>;
|
|
47
|
-
}, z.z.core.$strip>;
|
|
48
|
-
export declare const ProfilesPolicyFileSchema: z.ZodObject<{
|
|
49
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
50
|
-
rules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
51
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
53
|
-
}, z.z.core.$strip>>>;
|
|
54
|
-
profiles: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
55
|
-
preset: z.ZodEnum<typeof ProfilesRiskPreset>;
|
|
56
|
-
}, z.z.core.$strip>>;
|
|
57
|
-
}, z.z.core.$strip>;
|
|
58
|
-
export declare const PermSetsPolicyFileSchema: z.ZodObject<{
|
|
59
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
60
|
-
rules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
61
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
62
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
63
|
-
}, z.z.core.$strip>>>;
|
|
64
|
-
permissionSets: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
65
|
-
preset: z.ZodEnum<typeof ProfilesRiskPreset>;
|
|
66
|
-
}, z.z.core.$strip>>;
|
|
67
|
-
}, z.z.core.$strip>;
|
|
68
|
-
export declare const PermissionsConfigFileSchema: z.ZodObject<{
|
|
69
|
-
permissions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
70
|
-
label: z.ZodOptional<z.ZodString>;
|
|
71
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
72
|
-
classification: z.ZodEnum<typeof PermissionRiskLevel>;
|
|
73
|
-
}, z.z.core.$strip>>;
|
|
74
|
-
}, z.z.core.$strip>;
|
|
75
|
-
export declare const UsersPolicyFileSchema: z.ZodObject<{
|
|
76
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
77
|
-
rules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
78
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
79
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
80
|
-
}, z.z.core.$strip>>>;
|
|
81
|
-
users: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
82
|
-
role: z.ZodEnum<typeof ProfilesRiskPreset>;
|
|
83
|
-
}, z.z.core.$strip>>;
|
|
84
|
-
options: z.ZodObject<{
|
|
85
|
-
defaultRoleForMissingUsers: z.ZodDefault<z.ZodEnum<typeof ProfilesRiskPreset>>;
|
|
86
|
-
analyseLastNDaysOfLoginHistory: z.ZodOptional<z.ZodNumber>;
|
|
87
|
-
}, z.z.core.$strip>;
|
|
88
|
-
}, z.z.core.$strip>;
|
|
89
|
-
export type PermissionsClassification = z.infer<typeof PermissionsClassificationSchema>;
|
|
90
|
-
export type NamedPermissionsClassification = z.infer<typeof NamedPermissionsClassificationSchema>;
|
|
91
|
-
export type PermsClassificationsMap = z.infer<typeof PermsClassificationsMapSchema>;
|
|
92
|
-
export type PermissionsConfig = z.infer<typeof PermissionsConfigFileSchema>;
|
|
93
|
-
export type NoInactiveUsersOptions = z.infer<typeof NoInactiveUsersOptionsSchema>;
|
|
94
|
-
export type PolicyRuleConfig = z.infer<typeof PolicyRuleConfigSchema>;
|
|
95
|
-
export type BasePolicyFileContent = z.infer<typeof PolicyFileSchema>;
|
|
96
|
-
export type ProfilesPolicyFileContent = z.infer<typeof ProfilesPolicyFileSchema>;
|
|
97
|
-
export type PermSetsPolicyFileContent = z.infer<typeof PermSetsPolicyFileSchema>;
|
|
98
|
-
export type UsersPolicyFileContent = z.infer<typeof UsersPolicyFileSchema>;
|
|
99
|
-
export type PermissionSetConfig = z.infer<typeof PermSetConfig>;
|
|
100
|
-
export type PermissionSetLikeMap = z.infer<typeof PermSetMap>;
|
|
101
|
-
export type RuleMap = z.infer<typeof RuleMapSchema>;
|
|
102
|
-
export type ConfigFile<T> = {
|
|
103
|
-
filePath?: string;
|
|
104
|
-
content: T;
|
|
105
|
-
};
|
|
106
|
-
export type AuditRunConfigClassifications = {
|
|
107
|
-
userPermissions?: ConfigFile<PermissionsConfig>;
|
|
108
|
-
customPermissions?: ConfigFile<PermissionsConfig>;
|
|
109
|
-
};
|
|
110
|
-
export type AuditRunConfigPolicies = {
|
|
111
|
-
profiles?: ConfigFile<ProfilesPolicyFileContent>;
|
|
112
|
-
permissionSets?: ConfigFile<PermSetsPolicyFileContent>;
|
|
113
|
-
connectedApps?: ConfigFile<BasePolicyFileContent>;
|
|
114
|
-
users?: ConfigFile<UsersPolicyFileContent>;
|
|
115
|
-
};
|
|
116
|
-
export type AuditRunConfig = {
|
|
117
|
-
classifications: AuditRunConfigClassifications;
|
|
118
|
-
policies: AuditRunConfigPolicies;
|
|
119
|
-
};
|
|
120
|
-
export declare function isPermissionsConfig(cls: unknown): cls is ConfigFile<PermissionsConfig>;
|
|
121
|
-
export declare function isPolicyConfig(cls: unknown): cls is ConfigFile<BasePolicyFileContent>;
|
|
122
|
-
export {};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
import { PermissionRiskLevel } from '../classification-types.js';
|
|
3
|
-
import { ProfilesRiskPreset } from '../policy-types.js';
|
|
4
|
-
const PermissionsClassificationSchema = z.object({
|
|
5
|
-
/** UI Label */
|
|
6
|
-
label: z.string().optional(),
|
|
7
|
-
/** An optional description to explain the classification */
|
|
8
|
-
reason: z.string().optional(),
|
|
9
|
-
/** Risk assessment of the permissions */
|
|
10
|
-
classification: z.enum(PermissionRiskLevel),
|
|
11
|
-
});
|
|
12
|
-
const PermsClassificationsMapSchema = z.record(z.string(), PermissionsClassificationSchema);
|
|
13
|
-
const NamedPermissionsClassificationSchema = PermissionsClassificationSchema.extend({
|
|
14
|
-
/** Developer name of the permission, used in metadata */
|
|
15
|
-
name: z.string(),
|
|
16
|
-
});
|
|
17
|
-
const PolicyRuleConfigSchema = z.object({
|
|
18
|
-
enabled: z.boolean().default(true),
|
|
19
|
-
options: z.unknown().optional(),
|
|
20
|
-
});
|
|
21
|
-
const RuleMapSchema = z.record(z.string(), PolicyRuleConfigSchema);
|
|
22
|
-
const PermSetConfig = z.object({
|
|
23
|
-
preset: z.enum(ProfilesRiskPreset),
|
|
24
|
-
});
|
|
25
|
-
const PermSetMap = z.record(z.string(), PermSetConfig);
|
|
26
|
-
const UserConfig = z.object({ role: z.enum(ProfilesRiskPreset) });
|
|
27
|
-
const UsersMap = z.record(z.string(), UserConfig);
|
|
28
|
-
export const UsersPolicyConfig = z.object({
|
|
29
|
-
defaultRoleForMissingUsers: z.enum(ProfilesRiskPreset).default(ProfilesRiskPreset.STANDARD_USER),
|
|
30
|
-
analyseLastNDaysOfLoginHistory: z.number().optional(),
|
|
31
|
-
});
|
|
32
|
-
export const NoInactiveUsersOptionsSchema = z.object({
|
|
33
|
-
daysAfterUserIsInactive: z.number().default(90),
|
|
34
|
-
});
|
|
35
|
-
// FILE CONTENT SCHEMATA
|
|
36
|
-
export const PolicyFileSchema = z.object({
|
|
37
|
-
enabled: z.boolean().default(true),
|
|
38
|
-
rules: RuleMapSchema.default({}),
|
|
39
|
-
});
|
|
40
|
-
export const ProfilesPolicyFileSchema = PolicyFileSchema.extend({
|
|
41
|
-
profiles: PermSetMap,
|
|
42
|
-
});
|
|
43
|
-
export const PermSetsPolicyFileSchema = PolicyFileSchema.extend({
|
|
44
|
-
permissionSets: PermSetMap,
|
|
45
|
-
});
|
|
46
|
-
export const PermissionsConfigFileSchema = z.object({
|
|
47
|
-
permissions: z.record(z.string(), PermissionsClassificationSchema),
|
|
48
|
-
});
|
|
49
|
-
export const UsersPolicyFileSchema = PolicyFileSchema.extend({
|
|
50
|
-
users: UsersMap,
|
|
51
|
-
options: UsersPolicyConfig,
|
|
52
|
-
});
|
|
53
|
-
export function isPermissionsConfig(cls) {
|
|
54
|
-
return cls.content?.permissions !== undefined;
|
|
55
|
-
}
|
|
56
|
-
export function isPolicyConfig(cls) {
|
|
57
|
-
return cls.content?.rules !== undefined;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/libs/core/file-mgmt/schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,eAAe;IACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,4DAA4D;IAC5D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,yCAAyC;IACzC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC;CAC5C,CAAC,CAAC;AAEH,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,+BAA+B,CAAC,CAAC;AAE5F,MAAM,oCAAoC,GAAG,+BAA+B,CAAC,MAAM,CAAC;IAClF,y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B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAClC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;CACjC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,gBAAgB,CAAC,MAAM,CAAC;IAC9D,QAAQ,EAAE,UAAU;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,gBAAgB,CAAC,MAAM,CAAC;IAC9D,cAAc,EAAE,UAAU;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,+BAA+B,CAAC;CACnE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,gBAAgB,CAAC,MAAM,CAAC;IAC3D,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,iBAAiB;CAC3B,CAAC,CAAC;AA+CH,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,OAAQ,GAAqC,CAAC,OAAO,EAAE,WAAW,KAAK,SAAS,CAAC;AACnF,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAY;IACzC,OAAQ,GAAyC,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC;AACjF,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Connection } from '@salesforce/core';
|
|
2
|
-
import { ConnectedAppSettings, PermissionSet, Profile as ProfileMetadata } from '@jsforce/jsforce-node/lib/api/metadata.js';
|
|
3
|
-
import NamedMetadata from './namedMetadataType.js';
|
|
4
|
-
import SingletonMetadata from './singletonMetadataType.js';
|
|
5
|
-
import NamedMetadataQueryable from './namedMetadataToolingQueryable.js';
|
|
6
|
-
export default class MDAPI {
|
|
7
|
-
private connection;
|
|
8
|
-
private static retrievers;
|
|
9
|
-
private cache;
|
|
10
|
-
constructor(connection: Connection);
|
|
11
|
-
static create(connection: Connection): MDAPI;
|
|
12
|
-
/**
|
|
13
|
-
* Resolves one of the pre-configured metadata types and returns
|
|
14
|
-
* a map of resolved names and entire XML content of source file body.
|
|
15
|
-
*
|
|
16
|
-
* @param typeName
|
|
17
|
-
* @param componentNames
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
resolve<K extends keyof typeof NamedTypesRegistry>(typeName: K, componentNames: string[]): Promise<NamedReturnTypes[K]>;
|
|
21
|
-
/**
|
|
22
|
-
* Resolves one of the pre-configured metadata types and returns
|
|
23
|
-
* the entire XML content of source file body.
|
|
24
|
-
*
|
|
25
|
-
* @param typeName
|
|
26
|
-
* @returns
|
|
27
|
-
*/
|
|
28
|
-
resolveSingleton<K extends keyof typeof SingletonRegistry>(typeName: K): Promise<SingletonReturnTypes[K]>;
|
|
29
|
-
private cacheResults;
|
|
30
|
-
private fetchCached;
|
|
31
|
-
}
|
|
32
|
-
export declare const NamedTypesRegistry: {
|
|
33
|
-
PermissionSet: NamedMetadata<PermissionSetXml, "PermissionSet">;
|
|
34
|
-
Profile: NamedMetadataQueryable<ProfileXml, "Profile">;
|
|
35
|
-
};
|
|
36
|
-
export declare const SingletonRegistry: {
|
|
37
|
-
ConnectedAppSettings: SingletonMetadata<ConnectedAppSettingsXml, "ConnectedAppSettings">;
|
|
38
|
-
};
|
|
39
|
-
type NamedReturnTypes = {
|
|
40
|
-
[K in keyof typeof NamedTypesRegistry]: Awaited<ReturnType<(typeof NamedTypesRegistry)[K]['resolve']>>;
|
|
41
|
-
};
|
|
42
|
-
type SingletonReturnTypes = {
|
|
43
|
-
[K in keyof typeof SingletonRegistry]: Awaited<ReturnType<(typeof SingletonRegistry)[K]['resolve']>>;
|
|
44
|
-
};
|
|
45
|
-
type ProfileXml = {
|
|
46
|
-
Profile: ProfileMetadata;
|
|
47
|
-
};
|
|
48
|
-
type PermissionSetXml = {
|
|
49
|
-
PermissionSet: PermissionSet;
|
|
50
|
-
};
|
|
51
|
-
type ConnectedAppSettingsXml = {
|
|
52
|
-
ConnectedAppSettings: ConnectedAppSettings;
|
|
53
|
-
};
|
|
54
|
-
export {};
|