@j-schreiber/sf-cli-security-audit 0.8.2 → 0.8.3
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/lib/commands/org/audit/init.d.ts +19 -0
- package/lib/commands/org/audit/init.js +72 -0
- package/lib/commands/org/audit/init.js.map +1 -0
- package/lib/commands/org/audit/run.d.ts +23 -0
- package/lib/commands/org/audit/run.js +124 -0
- package/lib/commands/org/audit/run.js.map +1 -0
- package/lib/commands/org/scan/user-perms.d.ts +20 -0
- package/lib/commands/org/scan/user-perms.js +87 -0
- package/lib/commands/org/scan/user-perms.js.map +1 -0
- package/lib/libs/conf-init/auditConfig.d.ts +35 -0
- package/lib/libs/conf-init/auditConfig.js +41 -0
- package/lib/libs/conf-init/auditConfig.js.map +1 -0
- package/lib/libs/conf-init/permissionsClassification.d.ts +17 -0
- package/lib/libs/conf-init/permissionsClassification.js +80 -0
- package/lib/libs/conf-init/permissionsClassification.js.map +1 -0
- package/lib/libs/conf-init/policyConfigs.d.ts +31 -0
- package/lib/libs/conf-init/policyConfigs.js +91 -0
- package/lib/libs/conf-init/policyConfigs.js.map +1 -0
- package/lib/libs/conf-init/presets/loose.d.ts +6 -0
- package/lib/libs/conf-init/presets/loose.js +85 -0
- package/lib/libs/conf-init/presets/loose.js.map +1 -0
- package/lib/libs/conf-init/presets/none.d.ts +30 -0
- package/lib/libs/conf-init/presets/none.js +54 -0
- package/lib/libs/conf-init/presets/none.js.map +1 -0
- package/lib/libs/conf-init/presets/strict.d.ts +4 -0
- package/lib/libs/conf-init/presets/strict.js +79 -0
- package/lib/libs/conf-init/presets/strict.js.map +1 -0
- package/lib/libs/conf-init/presets.d.ts +7 -0
- package/lib/libs/conf-init/presets.js +20 -0
- package/lib/libs/conf-init/presets.js.map +1 -0
- package/lib/libs/core/auditRun.d.ts +36 -0
- package/lib/libs/core/auditRun.js +86 -0
- package/lib/libs/core/auditRun.js.map +1 -0
- package/lib/libs/core/classification-types.d.ts +20 -0
- package/lib/libs/core/classification-types.js +23 -0
- package/lib/libs/core/classification-types.js.map +1 -0
- package/lib/libs/core/constants.d.ts +10 -0
- package/lib/libs/core/constants.js +20 -0
- package/lib/libs/core/constants.js.map +1 -0
- package/lib/libs/core/file-mgmt/auditConfigFileManager.d.ts +48 -0
- package/lib/libs/core/file-mgmt/auditConfigFileManager.js +145 -0
- package/lib/libs/core/file-mgmt/auditConfigFileManager.js.map +1 -0
- package/lib/libs/core/file-mgmt/schema.d.ts +123 -0
- package/lib/libs/core/file-mgmt/schema.js +69 -0
- package/lib/libs/core/file-mgmt/schema.js.map +1 -0
- package/lib/libs/core/mdapi/mdapiRetriever.d.ts +54 -0
- package/lib/libs/core/mdapi/mdapiRetriever.js +123 -0
- package/lib/libs/core/mdapi/mdapiRetriever.js.map +1 -0
- package/lib/libs/core/mdapi/metadataRegistryEntry.d.ts +40 -0
- package/lib/libs/core/mdapi/metadataRegistryEntry.js +46 -0
- package/lib/libs/core/mdapi/metadataRegistryEntry.js.map +1 -0
- package/lib/libs/core/mdapi/namedMetadataToolingQueryable.d.ts +33 -0
- package/lib/libs/core/mdapi/namedMetadataToolingQueryable.js +41 -0
- package/lib/libs/core/mdapi/namedMetadataToolingQueryable.js.map +1 -0
- package/lib/libs/core/mdapi/namedMetadataType.d.ts +20 -0
- package/lib/libs/core/mdapi/namedMetadataType.js +41 -0
- package/lib/libs/core/mdapi/namedMetadataType.js.map +1 -0
- package/lib/libs/core/mdapi/singletonMetadataType.d.ts +21 -0
- package/lib/libs/core/mdapi/singletonMetadataType.js +37 -0
- package/lib/libs/core/mdapi/singletonMetadataType.js.map +1 -0
- package/lib/libs/core/mdapi/usersRepository.d.ts +85 -0
- package/lib/libs/core/mdapi/usersRepository.js +126 -0
- package/lib/libs/core/mdapi/usersRepository.js.map +1 -0
- package/lib/libs/core/policies/connectedAppPolicy.d.ts +10 -0
- package/lib/libs/core/policies/connectedAppPolicy.js +78 -0
- package/lib/libs/core/policies/connectedAppPolicy.js.map +1 -0
- package/lib/libs/core/policies/permissionSetPolicy.d.ts +11 -0
- package/lib/libs/core/policies/permissionSetPolicy.js +62 -0
- package/lib/libs/core/policies/permissionSetPolicy.js.map +1 -0
- package/lib/libs/core/policies/policy.d.ts +31 -0
- package/lib/libs/core/policies/policy.js +100 -0
- package/lib/libs/core/policies/policy.js.map +1 -0
- package/lib/libs/core/policies/profilePolicy.d.ts +11 -0
- package/lib/libs/core/policies/profilePolicy.js +64 -0
- package/lib/libs/core/policies/profilePolicy.js.map +1 -0
- package/lib/libs/core/policies/salesforceStandardTypes.d.ts +58 -0
- package/lib/libs/core/policies/salesforceStandardTypes.js +2 -0
- package/lib/libs/core/policies/salesforceStandardTypes.js.map +1 -0
- package/lib/libs/core/policies/userPolicy.d.ts +11 -0
- package/lib/libs/core/policies/userPolicy.js +60 -0
- package/lib/libs/core/policies/userPolicy.js.map +1 -0
- package/lib/libs/core/policy-types.d.ts +18 -0
- package/lib/libs/core/policy-types.js +28 -0
- package/lib/libs/core/policy-types.js.map +1 -0
- package/lib/libs/core/policyRegistry.d.ts +23 -0
- package/lib/libs/core/policyRegistry.js +38 -0
- package/lib/libs/core/policyRegistry.js.map +1 -0
- package/lib/libs/core/registries/connectedApps.d.ts +13 -0
- package/lib/libs/core/registries/connectedApps.js +13 -0
- package/lib/libs/core/registries/connectedApps.js.map +1 -0
- package/lib/libs/core/registries/helpers/permissionsScanning.d.ts +29 -0
- package/lib/libs/core/registries/helpers/permissionsScanning.js +69 -0
- package/lib/libs/core/registries/helpers/permissionsScanning.js.map +1 -0
- package/lib/libs/core/registries/permissionSets.d.ts +11 -0
- package/lib/libs/core/registries/permissionSets.js +11 -0
- package/lib/libs/core/registries/permissionSets.js.map +1 -0
- package/lib/libs/core/registries/profiles.d.ts +11 -0
- package/lib/libs/core/registries/profiles.js +11 -0
- package/lib/libs/core/registries/profiles.js.map +1 -0
- package/lib/libs/core/registries/ruleRegistry.d.ts +37 -0
- package/lib/libs/core/registries/ruleRegistry.js +48 -0
- package/lib/libs/core/registries/ruleRegistry.js.map +1 -0
- package/lib/libs/core/registries/rules/allUsedAppsUnderManagement.d.ts +7 -0
- package/lib/libs/core/registries/rules/allUsedAppsUnderManagement.js +23 -0
- package/lib/libs/core/registries/rules/allUsedAppsUnderManagement.js.map +1 -0
- package/lib/libs/core/registries/rules/enforcePermissionPresets.d.ts +7 -0
- package/lib/libs/core/registries/rules/enforcePermissionPresets.js +58 -0
- package/lib/libs/core/registries/rules/enforcePermissionPresets.js.map +1 -0
- package/lib/libs/core/registries/rules/enforcePermissionsOnProfileLike.d.ts +7 -0
- package/lib/libs/core/registries/rules/enforcePermissionsOnProfileLike.js +26 -0
- package/lib/libs/core/registries/rules/enforcePermissionsOnProfileLike.js.map +1 -0
- package/lib/libs/core/registries/rules/enforcePermissionsOnUser.d.ts +8 -0
- package/lib/libs/core/registries/rules/enforcePermissionsOnUser.js +42 -0
- package/lib/libs/core/registries/rules/enforcePermissionsOnUser.js.map +1 -0
- package/lib/libs/core/registries/rules/noInactiveUsers.d.ts +9 -0
- package/lib/libs/core/registries/rules/noInactiveUsers.js +44 -0
- package/lib/libs/core/registries/rules/noInactiveUsers.js.map +1 -0
- package/lib/libs/core/registries/rules/noOtherApexApiLogins.d.ts +7 -0
- package/lib/libs/core/registries/rules/noOtherApexApiLogins.js +27 -0
- package/lib/libs/core/registries/rules/noOtherApexApiLogins.js.map +1 -0
- package/lib/libs/core/registries/rules/noUserCanSelfAuthorize.d.ts +7 -0
- package/lib/libs/core/registries/rules/noUserCanSelfAuthorize.js +31 -0
- package/lib/libs/core/registries/rules/noUserCanSelfAuthorize.js.map +1 -0
- package/lib/libs/core/registries/rules/policyRule.d.ts +19 -0
- package/lib/libs/core/registries/rules/policyRule.js +32 -0
- package/lib/libs/core/registries/rules/policyRule.js.map +1 -0
- package/lib/libs/core/registries/types.d.ts +37 -0
- package/lib/libs/core/registries/types.js +11 -0
- package/lib/libs/core/registries/types.js.map +1 -0
- package/lib/libs/core/registries/users.d.ts +10 -0
- package/lib/libs/core/registries/users.js +17 -0
- package/lib/libs/core/registries/users.js.map +1 -0
- package/lib/libs/core/result-types.d.ts +172 -0
- package/lib/libs/core/result-types.js +2 -0
- package/lib/libs/core/result-types.js.map +1 -0
- package/lib/libs/core/utils.d.ts +12 -0
- package/lib/libs/core/utils.js +31 -0
- package/lib/libs/core/utils.js.map +1 -0
- package/lib/libs/quick-scan/types.d.ts +17 -0
- package/lib/libs/quick-scan/types.js +2 -0
- package/lib/libs/quick-scan/types.js.map +1 -0
- package/lib/libs/quick-scan/userPermissionScanner.d.ts +22 -0
- package/lib/libs/quick-scan/userPermissionScanner.js +75 -0
- package/lib/libs/quick-scan/userPermissionScanner.js.map +1 -0
- package/lib/ux/auditRunMultiStage.d.ts +65 -0
- package/lib/ux/auditRunMultiStage.js +120 -0
- package/lib/ux/auditRunMultiStage.js.map +1 -0
- package/oclif.manifest.json +253 -2
- package/package.json +1 -1
- package/bin/dev.js +0 -8
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { MultiStageOutput } from '@oclif/multi-stage-output';
|
|
2
|
+
import { capitalize } from '../libs/core/utils.js';
|
|
3
|
+
export const LOAD_AUDIT_CONFIG = 'Loading audit config';
|
|
4
|
+
export const RESOLVE_POLICIES = 'Resolving policies';
|
|
5
|
+
export const EXECUTE_RULES = 'Executing rules';
|
|
6
|
+
export const FINALISE = 'Formatting results';
|
|
7
|
+
export default class AuditRunMultiStageOutput {
|
|
8
|
+
mso;
|
|
9
|
+
stageSpecificBlocks;
|
|
10
|
+
polStats;
|
|
11
|
+
constructor(opts) {
|
|
12
|
+
this.stageSpecificBlocks = opts.stageSpecificBlock;
|
|
13
|
+
this.mso = AuditRunMultiStageOutput.initUx(opts);
|
|
14
|
+
this.polStats = {};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* In unit tests, we stub the actual UX class to hide output in terminal.
|
|
18
|
+
*
|
|
19
|
+
* @param opts
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
static initUx(opts) {
|
|
23
|
+
return new MultiStageOutput(opts);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* This pattern allows to stub multi-stage outputs in tests to mute output
|
|
27
|
+
* to stdout during test execution.
|
|
28
|
+
*
|
|
29
|
+
* In your code, create a new instance like this
|
|
30
|
+
* ```
|
|
31
|
+
* const ms = AuditRunMultiStageOutput.create(sobj, flags.json);
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param opts
|
|
35
|
+
* @param jsonEnabled
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
static create(opts) {
|
|
39
|
+
return new AuditRunMultiStageOutput({
|
|
40
|
+
jsonEnabled: opts.jsonEnabled ?? false,
|
|
41
|
+
stages: [LOAD_AUDIT_CONFIG, RESOLVE_POLICIES, EXECUTE_RULES, FINALISE],
|
|
42
|
+
title: 'Auditing Org',
|
|
43
|
+
preStagesBlock: [
|
|
44
|
+
{
|
|
45
|
+
type: 'message',
|
|
46
|
+
get: () => `Auditing ${opts.targetOrg} with config from ${opts.directoryRootPath}`,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
postStagesBlock: [
|
|
50
|
+
{
|
|
51
|
+
type: 'static-key-value',
|
|
52
|
+
label: 'Status',
|
|
53
|
+
get: (data) => data?.currentStatus,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
stageSpecificBlock: [],
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
start() {
|
|
60
|
+
this.mso.goto(LOAD_AUDIT_CONFIG, { currentStatus: 'Initialising' });
|
|
61
|
+
}
|
|
62
|
+
startPolicyResolve(runInstance) {
|
|
63
|
+
this.mso.goto(RESOLVE_POLICIES, { currentStatus: 'Resolving' });
|
|
64
|
+
Object.entries(runInstance.configs.policies).forEach(([policyName, policy]) => {
|
|
65
|
+
if (policy.content.enabled) {
|
|
66
|
+
this.addPolicyStatsListener(policyName, runInstance);
|
|
67
|
+
this.stageSpecificBlocks.push({
|
|
68
|
+
stage: RESOLVE_POLICIES,
|
|
69
|
+
type: 'dynamic-key-value',
|
|
70
|
+
label: capitalize(policyName),
|
|
71
|
+
get: (data) => {
|
|
72
|
+
if (data?.policies?.[policyName]) {
|
|
73
|
+
return `${data.policies[policyName].resolved ?? 0}/${data.policies[policyName].total ?? 0}`;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return '';
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
if (policy.content.rules && Object.keys(policy.content.rules).length > 0) {
|
|
81
|
+
const enabledRules = Object.values(policy.content.rules).filter((ruleConfig) => ruleConfig.enabled).length;
|
|
82
|
+
this.stageSpecificBlocks.push({
|
|
83
|
+
stage: EXECUTE_RULES,
|
|
84
|
+
type: 'message',
|
|
85
|
+
get: () => `Execute ${enabledRules} rule(s) for ${policyName}`,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
this.mso.updateData({});
|
|
91
|
+
}
|
|
92
|
+
startRuleExecution() {
|
|
93
|
+
this.mso.goto(EXECUTE_RULES, { currentStatus: 'Executing' });
|
|
94
|
+
}
|
|
95
|
+
finish() {
|
|
96
|
+
this.mso.goto(FINALISE, { currentStatus: 'Completed' });
|
|
97
|
+
this.mso.stop('completed');
|
|
98
|
+
}
|
|
99
|
+
addPolicyStatsListener = (policyName, runInstance) => {
|
|
100
|
+
// multi stage output updates its entire internal state, but only "patches"
|
|
101
|
+
// data one level deep (e.g. policies property is replaced entierly)
|
|
102
|
+
// thats why we gather the statistics for each individual policy in a single variable
|
|
103
|
+
// and then update the multi stage data with aggregated data
|
|
104
|
+
runInstance.addListener(`entityresolve-${policyName}`, (data) => {
|
|
105
|
+
if (this.polStats[policyName]) {
|
|
106
|
+
if (data.resolved) {
|
|
107
|
+
this.polStats[policyName].resolved = data.resolved;
|
|
108
|
+
}
|
|
109
|
+
if (data.total) {
|
|
110
|
+
this.polStats[policyName].total = data.total;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
this.polStats[policyName] = { resolved: data.resolved ?? 0, total: data.total ?? 0 };
|
|
115
|
+
}
|
|
116
|
+
this.mso.updateData({ policies: structuredClone(this.polStats) });
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=auditRunMultiStage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auditRunMultiStage.js","sourceRoot":"","sources":["../../src/ux/auditRunMultiStage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA2B,MAAM,2BAA2B,CAAC;AAEtF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AACxD,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAC/C,MAAM,CAAC,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AAmB7C,MAAM,CAAC,OAAO,OAAO,wBAAwB;IACpC,GAAG,CAAiC;IACpC,mBAAmB,CAAsC;IACxD,QAAQ,CAAmB;IAEnC,YAAmB,IAA2C;QAC5D,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,kBAAyD,CAAC;QAC1F,IAAI,CAAC,GAAG,GAAG,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,IAA2C;QAC9D,OAAO,IAAI,gBAAgB,CAAe,IAAI,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;;;;;;;OAYG;IACI,MAAM,CAAC,MAAM,CAAC,IAA0B;QAC7C,OAAO,IAAI,wBAAwB,C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AAC;IAEO,sBAAsB,GAAG,CAAC,UAAkB,EAAE,WAAqB,EAAQ,EAAE;QACnF,2EAA2E;QAC3E,oEAAoE;QACpE,qFAAqF;QACrF,4DAA4D;QAC5D,WAAW,CAAC,WAAW,CAAC,iBAAiB,UAAU,EAAE,EAAE,CAAC,IAAwB,EAAE,EAAE;YAClF,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC9B,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAClB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;gBACrD,CAAC;gBACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;oBACf,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;gBAC/C,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;YACvF,CAAC;YACD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;CACH"}
|
package/oclif.manifest.json
CHANGED
|
@@ -1,4 +1,255 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commands": {
|
|
3
|
-
|
|
2
|
+
"commands": {
|
|
3
|
+
"org:scan:user-perms": {
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"args": {},
|
|
6
|
+
"description": "The target org is scanned \"in memory\" and searches Profiles and Permission Sets for the named user permissions. This command does not need an audit config and does not create a report file.",
|
|
7
|
+
"examples": [
|
|
8
|
+
"Search for multiple permissions on MyTargetOrg\n<%= config.bin %> <%= command.id %> -o MyTargetOrg -n AuthorApex -n ModifyMetadata"
|
|
9
|
+
],
|
|
10
|
+
"flags": {
|
|
11
|
+
"json": {
|
|
12
|
+
"description": "Format output as json.",
|
|
13
|
+
"helpGroup": "GLOBAL",
|
|
14
|
+
"name": "json",
|
|
15
|
+
"allowNo": false,
|
|
16
|
+
"type": "boolean"
|
|
17
|
+
},
|
|
18
|
+
"flags-dir": {
|
|
19
|
+
"helpGroup": "GLOBAL",
|
|
20
|
+
"name": "flags-dir",
|
|
21
|
+
"summary": "Import flag values from a directory.",
|
|
22
|
+
"hasDynamicHelp": false,
|
|
23
|
+
"multiple": false,
|
|
24
|
+
"type": "option"
|
|
25
|
+
},
|
|
26
|
+
"name": {
|
|
27
|
+
"char": "n",
|
|
28
|
+
"description": "You can specify any valid user permission on your org, such as \"AuthorApex\", \"CustomizeApplication\" or \"ViewSetup\". If you are unsure what permissions are available on your org, initialise a new audit config and check the created userPermissions.yml. Currently, the names are not validated: If you have a typo (such as \"AutorApex\", the scan will retun 0 results).",
|
|
29
|
+
"name": "name",
|
|
30
|
+
"required": true,
|
|
31
|
+
"summary": "One or more permissions to be searched for.",
|
|
32
|
+
"hasDynamicHelp": false,
|
|
33
|
+
"multiple": true,
|
|
34
|
+
"type": "option"
|
|
35
|
+
},
|
|
36
|
+
"target-org": {
|
|
37
|
+
"char": "o",
|
|
38
|
+
"name": "target-org",
|
|
39
|
+
"noCacheDefault": true,
|
|
40
|
+
"required": true,
|
|
41
|
+
"summary": "The target org to scan.",
|
|
42
|
+
"hasDynamicHelp": true,
|
|
43
|
+
"multiple": false,
|
|
44
|
+
"type": "option"
|
|
45
|
+
},
|
|
46
|
+
"api-version": {
|
|
47
|
+
"description": "Override the api version used for api requests made by this command",
|
|
48
|
+
"name": "api-version",
|
|
49
|
+
"hasDynamicHelp": false,
|
|
50
|
+
"multiple": false,
|
|
51
|
+
"type": "option"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"hasDynamicHelp": true,
|
|
55
|
+
"hiddenAliases": [],
|
|
56
|
+
"id": "org:scan:user-perms",
|
|
57
|
+
"pluginAlias": "@j-schreiber/sf-cli-security-audit",
|
|
58
|
+
"pluginName": "@j-schreiber/sf-cli-security-audit",
|
|
59
|
+
"pluginType": "core",
|
|
60
|
+
"strict": true,
|
|
61
|
+
"summary": "Performs a quick scan for specific user permissions.",
|
|
62
|
+
"enableJsonFlag": true,
|
|
63
|
+
"isESM": true,
|
|
64
|
+
"relativePath": [
|
|
65
|
+
"lib",
|
|
66
|
+
"commands",
|
|
67
|
+
"org",
|
|
68
|
+
"scan",
|
|
69
|
+
"user-perms.js"
|
|
70
|
+
],
|
|
71
|
+
"aliasPermutations": [],
|
|
72
|
+
"permutations": [
|
|
73
|
+
"org:scan:user-perms",
|
|
74
|
+
"scan:org:user-perms",
|
|
75
|
+
"scan:user-perms:org",
|
|
76
|
+
"org:user-perms:scan",
|
|
77
|
+
"user-perms:org:scan",
|
|
78
|
+
"user-perms:scan:org"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"org:audit:init": {
|
|
82
|
+
"aliases": [],
|
|
83
|
+
"args": {},
|
|
84
|
+
"description": "Uses your org's configuration to set up a new audit config at the target destination. This creates the basic classification and policy files that make up an audit config. You can select from presets to initialise risk levels with default values. After initialisation, you can customize the files to suit your needs.",
|
|
85
|
+
"examples": [
|
|
86
|
+
"Initialise audit policies at the root directory\n<%= config.bin %> <%= command.id %> -o MyTargetOrg",
|
|
87
|
+
"Initialise audit config at custom directory with preset\n<%= config.bin %> <%= command.id %> -o MyTargetOrg -d my_dir -p loose"
|
|
88
|
+
],
|
|
89
|
+
"flags": {
|
|
90
|
+
"json": {
|
|
91
|
+
"description": "Format output as json.",
|
|
92
|
+
"helpGroup": "GLOBAL",
|
|
93
|
+
"name": "json",
|
|
94
|
+
"allowNo": false,
|
|
95
|
+
"type": "boolean"
|
|
96
|
+
},
|
|
97
|
+
"flags-dir": {
|
|
98
|
+
"helpGroup": "GLOBAL",
|
|
99
|
+
"name": "flags-dir",
|
|
100
|
+
"summary": "Import flag values from a directory.",
|
|
101
|
+
"hasDynamicHelp": false,
|
|
102
|
+
"multiple": false,
|
|
103
|
+
"type": "option"
|
|
104
|
+
},
|
|
105
|
+
"target-org": {
|
|
106
|
+
"char": "o",
|
|
107
|
+
"name": "target-org",
|
|
108
|
+
"noCacheDefault": true,
|
|
109
|
+
"required": true,
|
|
110
|
+
"summary": "Target org to export permissions, profiles, users, etc.",
|
|
111
|
+
"hasDynamicHelp": true,
|
|
112
|
+
"multiple": false,
|
|
113
|
+
"type": "option"
|
|
114
|
+
},
|
|
115
|
+
"output-dir": {
|
|
116
|
+
"char": "d",
|
|
117
|
+
"name": "output-dir",
|
|
118
|
+
"required": false,
|
|
119
|
+
"summary": "Directory where the audit config is initialised. If not set, the root directory will be used.",
|
|
120
|
+
"default": "",
|
|
121
|
+
"hasDynamicHelp": false,
|
|
122
|
+
"multiple": false,
|
|
123
|
+
"type": "option"
|
|
124
|
+
},
|
|
125
|
+
"preset": {
|
|
126
|
+
"char": "p",
|
|
127
|
+
"description": "The selected preset is applied before any other default mechanisms (such as template configs). This means, values from a selected template override the preset. Consult the documentation to learn more about the rationale behind the default risk levels. The risk levels interact with the configured preset on profiles and permission sets and essentially control, if a permission is allowed in a certain profile / permission set.",
|
|
128
|
+
"name": "preset",
|
|
129
|
+
"summary": "Preset to initialise defaults for permission risk levels.",
|
|
130
|
+
"default": "strict",
|
|
131
|
+
"hasDynamicHelp": false,
|
|
132
|
+
"multiple": false,
|
|
133
|
+
"options": [
|
|
134
|
+
"strict",
|
|
135
|
+
"loose",
|
|
136
|
+
"none"
|
|
137
|
+
],
|
|
138
|
+
"type": "option"
|
|
139
|
+
},
|
|
140
|
+
"api-version": {
|
|
141
|
+
"description": "Override the api version used for api requests made by this command",
|
|
142
|
+
"name": "api-version",
|
|
143
|
+
"hasDynamicHelp": false,
|
|
144
|
+
"multiple": false,
|
|
145
|
+
"type": "option"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"hasDynamicHelp": true,
|
|
149
|
+
"hiddenAliases": [],
|
|
150
|
+
"id": "org:audit:init",
|
|
151
|
+
"pluginAlias": "@j-schreiber/sf-cli-security-audit",
|
|
152
|
+
"pluginName": "@j-schreiber/sf-cli-security-audit",
|
|
153
|
+
"pluginType": "core",
|
|
154
|
+
"strict": true,
|
|
155
|
+
"summary": "Initialise a new audit config.",
|
|
156
|
+
"enableJsonFlag": true,
|
|
157
|
+
"isESM": true,
|
|
158
|
+
"relativePath": [
|
|
159
|
+
"lib",
|
|
160
|
+
"commands",
|
|
161
|
+
"org",
|
|
162
|
+
"audit",
|
|
163
|
+
"init.js"
|
|
164
|
+
],
|
|
165
|
+
"aliasPermutations": [],
|
|
166
|
+
"permutations": [
|
|
167
|
+
"org:audit:init",
|
|
168
|
+
"audit:org:init",
|
|
169
|
+
"audit:init:org",
|
|
170
|
+
"org:init:audit",
|
|
171
|
+
"init:org:audit",
|
|
172
|
+
"init:audit:org"
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
"org:audit:run": {
|
|
176
|
+
"aliases": [],
|
|
177
|
+
"args": {},
|
|
178
|
+
"description": "Loads an existing audit config from the source directory and audits the target org. The audit run always creates a comprehensive report in JSON format.",
|
|
179
|
+
"examples": [
|
|
180
|
+
"Audit the org MyTargetOrg with the config in configs/prod\n<%= config.bin %> <%= command.id %> -o MyTargetOrg -d configs/prod"
|
|
181
|
+
],
|
|
182
|
+
"flags": {
|
|
183
|
+
"json": {
|
|
184
|
+
"description": "Format output as json.",
|
|
185
|
+
"helpGroup": "GLOBAL",
|
|
186
|
+
"name": "json",
|
|
187
|
+
"allowNo": false,
|
|
188
|
+
"type": "boolean"
|
|
189
|
+
},
|
|
190
|
+
"flags-dir": {
|
|
191
|
+
"helpGroup": "GLOBAL",
|
|
192
|
+
"name": "flags-dir",
|
|
193
|
+
"summary": "Import flag values from a directory.",
|
|
194
|
+
"hasDynamicHelp": false,
|
|
195
|
+
"multiple": false,
|
|
196
|
+
"type": "option"
|
|
197
|
+
},
|
|
198
|
+
"target-org": {
|
|
199
|
+
"char": "o",
|
|
200
|
+
"name": "target-org",
|
|
201
|
+
"noCacheDefault": true,
|
|
202
|
+
"required": true,
|
|
203
|
+
"summary": "The org that is audited.",
|
|
204
|
+
"hasDynamicHelp": true,
|
|
205
|
+
"multiple": false,
|
|
206
|
+
"type": "option"
|
|
207
|
+
},
|
|
208
|
+
"source-dir": {
|
|
209
|
+
"char": "d",
|
|
210
|
+
"name": "source-dir",
|
|
211
|
+
"required": false,
|
|
212
|
+
"summary": "Source directory of the audit config to run.",
|
|
213
|
+
"default": "",
|
|
214
|
+
"hasDynamicHelp": false,
|
|
215
|
+
"multiple": false,
|
|
216
|
+
"type": "option"
|
|
217
|
+
},
|
|
218
|
+
"api-version": {
|
|
219
|
+
"description": "Override the api version used for api requests made by this command",
|
|
220
|
+
"name": "api-version",
|
|
221
|
+
"hasDynamicHelp": false,
|
|
222
|
+
"multiple": false,
|
|
223
|
+
"type": "option"
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"hasDynamicHelp": true,
|
|
227
|
+
"hiddenAliases": [],
|
|
228
|
+
"id": "org:audit:run",
|
|
229
|
+
"pluginAlias": "@j-schreiber/sf-cli-security-audit",
|
|
230
|
+
"pluginName": "@j-schreiber/sf-cli-security-audit",
|
|
231
|
+
"pluginType": "core",
|
|
232
|
+
"strict": true,
|
|
233
|
+
"summary": "Audit your org with an existing config.",
|
|
234
|
+
"enableJsonFlag": true,
|
|
235
|
+
"isESM": true,
|
|
236
|
+
"relativePath": [
|
|
237
|
+
"lib",
|
|
238
|
+
"commands",
|
|
239
|
+
"org",
|
|
240
|
+
"audit",
|
|
241
|
+
"run.js"
|
|
242
|
+
],
|
|
243
|
+
"aliasPermutations": [],
|
|
244
|
+
"permutations": [
|
|
245
|
+
"org:audit:run",
|
|
246
|
+
"audit:org:run",
|
|
247
|
+
"audit:run:org",
|
|
248
|
+
"org:run:audit",
|
|
249
|
+
"run:org:audit",
|
|
250
|
+
"run:audit:org"
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
"version": "0.8.3"
|
|
4
255
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@j-schreiber/sf-cli-security-audit",
|
|
3
3
|
"description": "Salesforce CLI plugin to automate highly configurable security audits",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.3",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "https",
|
|
7
7
|
"url": "https://github.com/j-schreiber/js-sf-cli-security-audit"
|
package/bin/dev.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
|
|
2
|
-
// eslint-disable-next-line node/shebang
|
|
3
|
-
async function main() {
|
|
4
|
-
const { execute } = await import('@oclif/core');
|
|
5
|
-
await execute({ development: true, dir: import.meta.url });
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
await main();
|