Skip to content

Check the right query in static Query.SaveAs, and let the API webhook setup read of an empty table pass - #8240

Draft
StefanMaron wants to merge 4 commits into
mainfrom
area-permissions-session-1117
Draft

StefanMaron wants to merge 4 commits into
mainfrom
area-permissions-session-1117

Conversation

@StefanMaron

Copy link
Copy Markdown
Collaborator

[al-runtime-rs / area-permissions-session-1117 / WAITING: more commits follow on this PR]

Fixes #7612
Refs #8038 (the cells with no grant on Published Application still refuse)
Refs #7586 (GetUrl with 5 arguments, Consistent with a guarded Codeunit.Run, GetTable of a Boolean, filter group 1 under another variable: follow-up commits on this PR)
Refs #8028 (the reporter's OnCompanyOpenCompleted subscriber reads CurrentClientType outside a test method; not measured)
Refs #7638 #7659 #6297 #8160 #8032 #8066 #8092 #8093

What changed

  1. Static Query.SaveAsCsv and Query.SaveAsXml check the query of their number. Before, they checked the query of the last instance call in the session. Session::query_object is deleted; query_rows takes the object. One lookup refuses a query that was not compiled, or an unknown id that a skipped dependency app may own.
  2. Under a restricted set, the IsEmpty read of "API Webhook Subscription" by Base Application's codeunit 6153, while it answers GetDatabaseTableTriggerSetup, passes when that table has no row (permissions/SysFlowFieldPerm.al:489-499).

Area table

shape state
static SaveAsCsv/SaveAsXml of a query the set denies main's denial (the gate Query.Open uses, Y24PermExecute.al:62-63), now on the right query. SaveAs itself: PROBE QUEUED
static SaveAs of an uncompiled query, or of an id a skipped app may own REFUSED
static SaveAs of an unknown id, no app skipped main's result (No)
setup read: IsEmpty, empty table, codeunit 6153 of Base Application PINNED SysFlowFieldPerm.al:489-499
setup read: table with a row; FindFirst; another caller; codeunit 6153 of another app main's refusal (Rust test)
Published Application with no grant (98743, 98747) REFUSED, next commit

Tests

  • query_static_save_permission.rs: red before the fix (CsvOfDeniedAfterGranted got "An error was expected inside an ASSERTERROR statement."), green after.
  • trigger_setup_read_permission.rs: the "codeunit 6153 of another app" neighbor was red (it passed), green after the app check.
  • 98743 PARead cases: red on not-passing-onprem for 27, 28, 29, green, pruned (5 per major). 60026 MockedSet_WithTheGrant_AllowsInsert passes on 28 and 29, pruned.
  • --baseline-diff on 27, 28, 29 at the commit before the app check: 0 regressions, 0 without an outcome. It runs again before review.

Decisions taken without the owner

  • The setup read also requires the codeunit to be in Base Application. This is narrower than the pin's facts, never wider.

The static calls ran the permission check against Session::query_object, which only
instance calls set, so the check used the last query of the session or object 0.
query_rows now takes the query object; the field is gone. Both static calls look the
id up through one function that refuses a query of an uncompiled dependency app and an
id a skipped dependency app may own, instead of answering No (al-runner issue 7612).
…ted set

The first write of an own table under a Permissions Mock set asks the table's database
trigger setup; Base Application's API Webhook Notification Mgt. then asks IsEmpty of
API Webhook Subscription, which the set does not grant. BC raises no error there
(permissions/SysFlowFieldPerm.al:489-499); the runtime refused the test. Only that read,
from codeunit 6153, while a setup is asked, on a table with no row, now runs. Five
SysFlowFieldPerm cases pass on BC 28 (al-runner issue 8038).
98743 PARead cases (five per major) and 60026 MockedSet_WithTheGrant_AllowsInsert (BC 28
and 29) pass with the API webhook setup read.
…its neighbors

The setup read of API Webhook Subscription now also requires that codeunit 6153 belongs to
Base Application. A Rust test shows the empty-table read passes, and that a table with a row,
FindFirst, another caller and a codeunit 6153 of another app keep main's refusal.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Static Query.SaveAsCsv and SaveAsXml check permissions on the wrong query and miss uncompiled queries [T1-05]

1 participant