Skip to content

Commit 44e4732

Browse files
Create code.js
1 parent 2f1771d commit 44e4732

File tree

1 file changed

+31
-0
lines changed
  • Server-Side Components/Background Scripts/ACL Audit Utility

1 file changed

+31
-0
lines changed
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)