From f31552f5dba1082ab1e0fe78852c85c3825cec24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikolaj=20Jakobi=20N=C3=B8ttrup?= <242577394+Nikolaj1407@users.noreply.github.com> Date: Sat, 26 Sep 2026 22:47:23 +0200 Subject: [PATCH] Fix indirect permission letters in indirect-permissions-for-elevated-access Each letter of a permission value is one permission, so `ri` is indirect read plus indirect insert. The good sample granted a read-only "Report Runner" role indirect insert on G/L Entry. Use `r` in the sample, name the lowercase letters in Best Practice, replace the ri/ii/mi/di keywords and cite the Microsoft Learn pages that define the letters. Co-Authored-By: Claude Opus 5.5 --- .../indirect-permissions-for-elevated-access.good.al | 2 +- .../security/indirect-permissions-for-elevated-access.md | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/microsoft/knowledge/security/indirect-permissions-for-elevated-access.good.al b/microsoft/knowledge/security/indirect-permissions-for-elevated-access.good.al index 9fef5e4..f69dbc3 100644 --- a/microsoft/knowledge/security/indirect-permissions-for-elevated-access.good.al +++ b/microsoft/knowledge/security/indirect-permissions-for-elevated-access.good.al @@ -1,4 +1,4 @@ permissionset 50203 "Sec Sample Report Runner" { - Permissions = tabledata "G/L Entry" = ri; + Permissions = tabledata "G/L Entry" = r; } diff --git a/microsoft/knowledge/security/indirect-permissions-for-elevated-access.md b/microsoft/knowledge/security/indirect-permissions-for-elevated-access.md index 2a39b9c..8e3d620 100644 --- a/microsoft/knowledge/security/indirect-permissions-for-elevated-access.md +++ b/microsoft/knowledge/security/indirect-permissions-for-elevated-access.md @@ -1,7 +1,7 @@ --- bc-version: [all] domain: security -keywords: [permissionset, indirect-permissions, ri, ii, mi, di, code-mediated] +keywords: [permissionset, indirect-permissions, lowercase, code-mediated] technologies: [al] countries: [w1] application-area: [all] @@ -15,8 +15,12 @@ In a `permissionset`, uppercase letters (`R`, `I`, `M`, `D`) grant **direct** pe ## Best Practice -Use indirect permissions (`ri`, `ii`, `mi`, `di`) when a role needs access to a sensitive table only through a specific codeunit or report — for example, a "Report Runner" role that reads `G/L Entry` only via published reports. Pair the indirect grant with the codeunit or report that mediates access; that object's own permissions (or InherentPermissions) supply the direct rights. Document why indirect permissions are required in the permission set or in the consuming object's comments. See sample: [`indirect-permissions-for-elevated-access.good.al`](indirect-permissions-for-elevated-access.good.al). +Use indirect permissions (the lowercase letters `r`, `i`, `m`, `d`) when a role needs access to a sensitive table only through a specific codeunit or report — for example, a "Report Runner" role that reads `G/L Entry` only via published reports, granted `tabledata "G/L Entry" = r`. Each letter is one permission: `ri` grants indirect read **and** indirect insert, so grant only the letters the role needs. Pair the indirect grant with the codeunit or report that mediates access; that object's own permissions (or InherentPermissions) supply the direct rights. Document why indirect permissions are required in the permission set or in the consuming object's comments. See sample: [`indirect-permissions-for-elevated-access.good.al`](indirect-permissions-for-elevated-access.good.al). ## Anti Pattern Granting `RIMD` on a sensitive table when the role only needs to view it through a report — for example `tabledata "G/L Entry" = RIMD` on a "Report Runner" role. Users assigned that role can now query and modify ledger entries directly through any client that respects the permission, bypassing the report entirely. Reviewers should look for uppercase grants on system-of-record tables (G/L Entry, ledger entries, posted documents) where the consuming code path is clearly read-through-report or read-through-API. See sample: [`indirect-permissions-for-elevated-access.bad.al`](indirect-permissions-for-elevated-access.bad.al). + +## References + +[Permissions property](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-permissions-property) and [Permissions on database objects](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-permissions-on-database-objects) define one letter per permission: `R`/`r` read, `I`/`i` insert, `M`/`m` modify, `D`/`d` delete, uppercase for direct and lowercase for indirect.