@j-schreiber/sf-cli-security-audit 0.7.1 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/README.md +26 -22
  2. package/messages/rules.enforceClassificationPresets.md +4 -0
  3. package/messages/rules.users.md +12 -0
  4. package/oclif.lock +1285 -1006
  5. package/oclif.manifest.json +2 -253
  6. package/package.json +1 -1
  7. package/lib/commands/org/audit/init.d.ts +0 -19
  8. package/lib/commands/org/audit/init.js +0 -72
  9. package/lib/commands/org/audit/init.js.map +0 -1
  10. package/lib/commands/org/audit/run.d.ts +0 -22
  11. package/lib/commands/org/audit/run.js +0 -119
  12. package/lib/commands/org/audit/run.js.map +0 -1
  13. package/lib/commands/org/scan/user-perms.d.ts +0 -20
  14. package/lib/commands/org/scan/user-perms.js +0 -87
  15. package/lib/commands/org/scan/user-perms.js.map +0 -1
  16. package/lib/libs/conf-init/auditConfig.d.ts +0 -35
  17. package/lib/libs/conf-init/auditConfig.js +0 -41
  18. package/lib/libs/conf-init/auditConfig.js.map +0 -1
  19. package/lib/libs/conf-init/permissionsClassification.d.ts +0 -17
  20. package/lib/libs/conf-init/permissionsClassification.js +0 -80
  21. package/lib/libs/conf-init/permissionsClassification.js.map +0 -1
  22. package/lib/libs/conf-init/policyConfigs.d.ts +0 -31
  23. package/lib/libs/conf-init/policyConfigs.js +0 -91
  24. package/lib/libs/conf-init/policyConfigs.js.map +0 -1
  25. package/lib/libs/conf-init/presets/loose.d.ts +0 -6
  26. package/lib/libs/conf-init/presets/loose.js +0 -51
  27. package/lib/libs/conf-init/presets/loose.js.map +0 -1
  28. package/lib/libs/conf-init/presets/none.d.ts +0 -30
  29. package/lib/libs/conf-init/presets/none.js +0 -54
  30. package/lib/libs/conf-init/presets/none.js.map +0 -1
  31. package/lib/libs/conf-init/presets/strict.d.ts +0 -4
  32. package/lib/libs/conf-init/presets/strict.js +0 -45
  33. package/lib/libs/conf-init/presets/strict.js.map +0 -1
  34. package/lib/libs/conf-init/presets.d.ts +0 -7
  35. package/lib/libs/conf-init/presets.js +0 -20
  36. package/lib/libs/conf-init/presets.js.map +0 -1
  37. package/lib/libs/core/auditRun.d.ts +0 -36
  38. package/lib/libs/core/auditRun.js +0 -86
  39. package/lib/libs/core/auditRun.js.map +0 -1
  40. package/lib/libs/core/classification-types.d.ts +0 -20
  41. package/lib/libs/core/classification-types.js +0 -23
  42. package/lib/libs/core/classification-types.js.map +0 -1
  43. package/lib/libs/core/constants.d.ts +0 -11
  44. package/lib/libs/core/constants.js +0 -20
  45. package/lib/libs/core/constants.js.map +0 -1
  46. package/lib/libs/core/file-mgmt/auditConfigFileManager.d.ts +0 -48
  47. package/lib/libs/core/file-mgmt/auditConfigFileManager.js +0 -145
  48. package/lib/libs/core/file-mgmt/auditConfigFileManager.js.map +0 -1
  49. package/lib/libs/core/file-mgmt/schema.d.ts +0 -123
  50. package/lib/libs/core/file-mgmt/schema.js +0 -69
  51. package/lib/libs/core/file-mgmt/schema.js.map +0 -1
  52. package/lib/libs/core/mdapi/mdapiRetriever.d.ts +0 -54
  53. package/lib/libs/core/mdapi/mdapiRetriever.js +0 -123
  54. package/lib/libs/core/mdapi/mdapiRetriever.js.map +0 -1
  55. package/lib/libs/core/mdapi/metadataRegistryEntry.d.ts +0 -40
  56. package/lib/libs/core/mdapi/metadataRegistryEntry.js +0 -46
  57. package/lib/libs/core/mdapi/metadataRegistryEntry.js.map +0 -1
  58. package/lib/libs/core/mdapi/namedMetadataToolingQueryable.d.ts +0 -33
  59. package/lib/libs/core/mdapi/namedMetadataToolingQueryable.js +0 -41
  60. package/lib/libs/core/mdapi/namedMetadataToolingQueryable.js.map +0 -1
  61. package/lib/libs/core/mdapi/namedMetadataType.d.ts +0 -20
  62. package/lib/libs/core/mdapi/namedMetadataType.js +0 -41
  63. package/lib/libs/core/mdapi/namedMetadataType.js.map +0 -1
  64. package/lib/libs/core/mdapi/singletonMetadataType.d.ts +0 -21
  65. package/lib/libs/core/mdapi/singletonMetadataType.js +0 -37
  66. package/lib/libs/core/mdapi/singletonMetadataType.js.map +0 -1
  67. package/lib/libs/core/policies/connectedAppPolicy.d.ts +0 -10
  68. package/lib/libs/core/policies/connectedAppPolicy.js +0 -78
  69. package/lib/libs/core/policies/connectedAppPolicy.js.map +0 -1
  70. package/lib/libs/core/policies/permissionSetPolicy.d.ts +0 -11
  71. package/lib/libs/core/policies/permissionSetPolicy.js +0 -62
  72. package/lib/libs/core/policies/permissionSetPolicy.js.map +0 -1
  73. package/lib/libs/core/policies/policy.d.ts +0 -31
  74. package/lib/libs/core/policies/policy.js +0 -100
  75. package/lib/libs/core/policies/policy.js.map +0 -1
  76. package/lib/libs/core/policies/profilePolicy.d.ts +0 -11
  77. package/lib/libs/core/policies/profilePolicy.js +0 -64
  78. package/lib/libs/core/policies/profilePolicy.js.map +0 -1
  79. package/lib/libs/core/policies/salesforceStandardTypes.d.ts +0 -53
  80. package/lib/libs/core/policies/salesforceStandardTypes.js +0 -2
  81. package/lib/libs/core/policies/salesforceStandardTypes.js.map +0 -1
  82. package/lib/libs/core/policies/userPolicy.d.ts +0 -11
  83. package/lib/libs/core/policies/userPolicy.js +0 -104
  84. package/lib/libs/core/policies/userPolicy.js.map +0 -1
  85. package/lib/libs/core/policy-types.d.ts +0 -18
  86. package/lib/libs/core/policy-types.js +0 -28
  87. package/lib/libs/core/policy-types.js.map +0 -1
  88. package/lib/libs/core/policyRegistry.d.ts +0 -23
  89. package/lib/libs/core/policyRegistry.js +0 -38
  90. package/lib/libs/core/policyRegistry.js.map +0 -1
  91. package/lib/libs/core/registries/connectedApps.d.ts +0 -13
  92. package/lib/libs/core/registries/connectedApps.js +0 -13
  93. package/lib/libs/core/registries/connectedApps.js.map +0 -1
  94. package/lib/libs/core/registries/permissionSets.d.ts +0 -11
  95. package/lib/libs/core/registries/permissionSets.js +0 -11
  96. package/lib/libs/core/registries/permissionSets.js.map +0 -1
  97. package/lib/libs/core/registries/profiles.d.ts +0 -11
  98. package/lib/libs/core/registries/profiles.js +0 -13
  99. package/lib/libs/core/registries/profiles.js.map +0 -1
  100. package/lib/libs/core/registries/ruleRegistry.d.ts +0 -37
  101. package/lib/libs/core/registries/ruleRegistry.js +0 -48
  102. package/lib/libs/core/registries/ruleRegistry.js.map +0 -1
  103. package/lib/libs/core/registries/rules/allUsedAppsUnderManagement.d.ts +0 -7
  104. package/lib/libs/core/registries/rules/allUsedAppsUnderManagement.js +0 -23
  105. package/lib/libs/core/registries/rules/allUsedAppsUnderManagement.js.map +0 -1
  106. package/lib/libs/core/registries/rules/enforceCustomPermsClassificationOnProfiles.d.ts +0 -7
  107. package/lib/libs/core/registries/rules/enforceCustomPermsClassificationOnProfiles.js +0 -52
  108. package/lib/libs/core/registries/rules/enforceCustomPermsClassificationOnProfiles.js.map +0 -1
  109. package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnPermSets.d.ts +0 -7
  110. package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnPermSets.js +0 -52
  111. package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnPermSets.js.map +0 -1
  112. package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnProfiles.d.ts +0 -7
  113. package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnProfiles.js +0 -54
  114. package/lib/libs/core/registries/rules/enforceUserPermsClassificationOnProfiles.js.map +0 -1
  115. package/lib/libs/core/registries/rules/noInactiveUsers.d.ts +0 -9
  116. package/lib/libs/core/registries/rules/noInactiveUsers.js +0 -44
  117. package/lib/libs/core/registries/rules/noInactiveUsers.js.map +0 -1
  118. package/lib/libs/core/registries/rules/noOtherApexApiLogins.d.ts +0 -7
  119. package/lib/libs/core/registries/rules/noOtherApexApiLogins.js +0 -24
  120. package/lib/libs/core/registries/rules/noOtherApexApiLogins.js.map +0 -1
  121. package/lib/libs/core/registries/rules/noUserCanSelfAuthorize.d.ts +0 -7
  122. package/lib/libs/core/registries/rules/noUserCanSelfAuthorize.js +0 -31
  123. package/lib/libs/core/registries/rules/noUserCanSelfAuthorize.js.map +0 -1
  124. package/lib/libs/core/registries/rules/policyRule.d.ts +0 -21
  125. package/lib/libs/core/registries/rules/policyRule.js +0 -41
  126. package/lib/libs/core/registries/rules/policyRule.js.map +0 -1
  127. package/lib/libs/core/registries/types.d.ts +0 -37
  128. package/lib/libs/core/registries/types.js +0 -11
  129. package/lib/libs/core/registries/types.js.map +0 -1
  130. package/lib/libs/core/registries/users.d.ts +0 -26
  131. package/lib/libs/core/registries/users.js +0 -10
  132. package/lib/libs/core/registries/users.js.map +0 -1
  133. package/lib/libs/core/result-types.d.ts +0 -172
  134. package/lib/libs/core/result-types.js +0 -2
  135. package/lib/libs/core/result-types.js.map +0 -1
  136. package/lib/libs/core/utils.d.ts +0 -12
  137. package/lib/libs/core/utils.js +0 -31
  138. package/lib/libs/core/utils.js.map +0 -1
  139. package/lib/libs/quick-scan/types.d.ts +0 -17
  140. package/lib/libs/quick-scan/types.js +0 -2
  141. package/lib/libs/quick-scan/types.js.map +0 -1
  142. package/lib/libs/quick-scan/userPermissionScanner.d.ts +0 -22
  143. package/lib/libs/quick-scan/userPermissionScanner.js +0 -75
  144. package/lib/libs/quick-scan/userPermissionScanner.js.map +0 -1
  145. package/lib/ux/auditRunMultiStage.d.ts +0 -65
  146. package/lib/ux/auditRunMultiStage.js +0 -120
  147. package/lib/ux/auditRunMultiStage.js.map +0 -1
