Skip to content

Commit 7ac7122

Browse files
ACL Audit Utility (#2302)
1 parent 560ee07 commit 7ac7122

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# ACL Audit Utility for ServiceNow
2+
3+
## Overview
4+
5+
This script audits Access Control Lists (ACLs) in your ServiceNow instance to identify potential security misconfigurations. It helps ensure that ACLs are properly configured and do not unintentionally expose sensitive data.
6+
7+
## Features
8+
9+
- Detects **inactive ACLs**
10+
- Flags ACLs with **no condition or script**
11+
- Warns about **public read access** (ACLs with no roles assigned)
12+
- Logs findings using `gs.info()` and `gs.warning()` for visibility
13+
14+
## Usage
15+
16+
1. Navigate to **System Definition >Scripts - Background** in your ServiceNow instance.
17+
2. Create a new Script Include named `ACL_Audit_Utility`.
18+
3. Paste the contents of `code.js` into the script field.
19+
20+
21+
## Notes
22+
23+
- This script does not make any changes to ACLs; it only audits and logs findings.
24+
- You can extend the script to send email notifications or create audit records in a custom table.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
// Description: Audits ACLs for potential misconfigurations and logs findings.
3+
4+
var grACL = new GlideRecord('sys_security_acl');
5+
grACL.query();
6+
7+
while (grACL.next()) {
8+
var aclName = grACL.name.toString();
9+
var type = grACL.type.toString();
10+
var operation = grACL.operation.toString();
11+
var active = grACL.active;
12+
13+
// Check for ACLs that are inactive
14+
if (!active) {
15+
gs.info('[ACL Audit] Inactive ACL found: ' + aclName + ' | Operation: ' + operation);
16+
continue;
17+
}
18+
19+
// Check for ACLs with no condition or script
20+
var hasCondition = grACL.condition && grACL.condition.toString().trim() !== '';
21+
var hasScript = grACL.script && grACL.script.toString().trim() !== '';
22+
23+
if (!hasCondition && !hasScript) {
24+
gs.warning('[ACL Audit] ACL with no condition or script: ' + aclName + ' | Operation: ' + operation);
25+
}
26+
27+
// Check for ACLs granting 'read' access to 'public'
28+
if (operation === 'read' && grACL.roles.toString() === '') {
29+
gs.warning('[ACL Audit] Public read access detected: ' + aclName);
30+
}
31+
}

0 commit comments

Comments
 (0)