@cclabsnz/sf-audit 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,7 +6,7 @@ export class CodeSecurityCheck {
|
|
|
6
6
|
async run(ctx) {
|
|
7
7
|
const findings = [];
|
|
8
8
|
// Query class and trigger counts using Tooling API
|
|
9
|
-
const classCountResults = await ctx.tooling.query("SELECT COUNT() FROM ApexClass WHERE NamespacePrefix = null
|
|
9
|
+
const classCountResults = await ctx.tooling.query("SELECT COUNT() FROM ApexClass WHERE NamespacePrefix = null");
|
|
10
10
|
const classCount = classCountResults[0]?.expr0 ?? 0;
|
|
11
11
|
const triggerCountResults = await ctx.tooling.query('SELECT COUNT() FROM ApexTrigger WHERE NamespacePrefix = null');
|
|
12
12
|
const triggerCount = triggerCountResults[0]?.expr0 ?? 0;
|
|
@@ -36,7 +36,7 @@ export class CodeSecurityCheck {
|
|
|
36
36
|
category: this.category,
|
|
37
37
|
riskLevel: 'INFO',
|
|
38
38
|
title: `Apex code inventory: ${classCount} class(es), ${triggerCount} trigger(s)`,
|
|
39
|
-
detail: `Code coverage data is not available for this org. The org has ${classCount} custom Apex classes and ${triggerCount} custom Apex triggers.`,
|
|
39
|
+
detail: `Code coverage data is not available for this org. The org has ${classCount} custom Apex classes (including test classes) and ${triggerCount} custom Apex triggers.`,
|
|
40
40
|
remediation: 'Run Apex tests in this org to generate coverage data. Ensure all Apex code has adequate test coverage.',
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -65,9 +65,10 @@ export class PermissionsCheck {
|
|
|
65
65
|
})),
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
// Custom profile count: exclude
|
|
68
|
+
// Custom profile count: exclude known standard Salesforce profiles by name.
|
|
69
|
+
// Profile does not expose NamespacePrefix, so managed-package profiles cannot be filtered that way.
|
|
69
70
|
const standardProfileList = STANDARD_PROFILE_NAMES.map((n) => `'${n}'`).join(', ');
|
|
70
|
-
const profileCountResult = await ctx.soql.query(`SELECT COUNT() FROM Profile WHERE
|
|
71
|
+
const profileCountResult = await ctx.soql.query(`SELECT COUNT() FROM Profile WHERE Name NOT IN (${standardProfileList})`);
|
|
71
72
|
const profileCount = profileCountResult.totalSize;
|
|
72
73
|
if (profileCount > 30) {
|
|
73
74
|
findings.push({
|