package/README.md CHANGED
@@ -35,7 +35,7 @@ Contributers are welcome! Please reach out on [Linkedin](https://www.linkedin.co
35
35
 
36
36
  ## `sf org audit init`
37
37
 
38
- Initialises classifications and policies for a security audit.
38
+ Initialise a new audit config.
39
39
 
40
40
  ```
41
41
  USAGE
@@ -46,7 +46,7 @@ FLAGS
46
46
  -d, --output-dir=<value> Directory where the audit config is initialised. If not set, the root directory will be
47
47
  used.
48
48
  -o, --target-org=<value> (required) Target org to export permissions, profiles, users, etc.
49
- -p, --preset=<option> [default: strict] Select a preset to initialise permission classifications (risk levels).
49
+ -p, --preset=<option> [default: strict] Preset to initialise defaults for permission risk levels.
50
50
  <options: strict|loose|none>
51
51
  --api-version=<value> Override the api version used for api requests made by this command
52
52
 
@@ -55,10 +55,11 @@ GLOBAL FLAGS
55
55
  --json Format output as json.
56
56
 
57
57
  DESCRIPTION
58
- Initialises classifications and policies for a security audit.
58
+ Initialise a new audit config.
59
59
 
60
- Exports permissions (standard and custom), permission sets, profiles, users, etc from the target org. All
61
- classifications are initialised with sane defaults that you can customize later.
60
+ Uses your org's configuration to set up a new audit config at the target destination. This creates the basic
61
+ classification and policy files that make up an audit config. You can select from presets to initialise risk levels
62
+ with default values. After initialisation, you can customize the files to suit your needs.
62
63
 
63
64
  EXAMPLES
64
65
  Initialise audit policies at the root directory
@@ -70,7 +71,7 @@ EXAMPLES
70
71
  $ sf org audit init -o MyTargetOrg -d my_dir -p loose
71
72
 
72
73
  FLAG DESCRIPTIONS
73
- -p, --preset=strict|loose|none Select a preset to initialise permission classifications (risk levels).
74
+ -p, --preset=strict|loose|none Preset to initialise defaults for permission risk levels.
74
75
 
75
76
  The selected preset is applied before any other default mechanisms (such as template configs). This means, values
76
77
  from a selected template override the preset. Consult the documentation to learn more about the rationale behind the
@@ -78,18 +79,18 @@ FLAG DESCRIPTIONS
78
79
  essentially control, if a permission is allowed in a certain profile / permission set.
79
80
  ```
80
81
 
81
- _See code: [src/commands/org/audit/init.ts](https://github.com/j-schreiber/js-sf-cli-security-audit/blob/v0.6.0/src/commands/org/audit/init.ts)_
82
+ _See code: [src/commands/org/audit/init.ts](https://github.com/j-schreiber/js-sf-cli-security-audit/blob/v0.7.1/src/commands/org/audit/init.ts)_
82
83
 
83
84
  ## `sf org audit run`
84
85
 
85
- Audit your org.
86
+ Audit your org with an existing config.
86
87
 
87
88
  ```
88
89
  USAGE
89
90
  $ sf org audit run -o <value> [--json] [--flags-dir <value>] [-d <value>] [--api-version <value>]
90
91
 
91
92
  FLAGS
92
- -d, --source-dir=<value> Location of the audit config.
93
+ -d, --source-dir=<value> Source directory of the audit config to run.
93
94
  -o, --target-org=<value> (required) The org that is audited.
94
95
  --api-version=<value> Override the api version used for api requests made by this command
95
96
 
@@ -98,10 +99,10 @@ GLOBAL FLAGS
98
99
  --json Format output as json.
99
100
 
100
101
  DESCRIPTION
101
- Audit your org.
102
+ Audit your org with an existing config.
102
103
 
103
- Loads a given audit config (a set of classifications and policies) and runs the policies against the target org. The
104
- audit run creates a comprehensive report that lists all executed policies and all resolved entities that were audited.
104
+ Loads an existing audit config from the source directory and audits the target org. The audit run always creates a
105
+ comprehensive report in JSON format.
105
106
 
106
107
  EXAMPLES
107
108
  Audit the org MyTargetOrg with the config in configs/prod
@@ -109,18 +110,18 @@ EXAMPLES
109
110
  $ sf org audit run -o MyTargetOrg -d configs/prod
110
111
  ```
111
112
 
112
- _See code: [src/commands/org/audit/run.ts](https://github.com/j-schreiber/js-sf-cli-security-audit/blob/v0.6.0/src/commands/org/audit/run.ts)_
113
+ _See code: [src/commands/org/audit/run.ts](https://github.com/j-schreiber/js-sf-cli-security-audit/blob/v0.7.1/src/commands/org/audit/run.ts)_
113
114
 
114
115
  ## `sf org scan user-perms`
115
116
 
116
- Performs a quick scan to check permission sets and profiles for user permissions.
117
+ Performs a quick scan for specific user permissions.
117
118
 
118
119
  ```
119
120
  USAGE
120
121
  $ sf org scan user-perms -n <value>... -o <value> [--json] [--flags-dir <value>] [--api-version <value>]
121
122
 
122
123
  FLAGS
123
- -n, --name=<value>... (required) One or more permissions to be scanned.
124
+ -n, --name=<value>... (required) One or more permissions to be searched for.
124
125
  -o, --target-org=<value> (required) The target org to scan.
125
126
  --api-version=<value> Override the api version used for api requests made by this command
126
127
 
@@ -129,23 +130,26 @@ GLOBAL FLAGS
129
130
  --json Format output as json.
130
131
 
131
132
  DESCRIPTION
132
- Performs a quick scan to check permission sets and profiles for user permissions.
133
+ Performs a quick scan for specific user permissions.
133
134
 
134
- The quick scan does not need an audit config and does not create reports. The target org is scanned "in memory" and
135
- simply outputs information, where the searched user permissions
135
+ The target org is scanned "in memory" and searches Profiles and Permission Sets for the named user permissions. This
136
+ command does not need an audit config and does not create a report file.
136
137
 
137
138
  EXAMPLES
138
- $ sf org scan user-perms
139
+ Search for multiple permissions on MyTargetOrg
140
+
141
+ $ sf org scan user-perms -o MyTargetOrg -n AuthorApex -n ModifyMetadata
139
142
 
140
143
  FLAG DESCRIPTIONS
141
- -n, --name=<value>... One or more permissions to be scanned.
144
+ -n, --name=<value>... One or more permissions to be searched for.
142
145
 
143
146
  You can specify any valid user permission on your org, such as "AuthorApex", "CustomizeApplication" or "ViewSetup".
144
147
  If you are unsure what permissions are available on your org, initialise a new audit config and check the created
145
- userPermissions.yml.
148
+ userPermissions.yml. Currently, the names are not validated: If you have a typo (such as "AutorApex", the scan will
149
+ retun 0 results).
146
150
  ```
147
151
 
148
- _See code: [src/commands/org/scan/user-perms.ts](https://github.com/j-schreiber/js-sf-cli-security-audit/blob/v0.6.0/src/commands/org/scan/user-perms.ts)_
152
+ _See code: [src/commands/org/scan/user-perms.ts](https://github.com/j-schreiber/js-sf-cli-security-audit/blob/v0.7.1/src/commands/org/scan/user-perms.ts)_
149
153
 
150
154
  <!-- commandsstop -->
151
155
 
@@ -10,6 +10,10 @@ Permission is BLOCKED and not allowed in any preset.
10
10
 
11
11
  Permission classified as UNKNOWN. Update classification to LOW or higher to resolve.
12
12
 
13
+ # warnings.permission-not-classified
14
+
15
+ Permission is assigned, but was not found in classification. Refresh or add manually.
16
+
13
17
  # warnings.permission-not-classified-in-profile
14
18
 
15
19
  Profile assigns the permission, but it was not found in classification. Refresh or add manually.
@@ -9,3 +9,15 @@ User is inactive for %s days (last login was %s).
9
9
  # violations.has-never-logged-in
10
10
 
11
11
  User was created %s (%s days ago), but never logged in.
12
+
13
+ # violations.entity-unknown-but-used
14
+
15
+ %s is used, but classified as UNKNOWN. Cannot audit user role.
16
+
17
+ # violations.entity-not-classified-but-used
18
+
19
+ %s is used, but not classified in %ss policy.
20
+
21
+ # violations.entity-not-allowed-for-user-role
22
+
23
+ User has the role "%s", but %s is classified as "%s". This is not allowed.