Query Range ACL Errors
Troubleshooting: Query Range ACL Errors After May 2025 ServiceNow Patch
Was this helpful?
Was this helpful?
/**
* ShareLogic Unifi - Disable unnecessary query_range ACLs
*
* In May 2025, ServiceNow deployed a platform-wide security patch which
* automatically created numerous unnecessary ACLs in the ShareLogic Unifi
* application. Unifi already implements its own robust access controls, and
* these additional ACLs provide no further security benefit. Their only effect
* is to trigger "query range" errors when accessing Unifi tables.
*
* Since these ACLs are unique to each instance, you can use this script to
* disable them and restore Unifi to its intended behaviour.
*
* For more information, see:
* https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB2046494
* https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB2130442
*/
(function disableUnifiQueryRangeACLs() {
// ---- Role checks (fail-fast) ----
if (!gs.hasRole('security_admin')) {
gs.debug('Abort: security_admin role is required (elevate privileges first).');
return;
}
var q = new GlideRecord('sys_security_acl');
q.addQuery('sys_scope', '74f0b4550f8ca20094f3c09ce1050e6a'); // Unifi [x_snd_eb]
q.addQuery('sys_created_by', '@@snc_write_audit@@');
q.addQuery('active', true);
q.query();
var total = 0, updated = 0, failed = 0;
while (q.next()) {
total++;
q.setValue('active', false);
if (q.update()) {
updated++;
} else {
failed++;
gs.debug('Update failed: sys_id=' + sysId + ' (active=' + (v.isValidRecord() ? v.getValue('active') : 'N/A') + ')');
}
}
gs.info([
'Unifi ACL disable summary:',
' total matched: ' + total,
' updated: ' + updated,
' failed: ' + failed
].join('\n'));
})();