@cclabsnz/sf-audit 1.8.1 → 1.9.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +199 -0
  2. package/README.md +138 -758
  3. package/lib/chains/CapabilityRegistry.d.ts +6 -2
  4. package/lib/chains/CapabilityRegistry.js +48 -2
  5. package/lib/chains/namedChains.js +140 -7
  6. package/lib/checks/impl/AgentActionSurfaceCheck.d.ts +1 -1
  7. package/lib/checks/impl/AgentChannelExposureCheck.d.ts +1 -1
  8. package/lib/checks/impl/AgentChannelExposureCheck.js +52 -10
  9. package/lib/checks/impl/AgentInventoryCheck.d.ts +1 -1
  10. package/lib/checks/impl/AgentMonitoringCoverageCheck.d.ts +1 -1
  11. package/lib/checks/impl/AgentUserPrivilegeCheck.d.ts +1 -1
  12. package/lib/checks/impl/ApexCrudFLSCheck.d.ts +1 -1
  13. package/lib/checks/impl/ApexCrudFLSCheck.js +3 -3
  14. package/lib/checks/impl/ApexLoggingCheck.d.ts +1 -1
  15. package/lib/checks/impl/ApexRestEndpointCheck.d.ts +1 -1
  16. package/lib/checks/impl/ApexRestEndpointCheck.js +0 -3
  17. package/lib/checks/impl/ApexSharingCheck.d.ts +1 -1
  18. package/lib/checks/impl/CodeSecurityCheck.d.ts +1 -1
  19. package/lib/checks/impl/ConnectedAppInactivityCheck.d.ts +1 -1
  20. package/lib/checks/impl/ConnectedAppsCheck.d.ts +1 -1
  21. package/lib/checks/impl/CspTrustedSitesCheck.d.ts +1 -1
  22. package/lib/checks/impl/CustomLabelsCredentialCheck.js +1 -1
  23. package/lib/checks/impl/DataClassificationCheck.js +15 -1
  24. package/lib/checks/impl/DeploymentIdentityCheck.d.ts +1 -1
  25. package/lib/checks/impl/EventMonitoringCheck.d.ts +1 -1
  26. package/lib/checks/impl/FailedLoginCheck.js +16 -1
  27. package/lib/checks/impl/FieldLevelSecurityCheck.js +29 -16
  28. package/lib/checks/impl/GuestExecutableApexCheck.d.ts +1 -1
  29. package/lib/checks/impl/GuestTrafficAnomalyCheck.d.ts +1 -1
  30. package/lib/checks/impl/GuestUserAccessCheck.d.ts +1 -1
  31. package/lib/checks/impl/GuestUserVisibilityCheck.d.ts +35 -0
  32. package/lib/checks/impl/GuestUserVisibilityCheck.js +168 -0
  33. package/lib/checks/impl/HardcodedCredentialsCheck.d.ts +2 -2
  34. package/lib/checks/impl/HardcodedCredentialsCheck.js +0 -1
  35. package/lib/checks/impl/HealthCheckCheck.d.ts +1 -1
  36. package/lib/checks/impl/HealthCheckCheck.js +1 -3
  37. package/lib/checks/impl/IntegrationLeastPrivilegeCheck.d.ts +42 -0
  38. package/lib/checks/impl/IntegrationLeastPrivilegeCheck.js +467 -0
  39. package/lib/checks/impl/IntegrationUsersCheck.js +48 -52
  40. package/lib/checks/impl/InternalUserMfaCheck.js +0 -1
  41. package/lib/checks/impl/IpRestrictionsCheck.js +39 -5
  42. package/lib/checks/impl/MfaMethodStrengthCheck.d.ts +1 -1
  43. package/lib/checks/impl/MfaRegistrationCheck.d.ts +1 -1
  44. package/lib/checks/impl/NamedCredentialsCheck.d.ts +1 -1
  45. package/lib/checks/impl/PrivilegedAccessCheck.d.ts +1 -1
  46. package/lib/checks/impl/PublicGroupSharingCheck.d.ts +1 -1
  47. package/lib/checks/impl/PublicGroupSharingCheck.js +21 -2
  48. package/lib/checks/impl/RemoteSitesCheck.d.ts +1 -1
  49. package/lib/checks/impl/ScheduledApexCheck.d.ts +1 -1
  50. package/lib/checks/impl/ScheduledApexCheck.js +0 -1
  51. package/lib/checks/impl/SeparationOfDutiesCheck.d.ts +1 -1
  52. package/lib/checks/impl/SessionHardeningCheck.d.ts +1 -1
  53. package/lib/checks/impl/SiemIntegrationCheck.d.ts +1 -1
  54. package/lib/checks/impl/SoapLoginApiAuthCheck.d.ts +10 -0
  55. package/lib/checks/impl/SoapLoginApiAuthCheck.js +151 -0
  56. package/lib/checks/impl/SsoEnforcementCheck.js +0 -1
  57. package/lib/checks/impl/TrustedUrlHygieneCheck.d.ts +1 -1
  58. package/lib/checks/impl/TrustedUrlHygieneCheck.js +3 -1
  59. package/lib/checks/impl/VisualforceXssCheck.d.ts +1 -1
  60. package/lib/checks/registry.js +4 -0
  61. package/lib/checks/support/integrationAccounts.d.ts +35 -0
  62. package/lib/checks/support/integrationAccounts.js +209 -0
  63. package/lib/commands/audit/security.d.ts +12 -1
  64. package/lib/commands/audit/security.js +32 -9
  65. package/lib/compliance/catalogs/gdpr.d.ts +3 -0
  66. package/lib/compliance/catalogs/gdpr.js +54 -0
  67. package/lib/compliance/catalogs/hipaa.d.ts +3 -0
  68. package/lib/compliance/catalogs/hipaa.js +97 -0
  69. package/lib/compliance/catalogs/index.js +4 -0
  70. package/lib/compliance/mapping.js +111 -36
  71. package/lib/findings/CheckMeta.js +2 -0
  72. package/lib/findings/exitCode.d.ts +28 -0
  73. package/lib/findings/exitCode.js +46 -0
  74. package/lib/findings/loadScoringConfig.js +5 -5
  75. package/lib/renderers/HtmlRenderer.js +1 -1
  76. package/messages/audit.security.md +6 -0
  77. package/package.json +16 -11
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Username segments that strongly indicate a service/integration account. Moved here from
3
+ * IntegrationUsersCheck so there is one definition rather than two that drift.
4
+ */
5
+ export const SERVICE_LIKE_CLAUSES = [
6
+ "Username LIKE '%service%'",
7
+ "Username LIKE '%integration%'",
8
+ "Username LIKE '%.api@%'",
9
+ "Username LIKE '%\\_api\\_%'",
10
+ "Username LIKE '%.svc@%'",
11
+ "Username LIKE '%\\_svc\\_%'",
12
+ "Username LIKE '%batch%'",
13
+ "Username LIKE '%automation%'",
14
+ "Username LIKE '%system@%'",
15
+ "Username LIKE '%scheduler%'",
16
+ ];
17
+ /** The same segments as a runtime matcher, for classifying rows the query returned. */
18
+ const SERVICE_LIKE_PATTERN = /service|integration|\.api@|_api_|\.svc@|_svc_|batch|automation|system@|scheduler/i;
19
+ /** Confirm against a live org before trusting — see the plan's live-org gate. */
20
+ const INTEGRATION_LICENSE = 'Salesforce Integration';
21
+ const NEVER_LOGGED_IN_MIN_AGE_DAYS = 30;
22
+ /** Row cap on the candidate query. Hitting it sets `truncated`, which callers must disclose. */
23
+ const CANDIDATE_LIMIT = 200;
24
+ /**
25
+ * The sentence findings use to disclose a truncated account set. Defined here, next to the limit
26
+ * it describes, so the two checks cannot state different numbers.
27
+ */
28
+ export function truncationDisclosure(truncated) {
29
+ if (!truncated)
30
+ return '';
31
+ return ` The candidate query returned its maximum of ${CANDIDATE_LIMIT} rows, so the account set is truncated: further integration or service accounts may exist in this org that this run never examined. Treat any count or list here as a floor rather than a complete inventory.`;
32
+ }
33
+ /**
34
+ * One resolve per audit run, per context.
35
+ *
36
+ * Both `integration-users` and `integration-least-privilege` need the same account set, and the
37
+ * resolver's slowest query is a 90-day `LoginHistory` aggregate — running it twice per audit buys
38
+ * nothing. Memoising on the context object rather than `AuditCache` keeps this free of the
39
+ * registry-ordering constraint that cache dependencies impose (see CheckEngine.validateCacheOrdering),
40
+ * which the design deliberately avoided, and the WeakMap lets the whole result go when the context does.
41
+ */
42
+ const inFlight = new WeakMap();
43
+ export function resolveIntegrationAccounts(ctx) {
44
+ const cached = inFlight.get(ctx);
45
+ if (cached)
46
+ return cached;
47
+ // A rejection must not be cached: the second caller would inherit a failure it never provoked
48
+ // and could never retry. resolve() catches its own query failures (returning `unavailable`),
49
+ // so this path is defensive rather than expected.
50
+ const pending = resolve(ctx).catch((err) => {
51
+ inFlight.delete(ctx);
52
+ throw err;
53
+ });
54
+ inFlight.set(ctx, pending);
55
+ return pending;
56
+ }
57
+ async function resolve(ctx) {
58
+ const degraded = [];
59
+ // connected-app-run-as is not implemented: confirming which object exposes a connected app's
60
+ // run-as user requires a live-org describe, and this project forbids running against a real
61
+ // org. Disclosing it unconditionally means every finding shows the gap instead of implying the
62
+ // signal was gathered and found nothing.
63
+ degraded.push('connected-app-run-as');
64
+ let rows;
65
+ try {
66
+ rows = await ctx.soql.queryAll(`SELECT Id, Username, Profile.Name, Profile.UserLicense.Name, LastLoginDate, CreatedDate
67
+ FROM User
68
+ WHERE IsActive = true
69
+ AND ( Profile.UserLicense.Name = '${INTEGRATION_LICENSE}'
70
+ OR (LastLoginDate = null AND CreatedDate < LAST_N_DAYS:${NEVER_LOGGED_IN_MIN_AGE_DAYS})
71
+ OR ${SERVICE_LIKE_CLAUSES.join(' OR ')} )
72
+ AND Id NOT IN (SELECT UserId FROM UserLogin WHERE IsFrozen = true)
73
+ ORDER BY LastLoginDate ASC NULLS FIRST
74
+ LIMIT ${CANDIDATE_LIMIT}`);
75
+ }
76
+ catch {
77
+ return { accounts: [], degraded, unavailable: true, truncated: false };
78
+ }
79
+ const truncated = rows.length >= CANDIDATE_LIMIT;
80
+ const byId = new Map();
81
+ for (const r of rows)
82
+ byId.set(r.Id, toAccount(r));
83
+ const jobOwnerIds = await resolveJobOwnerIds(ctx, degraded);
84
+ await mergePlatformSignal(ctx, byId, jobOwnerIds, 'scheduled-job-owner');
85
+ await mergeApiOnlySignal(ctx, byId, degraded);
86
+ // A returned account with no signal is one the resolver cannot explain; downstream findings
87
+ // name the signals as their justification. This filter must run after every signal merge above
88
+ // — an account reachable only through a platform signal (e.g. scheduled-job-owner) has no
89
+ // intrinsic signals and would be dropped if this ran before the merge, defeating the point of
90
+ // having the signal at all.
91
+ const accounts = [...byId.values()].filter((a) => a.signals.length > 0);
92
+ return { accounts, degraded, unavailable: false, truncated };
93
+ }
94
+ /**
95
+ * One row → account mapping, used by both the candidate loop and the platform-signal enrichment
96
+ * loop. Two copies of this is how the two paths would drift: an account pulled in by a platform
97
+ * signal must be described exactly as one the candidate query returned.
98
+ */
99
+ function toAccount(r) {
100
+ return {
101
+ id: r.Id,
102
+ username: r.Username,
103
+ profileName: r.Profile?.Name ?? 'unknown',
104
+ lastLoginDate: r.LastLoginDate,
105
+ signals: intrinsicSignals(r),
106
+ };
107
+ }
108
+ function intrinsicSignals(r) {
109
+ const signals = [];
110
+ if (r.Profile?.UserLicense?.Name === INTEGRATION_LICENSE)
111
+ signals.push('integration-license');
112
+ if (r.LastLoginDate === null)
113
+ signals.push('never-logged-in');
114
+ if (SERVICE_LIKE_PATTERN.test(r.Username))
115
+ signals.push('username-pattern');
116
+ return signals;
117
+ }
118
+ /** Owners of scheduled Apex. An account that only runs jobs matches no username pattern. */
119
+ async function resolveJobOwnerIds(ctx, degraded) {
120
+ try {
121
+ const jobs = await ctx.soql.queryAll(`SELECT CreatedById FROM AsyncApexJob
122
+ WHERE JobType = 'ScheduledApex' AND CreatedDate = LAST_N_DAYS:90
123
+ LIMIT 500`);
124
+ return [...new Set(jobs.map((j) => j.CreatedById).filter(Boolean))];
125
+ }
126
+ catch {
127
+ degraded.push('scheduled-job-owner');
128
+ return [];
129
+ }
130
+ }
131
+ /**
132
+ * Adds `signal` to accounts already resolved, and pulls in any id the candidate query missed.
133
+ * An account reachable only by a platform signal is exactly the one the heuristics cannot see,
134
+ * so dropping it here would defeat the point of having the signal.
135
+ */
136
+ async function mergePlatformSignal(ctx, byId, ids, signal) {
137
+ if (ids.length === 0)
138
+ return;
139
+ const missing = ids.filter((id) => !byId.has(id));
140
+ if (missing.length > 0) {
141
+ try {
142
+ const inList = missing.map((i) => `'${i}'`).join(',');
143
+ const extra = await ctx.soql.queryAll(`SELECT Id, Username, Profile.Name, Profile.UserLicense.Name, LastLoginDate, CreatedDate
144
+ FROM User WHERE IsActive = true AND Id IN (${inList})`);
145
+ for (const r of extra)
146
+ byId.set(r.Id, toAccount(r));
147
+ }
148
+ catch {
149
+ // The signal's ids are known but the users are unreadable: the accounts we do have stand.
150
+ }
151
+ }
152
+ for (const id of ids) {
153
+ const acct = byId.get(id);
154
+ if (acct && !acct.signals.includes(signal))
155
+ acct.signals.push(signal);
156
+ }
157
+ }
158
+ const LOGIN_LOOKBACK_DAYS = 90;
159
+ /**
160
+ * A login that arrived over an API rather than an interactive session.
161
+ *
162
+ * `Application` is a free-text client name, so the alternatives are word-bounded: an unanchored
163
+ * `api` matches the "api" inside a connected app called "Rapid7 Insight", which would stamp
164
+ * `api-only-login` on an interactive login and, through it, an aggravating note on a CRITICAL
165
+ * finding. `ApiType` is a controlled vocabulary ("SOAP Partner", "REST", "Bulk"), so substring
166
+ * matching there is safe and is what actually carries most API logins.
167
+ *
168
+ * The same LoginHistory Application/ApiType classification is used by `SoapLoginApiAuthCheck`'s
169
+ * `isSoapLogin`, which stays deliberately broad — it grades readiness for a release update, where
170
+ * over-matching costs a needless review, whereas over-matching here mislabels an account.
171
+ */
172
+ function isApiLogin(row) {
173
+ return /soap|rest|bulk|api/i.test(row.ApiType ?? '') ||
174
+ /\b(apis?|soap|bulk|data ?loader)\b/i.test(row.Application ?? '');
175
+ }
176
+ /**
177
+ * Flags an account whose logins over the window are all API/SOAP/Bulk and never interactive.
178
+ * Application and ApiType are groupable but not filterable on LoginHistory — a WHERE clause
179
+ * naming either returns a parse error — so the query groups by them and this filters in memory.
180
+ */
181
+ async function mergeApiOnlySignal(ctx, byId, degraded) {
182
+ let rows;
183
+ try {
184
+ rows = await ctx.soql.queryAll(`SELECT UserId, Application, ApiType, COUNT(Id) logins
185
+ FROM LoginHistory
186
+ WHERE LoginTime = LAST_N_DAYS:${LOGIN_LOOKBACK_DAYS}
187
+ GROUP BY UserId, Application, ApiType`);
188
+ }
189
+ catch {
190
+ degraded.push('api-only-login');
191
+ return;
192
+ }
193
+ const apiOnly = new Map();
194
+ for (const row of rows) {
195
+ if (!row.UserId || !byId.has(row.UserId))
196
+ continue;
197
+ const soFar = apiOnly.get(row.UserId);
198
+ const thisRowIsApi = isApiLogin(row);
199
+ apiOnly.set(row.UserId, soFar === false ? false : thisRowIsApi);
200
+ }
201
+ for (const [id, only] of apiOnly) {
202
+ if (!only)
203
+ continue;
204
+ const acct = byId.get(id);
205
+ if (acct && !acct.signals.includes('api-only-login'))
206
+ acct.signals.push('api-only-login');
207
+ }
208
+ }
209
+ //# sourceMappingURL=integrationAccounts.js.map
@@ -9,6 +9,7 @@ export default class SecurityAuditCommand extends SfCommand<AuditResult> {
9
9
  format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
10
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
11
  'fail-on': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ 'fail-on-inconclusive': import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
13
  checks: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
14
  'scoring-config': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
15
  'prepared-for': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -24,6 +25,16 @@ export default class SecurityAuditCommand extends SfCommand<AuditResult> {
24
25
  private resolveFormats;
25
26
  private rendererFor;
26
27
  private printSummary;
27
- private handleFailOn;
28
+ /**
29
+ * Set the process exit code from the audit outcome.
30
+ *
31
+ * 0 clean · 1 findings at or above --fail-on · 3 inconclusive checks when the
32
+ * caller passed --fail-on-inconclusive. Anything that stops the audit running
33
+ * at all surfaces as oclif's own error exit instead.
34
+ *
35
+ * The result is always returned, so `--json` still yields the full report
36
+ * alongside a non-zero exit.
37
+ */
38
+ private applyExitCode;
28
39
  }
29
40
  //# sourceMappingURL=security.d.ts.map
@@ -12,6 +12,7 @@ import { resolveFrameworks } from '../../compliance/resolve.js';
12
12
  import { buildAuditContext, resolveOrgInfo } from '../../lib/wire.js';
13
13
  import { loadScoringConfig } from '../../findings/loadScoringConfig.js';
14
14
  import { HistoryStore } from '../../history/HistoryStore.js';
15
+ import { EXIT_FINDINGS, EXIT_INCONCLUSIVE, resolveExitCode, violationsFor } from '../../findings/exitCode.js';
15
16
  const RENDERERS = {
16
17
  html: new HtmlRenderer(),
17
18
  md: new MarkdownRenderer(),
@@ -41,6 +42,10 @@ export default class SecurityAuditCommand extends SfCommand {
41
42
  summary: 'Exit with code 1 if any finding is at or above this severity.',
42
43
  options: ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'],
43
44
  }),
45
+ 'fail-on-inconclusive': Flags.boolean({
46
+ summary: 'Exit with code 3 if any check could not gather evidence. Off by default.',
47
+ default: false,
48
+ }),
44
49
  checks: Flags.string({
45
50
  summary: 'Comma-separated check IDs to run. Omit to run all checks.',
46
51
  helpValue: 'hardcoded-credentials,apex-sharing',
@@ -109,9 +114,7 @@ export default class SecurityAuditCommand extends SfCommand {
109
114
  this.printSummary(result);
110
115
  this.log('');
111
116
  this.log(' Deep dives: https://softwareinsights.dev · Remediation help: https://cloudcounsel.co.nz');
112
- if (flags['fail-on']) {
113
- this.handleFailOn(result, flags['fail-on']);
114
- }
117
+ this.applyExitCode(result, flags['fail-on'], flags['fail-on-inconclusive']);
115
118
  return result;
116
119
  }
117
120
  /** Resolve --checks to the checks to run, erroring on any unknown ID. */
@@ -169,17 +172,37 @@ export default class SecurityAuditCommand extends SfCommand {
169
172
  this.log(` Score: ${result.healthScore}/100 Grade: ${result.grade}`);
170
173
  this.log('─────────────────────────────');
171
174
  }
172
- handleFailOn(result, failOn) {
173
- const ORDER = ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'];
174
- const threshold = ORDER.indexOf(failOn);
175
- const violations = result.findings.filter((f) => ORDER.indexOf(f.riskLevel) <= threshold);
176
- if (violations.length > 0) {
175
+ /**
176
+ * Set the process exit code from the audit outcome.
177
+ *
178
+ * 0 clean · 1 findings at or above --fail-on · 3 inconclusive checks when the
179
+ * caller passed --fail-on-inconclusive. Anything that stops the audit running
180
+ * at all surfaces as oclif's own error exit instead.
181
+ *
182
+ * The result is always returned, so `--json` still yields the full report
183
+ * alongside a non-zero exit.
184
+ */
185
+ applyExitCode(result, failOn, failOnInconclusive) {
186
+ const code = resolveExitCode(result.findings, { failOn, failOnInconclusive });
187
+ if (code === EXIT_FINDINGS && failOn !== undefined) {
188
+ const violations = violationsFor(result.findings, failOn);
177
189
  this.log(`\nFail-on threshold: ${failOn}, ${violations.length} finding${violations.length !== 1 ? 's' : ''} at or above threshold:`);
178
190
  for (const f of violations) {
179
191
  this.log(` [${f.riskLevel}] ${f.title}`);
180
192
  }
181
- this.exit(1);
182
193
  }
194
+ if (code === EXIT_INCONCLUSIVE) {
195
+ const blind = result.findings.filter((f) => f.inconclusive === true);
196
+ this.log(`\n${blind.length} check${blind.length !== 1 ? 's' : ''} could not gather evidence:`);
197
+ for (const f of blind) {
198
+ this.log(` [inconclusive] ${f.title}`);
199
+ }
200
+ }
201
+ // Deliberately not this.exit(): that throws an ExitError, which SfCommand.catch()
202
+ // renders as the JSON error envelope, discarding the audit result under --json.
203
+ // Setting the code lets run() return the report and still exit non-zero.
204
+ if (code !== 0)
205
+ process.exitCode = code;
183
206
  }
184
207
  }
185
208
  //# sourceMappingURL=security.js.map
@@ -0,0 +1,3 @@
1
+ import type { ControlDef } from '../types.js';
2
+ export declare const GDPR_CONTROLS: ControlDef[];
3
+ //# sourceMappingURL=gdpr.d.ts.map
@@ -0,0 +1,54 @@
1
+ // GDPR — Regulation (EU) 2016/679 of the European Parliament and of the Council of 27 April 2016
2
+ // on the protection of natural persons with regard to the processing of personal data and on the
3
+ // free movement of such data, and repealing Directive 95/46/EC.
4
+ //
5
+ // Article headings and the quoted text of Art. 5(1)(f), 25 and 32(1)(a)-(d) verified 2026-08
6
+ // against the consolidated regulation text; the Official Journal (OJ L 119, 4.5.2016) is the
7
+ // canonical reference.
8
+ //
9
+ // Scope note: GDPR is a regulation about processing, not a technical control set, so only the
10
+ // articles that a read-only Salesforce org-configuration review can produce evidence for are
11
+ // catalogued. Articles covering lawful basis, data-subject rights, DPIAs (Art. 35), controller /
12
+ // processor contracts and supervisory-authority procedure are out of scope for this tool and
13
+ // deliberately absent — their absence is not a claim that they do not apply.
14
+ //
15
+ // Where a paragraph is mapped rather than a whole article (Art. 5(1)(f), Art. 32(1)(a)/(b)/(d)),
16
+ // the id names the paragraph so a finding cites the specific obligation, not the article at large.
17
+ const V = 'Regulation (EU) 2016/679';
18
+ const URL = 'https://eur-lex.europa.eu/eli/reg/2016/679/oj/eng';
19
+ const ref = (cite) => `Regulation (EU) 2016/679, ${cite}`;
20
+ export const GDPR_CONTROLS = [
21
+ { id: 'GDPR-Art5(1)(f)', framework: 'GDPR', version: V,
22
+ title: 'Integrity and confidentiality',
23
+ requirement: 'Personal data shall be processed in a manner that ensures appropriate security of the personal data, including protection against unauthorised or unlawful processing and against accidental loss, destruction or damage, using appropriate technical or organisational measures.',
24
+ sourceRef: ref('Art. 5(1)(f)'), url: URL, verified: true },
25
+ { id: 'GDPR-Art25', framework: 'GDPR', version: V,
26
+ title: 'Data protection by design and by default',
27
+ requirement: 'The controller shall implement appropriate technical and organisational measures for ensuring that, by default, only personal data which are necessary for each specific purpose are processed — including their accessibility. Such measures shall ensure that by default personal data are not made accessible without the individual\'s intervention to an indefinite number of natural persons.',
28
+ sourceRef: ref('Art. 25(1)-(2)'), url: URL, verified: true },
29
+ { id: 'GDPR-Art30', framework: 'GDPR', version: V,
30
+ title: 'Records of processing activities',
31
+ requirement: 'Each controller shall maintain a record of processing activities under its responsibility, including the categories of personal data processed, the categories of recipients to whom the data have been disclosed, and transfers to third countries.',
32
+ sourceRef: ref('Art. 30(1)'), url: URL, verified: true },
33
+ { id: 'GDPR-Art32(1)(a)', framework: 'GDPR', version: V,
34
+ title: 'Pseudonymisation and encryption of personal data',
35
+ requirement: 'Taking account of the state of the art and the risks of the processing, the controller and processor shall implement appropriate technical and organisational measures including the pseudonymisation and encryption of personal data.',
36
+ sourceRef: ref('Art. 32(1)(a)'), url: URL, verified: true },
37
+ { id: 'GDPR-Art32(1)(b)', framework: 'GDPR', version: V,
38
+ title: 'Ongoing confidentiality, integrity, availability and resilience',
39
+ requirement: 'The controller and processor shall implement measures providing the ability to ensure the ongoing confidentiality, integrity, availability and resilience of processing systems and services.',
40
+ sourceRef: ref('Art. 32(1)(b)'), url: URL, verified: true },
41
+ { id: 'GDPR-Art32(1)(d)', framework: 'GDPR', version: V,
42
+ title: 'Regular testing and evaluation of security measures',
43
+ requirement: 'The controller and processor shall implement a process for regularly testing, assessing and evaluating the effectiveness of technical and organisational measures for ensuring the security of the processing.',
44
+ sourceRef: ref('Art. 32(1)(d)'), url: URL, verified: true },
45
+ { id: 'GDPR-Art33', framework: 'GDPR', version: V,
46
+ title: 'Notification of a personal data breach to the supervisory authority',
47
+ requirement: 'In the case of a personal data breach, the controller shall without undue delay and, where feasible, not later than 72 hours after having become aware of it, notify the breach to the competent supervisory authority. Detecting and characterising a breach is a precondition of meeting that deadline.',
48
+ sourceRef: ref('Art. 33(1)'), url: URL, verified: true },
49
+ { id: 'GDPR-Art44', framework: 'GDPR', version: V,
50
+ title: 'General principle for transfers',
51
+ requirement: 'Any transfer of personal data to a third country or international organisation shall take place only if the conditions of Chapter V are met, including onward transfers. All provisions of that chapter shall be applied to ensure the level of protection guaranteed by this Regulation is not undermined.',
52
+ sourceRef: ref('Art. 44'), url: URL, verified: true },
53
+ ];
54
+ //# sourceMappingURL=gdpr.js.map
@@ -0,0 +1,3 @@
1
+ import type { ControlDef } from '../types.js';
2
+ export declare const HIPAA_CONTROLS: ControlDef[];
3
+ //# sourceMappingURL=hipaa.d.ts.map
@@ -0,0 +1,97 @@
1
+ // HIPAA Security Rule — 45 CFR Part 164, Subpart C ("Security Standards for the Protection of
2
+ // Electronic Protected Health Information"), as amended by the 2013 Omnibus Rule.
3
+ //
4
+ // Version pinning matters here. HHS published an NPRM on 2025-01-06 that would rewrite these
5
+ // safeguards — removing the Required/Addressable distinction and making encryption, MFA and
6
+ // network segmentation mandatory. As of 2026-08 that rule is still PROPOSED, not final, so this
7
+ // catalog maps the operative rule. When the final rule lands, `version` and the affected
8
+ // `requirement` texts must be re-pinned and re-verified, not silently amended.
9
+ //
10
+ // Standard headings and implementation-specification names verified 2026-08 against the
11
+ // codified text of 45 CFR 164.308 / 164.310 / 164.312, including each spec's
12
+ // Required vs Addressable designation. `requirement` quotes the regulatory text.
13
+ //
14
+ // Scope note: only safeguards a read-only Salesforce org-configuration review can speak to are
15
+ // catalogued. The physical safeguards (164.310), contingency planning (164.308(a)(7)) and the
16
+ // documentation requirements (164.316) are out of scope for this tool and deliberately absent —
17
+ // their absence is not a claim that they do not apply.
18
+ const V = '45 CFR Part 164 Subpart C (HIPAA Security Rule, 2013 Omnibus)';
19
+ const URL = 'https://www.ecfr.gov/current/title-45/subtitle-A/subchapter-C/part-164/subpart-C';
20
+ const ref = (cite) => `45 CFR ${cite}`;
21
+ export const HIPAA_CONTROLS = [
22
+ // --- 164.308 Administrative safeguards ---
23
+ { id: 'HIPAA-164.308(a)(1)(ii)(A)', framework: 'HIPAA', version: V,
24
+ title: 'Risk analysis (Required)',
25
+ requirement: 'Conduct an accurate and thorough assessment of the potential risks and vulnerabilities to the confidentiality, integrity, and availability of electronic protected health information held by the covered entity or business associate.',
26
+ sourceRef: ref('164.308(a)(1)(ii)(A)'), url: URL, verified: true },
27
+ { id: 'HIPAA-164.308(a)(1)(ii)(B)', framework: 'HIPAA', version: V,
28
+ title: 'Risk management (Required)',
29
+ requirement: 'Implement security measures sufficient to reduce risks and vulnerabilities to a reasonable and appropriate level.',
30
+ sourceRef: ref('164.308(a)(1)(ii)(B)'), url: URL, verified: true },
31
+ { id: 'HIPAA-164.308(a)(1)(ii)(D)', framework: 'HIPAA', version: V,
32
+ title: 'Information system activity review (Required)',
33
+ requirement: 'Implement procedures to regularly review records of information system activity, such as audit logs, access reports, and security incident tracking reports.',
34
+ sourceRef: ref('164.308(a)(1)(ii)(D)'), url: URL, verified: true },
35
+ { id: 'HIPAA-164.308(a)(3)', framework: 'HIPAA', version: V,
36
+ title: 'Workforce security',
37
+ requirement: 'Implement policies and procedures to ensure that all members of the workforce have appropriate access to electronic protected health information, and to prevent those who do not have access from obtaining access — including termination procedures for ending access when employment or authorisation ends.',
38
+ sourceRef: ref('164.308(a)(3)'), url: URL, verified: true },
39
+ { id: 'HIPAA-164.308(a)(4)', framework: 'HIPAA', version: V,
40
+ title: 'Information access management',
41
+ requirement: 'Implement policies and procedures for authorising access to electronic protected health information that are consistent with the applicable requirements of subpart E, including access authorisation and access establishment and modification.',
42
+ sourceRef: ref('164.308(a)(4)'), url: URL, verified: true },
43
+ { id: 'HIPAA-164.308(a)(5)(ii)(C)', framework: 'HIPAA', version: V,
44
+ title: 'Log-in monitoring (Addressable)',
45
+ requirement: 'Procedures for monitoring log-in attempts and reporting discrepancies.',
46
+ sourceRef: ref('164.308(a)(5)(ii)(C)'), url: URL, verified: true },
47
+ { id: 'HIPAA-164.308(a)(5)(ii)(D)', framework: 'HIPAA', version: V,
48
+ title: 'Password management (Addressable)',
49
+ requirement: 'Procedures for creating, changing, and safeguarding passwords.',
50
+ sourceRef: ref('164.308(a)(5)(ii)(D)'), url: URL, verified: true },
51
+ { id: 'HIPAA-164.308(a)(6)', framework: 'HIPAA', version: V,
52
+ title: 'Security incident procedures',
53
+ requirement: 'Implement policies and procedures to address security incidents, including identifying and responding to suspected or known security incidents, mitigating their harmful effects, and documenting incidents and their outcomes.',
54
+ sourceRef: ref('164.308(a)(6)'), url: URL, verified: true },
55
+ { id: 'HIPAA-164.308(a)(8)', framework: 'HIPAA', version: V,
56
+ title: 'Evaluation',
57
+ requirement: 'Perform a periodic technical and nontechnical evaluation, in response to environmental or operational changes affecting the security of electronic protected health information, that establishes the extent to which security policies and procedures meet the requirements of this subpart.',
58
+ sourceRef: ref('164.308(a)(8)'), url: URL, verified: true },
59
+ // --- 164.312 Technical safeguards ---
60
+ { id: 'HIPAA-164.312(a)(1)', framework: 'HIPAA', version: V,
61
+ title: 'Access control',
62
+ requirement: 'Implement technical policies and procedures for electronic information systems that maintain electronic protected health information to allow access only to those persons or software programs that have been granted access rights as specified in 164.308(a)(4).',
63
+ sourceRef: ref('164.312(a)(1)'), url: URL, verified: true },
64
+ { id: 'HIPAA-164.312(a)(2)(i)', framework: 'HIPAA', version: V,
65
+ title: 'Unique user identification (Required)',
66
+ requirement: 'Assign a unique name and/or number for identifying and tracking user identity.',
67
+ sourceRef: ref('164.312(a)(2)(i)'), url: URL, verified: true },
68
+ { id: 'HIPAA-164.312(a)(2)(iii)', framework: 'HIPAA', version: V,
69
+ title: 'Automatic logoff (Addressable)',
70
+ requirement: 'Implement electronic procedures that terminate an electronic session after a predetermined time of inactivity.',
71
+ sourceRef: ref('164.312(a)(2)(iii)'), url: URL, verified: true },
72
+ { id: 'HIPAA-164.312(a)(2)(iv)', framework: 'HIPAA', version: V,
73
+ title: 'Encryption and decryption (Addressable)',
74
+ requirement: 'Implement a mechanism to encrypt and decrypt electronic protected health information.',
75
+ sourceRef: ref('164.312(a)(2)(iv)'), url: URL, verified: true },
76
+ { id: 'HIPAA-164.312(b)', framework: 'HIPAA', version: V,
77
+ title: 'Audit controls',
78
+ requirement: 'Implement hardware, software, and/or procedural mechanisms that record and examine activity in information systems that contain or use electronic protected health information.',
79
+ sourceRef: ref('164.312(b)'), url: URL, verified: true },
80
+ { id: 'HIPAA-164.312(c)(1)', framework: 'HIPAA', version: V,
81
+ title: 'Integrity',
82
+ requirement: 'Implement policies and procedures to protect electronic protected health information from improper alteration or destruction.',
83
+ sourceRef: ref('164.312(c)(1)'), url: URL, verified: true },
84
+ { id: 'HIPAA-164.312(d)', framework: 'HIPAA', version: V,
85
+ title: 'Person or entity authentication',
86
+ requirement: 'Implement procedures to verify that a person or entity seeking access to electronic protected health information is the one claimed.',
87
+ sourceRef: ref('164.312(d)'), url: URL, verified: true },
88
+ { id: 'HIPAA-164.312(e)(1)', framework: 'HIPAA', version: V,
89
+ title: 'Transmission security',
90
+ requirement: 'Implement technical security measures to guard against unauthorised access to electronic protected health information that is being transmitted over an electronic communications network.',
91
+ sourceRef: ref('164.312(e)(1)'), url: URL, verified: true },
92
+ { id: 'HIPAA-164.312(e)(2)(ii)', framework: 'HIPAA', version: V,
93
+ title: 'Encryption in transmission (Addressable)',
94
+ requirement: 'Implement a mechanism to encrypt electronic protected health information whenever deemed appropriate.',
95
+ sourceRef: ref('164.312(e)(2)(ii)'), url: URL, verified: true },
96
+ ];
97
+ //# sourceMappingURL=hipaa.js.map
@@ -6,6 +6,8 @@ import { SBS_CONTROLS } from './sbs.js';
6
6
  import { PRIVACY_ACT_CONTROLS } from './privacyAct.js';
7
7
  import { HISO10029_CONTROLS } from './hiso10029.js';
8
8
  import { NZISM_CONTROLS } from './nzism.js';
9
+ import { HIPAA_CONTROLS } from './hipaa.js';
10
+ import { GDPR_CONTROLS } from './gdpr.js';
9
11
  export const ALL_CONTROLS = [
10
12
  ...OWASP_CONTROLS,
11
13
  ...OWASP_LLM_CONTROLS,
@@ -15,6 +17,8 @@ export const ALL_CONTROLS = [
15
17
  ...PRIVACY_ACT_CONTROLS,
16
18
  ...HISO10029_CONTROLS,
17
19
  ...NZISM_CONTROLS,
20
+ ...HIPAA_CONTROLS,
21
+ ...GDPR_CONTROLS,
18
22
  ];
19
23
  const BY_ID = new Map(ALL_CONTROLS.map((c) => [c.id, c]));
20
24
  export function getControl(id) {