| name | permission-aware-query-builder |
| description | Warns when CMIS or Alfresco Query Language queries may bypass ACLs. Suggests SearchService with authority context instead. Trigger when generating search or query code. |
Permission-Aware Query Builder
Review generated query code for potential ACL bypass issues.
Rules
- Never use direct JDBC/Hibernate queries to access nodes — these bypass the permission model entirely
- CMIS queries run in the context of the authenticated user by default — this is safe
- SearchService queries — verify
SearchParameters includes authority context when needed
AuthenticationUtil.runAsSystem — flag any query executed inside runAsSystem as a potential security issue unless explicitly justified
sys_acl / sys_racl — when using Search Enterprise (Elasticsearch), verify that ACL fields are included in the search index configuration
- Solr AFTS queries — respect
fts.alfresco.defaultNamespace setting; warn if queries hardcode node refs
Output
Flag each potential ACL bypass with severity (high/medium/low), explanation, and suggested fix.