Repository navigation
Implement permission analyzer tool - #357
Merged
Merged
Conversation
Describes xrmmockup-permissions, a standalone dotnet tool that statically analyzes consumer code for the Dataverse table privileges it needs and checks them against the security roles downloaded by xrmmockup-metadata. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
xrmmockup-permissions statically analyzes code that uses the Dataverse SDK and lists the table privileges each method needs (`required` command). - Core (netstandard2.0, Roslyn): extracts IOrganizationService calls and resolves tables from early-bound types, constants, locals, QueryExpression, AddLink, FetchXML and loops over RetrieveMultiple results; anything else is reported as unresolved with the reason - Tool: MSBuildWorkspace loading (Roslyn 5.9, which works with current Visual Studio MSBuild), security roles from Metadata/, text and JSON output, XrmMockup:Permissions configuration and --exclude for test projects - Tests: in-memory compilations against the real SDK, determinism, role loading, project filtering - Design doc: any privilege depth counts as covered for now; a minimum-depth check is noted as a future idea Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Notes `check --user <username>` as a future feature: read the user's direct and team role assignments from Dataverse and check against those roles. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Requirements are now reported per entry point instead of per method: - Discover XrmPluginCore plugin steps and custom APIs, plugin steps from Metadata.xml, code activities, Azure Functions and --entry methods - Follow calls across the solution with services and tables tracked through arguments, fields and constructors, resolving interface calls through DI registrations - Tag each requirement with the identity it runs as, including step impersonation, and list assumptions when it has to be guessed - Add --plugin, --custom-api, --function and --entry scopes and the EntryPoints setting; list methods no entry point reaches - Analyze projects referenced by --project, so function apps reach the Dataverse calls in their shared libraries - Spec: plugin cascades from Azure Functions checked against the function's roles (phase 4) Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Check the requirements against security roles from the metadata: - Add the check command, which exits with 1 when a role lacks a privilege; --strict also fails on anything that wasn't checked - Check each identity against its own roles: --role for the caller and the application user, --caller-role for users acted for through CallerId, and the Principals and Users settings - Add --role and --caller-role to required, and the Suppress setting - Report unknown role names with the closest matches - Summarize the result with a list of missing privileges, each with the entry points that need it, and a Not checked line for unresolved operations, identities without roles, the impersonation privilege and Append/AppendTo - Resolve tables through values returned by helper methods and through type arguments of generic methods Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Move the Execute rule table and Append/AppendTo forward from phase 5, since most code reaches tables through requests and lookups: - Specify the rule table: built-in rules by group, Upsert and *Multiple expanding into the single requests, requests needing no table privilege, and whether XrmMockup enforces each rule - Follow requests and request collections through the call graph, including batching - Report requests without a rule and custom API calls separately - Leave LINQ, global privileges and custom API execute privileges in phase 5 Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Requests passed to Execute are checked against rules for their message: built-in rules for the SDK messages, and a Rules setting to add or replace them. Requests are followed through locals, helpers, parameters and collections, including ExecuteMultiple and the *Multiple requests. Requests without a rule and custom API calls are counted apart under Not checked. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Lookups set on records that are created or updated, directly or through requests, need Append on the record and AppendTo on the referenced table. Lookup targets from the entity metadata resolve values the code doesn't show, with basis all-lookup-targets for polymorphic lookups. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
…oading Entry points include the requirements of the plugin steps and custom APIs their operations fire, transitively, under the identity of the firing operation unless the step impersonates. Metadata steps without code are reported as unresolved. .NET Framework projects load outside Windows using the reference assembly packages in the NuGet cache, and strong-name signing is ignored. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
An operation on an unknown table fires only the steps registered without a table and reports the rest as one unresolved finding, replacing the cascade-unknown basis. Tables are resolved through the record Retrieve returns, early-bound lookup properties (from the metadata's lookup targets, firing the steps of each target) and PrimaryEntityName in plugin steps. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Update steps filtered on columns, from AddFilteredAttributes or the metadata, fire only for updates that set one of them. The columns set are tracked on created entities, locals, parameters per call site and request targets; when they can't all be determined the step fires with basis filter-unknown. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
A user operation on a table runs as the caller, needs the privileges of its request rule on the table, and fires the plugin steps of the rule's messages. --attributes gives the columns it sets, which decide the filtered Update steps it fires and the lookups it needs Append and AppendTo for. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
--plugin-solution and the PluginSolutions setting load plugin code that the analyzed code fires but doesn't include, such as the plugins an Azure Function app fires, for plugin cascades only. Its entry points and unreached methods aren't listed unless a scope selects them, its files are shown relative to the analyzed solution, and ExcludeProjects path patterns match relative to its own solution. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Adds phase 7, role verification for scenarios in XrmMockup core, and phase 5.5, output clean-up with filtering and verbosity, to the design. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
…rivileges - LINQ and OrganizationServiceContext queries, with type parameters of generic types - Privilege catalog and custom API execute privileges from the metadata generator - Requests that need privileges by name (rule GlobalPrivileges), bypass parameters that skip the bypassed plugin steps, overriddencreatedon and the SendEmail send-as assumption - --project no longer lists unreached methods of the projects it references, since a shared library also holds code for other apps Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
--solution now accepts a .csproj as well as a .sln/.slnx, so --project is removed. --plugin-solution keeps its name and still takes either. Role verification in XrmMockup core moves from phase 7 to the later, not yet decided features. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
The text report now defaults to minimal: per set of roles, what it lacks across every entry point, a line per table with the privileges in role editor order. --verbosity compact adds the entry points that need them, grouped when they need the same; normal lists what needs attention per entry point with up to three sources; detailed adds granted requirements and assumptions; full is the previous output. --table, --privilege, --runs-as and --basis narrow the text and JSON report after analysis, leaving the counts, result and exit code those of the whole analysis. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
--format markdown writes the report for pull request comments and job summaries: the result, a table per role set with what it lacks, and the entry points and unresolved operations folded into <details>. --format sarif writes the findings as SARIF 2.1.0 for code scanning: missing privileges as errors (suppressed ones with their reason), unresolved operations as warnings, unchecked and unverifiable privileges as notes, at the call site with the entry points as related locations. Paths are relative to the git repository root. The role-change grouping moves to RoleChanges so the text and Markdown writers share it. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
CI and the release workflow set the version of XrmMockup.PermissionAnalyzer from its CHANGELOG and pack it next to the other packages. CLAUDE.md now describes the dotnet build and pack commands instead of the FAKE script, which no longer exists. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
The entries described the steps of the development, including changes and fixes to features that were never released. v1.0.0-rc.1 is the first release, so the changelog now lists what it adds. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Load roles in file name order, so roles with the same name come out the same on every machine, and replace framework reference links whose target was removed from the package cache. Name the report formats, SARIF rules and role change blocks, take option and setting names from their constants, and share the privilege parsing and the writers' repeated helpers. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
- Carry the call depth through services bound from returned values, so recursive helpers no longer overflow the stack - Follow locals assigned with ??= and report out arguments as such - Keep the Request suffix of a request name given at runtime, so steps and custom APIs registered on it are found - Keep every part of FetchXML built from itself - Include a rule's global privileges and assumptions in --operation - Count tables no role governs as covered also for identities without roles, and match the Update message of a step by name ignoring case - Keep the truncation warning when only unresolved operations or global privileges were found Also share the repeated resolution, argument and merge code, replace the enum arithmetic of request shapes with switches, and name the constants. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Unwrap, Root, IsLocal, LocalValues, Argument, GuidConstant and the source and framework checks move into Extraction/Operations, replacing three drifted copies; SourcePaths.Declaration replaces two more. Rules are applied by RuleApplication for both requests in code and --operation, through IRequestMembers. The remaining candidate refactors are noted in docs/design. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
…on analyzer EntryPoint and MethodManifest implement IManifestSection, Manifest.Sections lists both and CoverageReport.For takes a section. The reports read a section's table and global requirements through one PrivilegeNeed projection, and TableChange.IsGlobal replaces the "global" placeholder privilege in the role changes and Markdown. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
The Request suffix is removed only from a request type's name. A message from code is matched to a rule named as the message or as its request type, configured rules first, and fires the steps of the message as called. Names written in As or --operation still accept the request type form. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Bind declarations in parallel and build the call graph from them in source order, use server GC, reject text that can't be FetchXML before parsing it, and cache member and type ids, relative paths and logical names. Also note reporting privileges the roles grant but nothing uses as a future idea. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
…builder Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Message and SDK member names are constants, entry point ids are built in one place, and TableResolution no longer changes once made. TableResolver reads collections one way, the text writer is split per report, and a factory picks the manifest writer. Also fixes default objects cut short by the depth limit or a cycle being memoized, cascades dropping the steps they fire, --operation selecting other operations, and WithinTargets dropping columns and bypass. Notes the impersonated-call split in the spec. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
required and check ran the same analysis and wrote the same report, differing only in the exit code. The root command now lists what the code needs and checks it against roles whenever there are any: --role, --caller-role, or the Principals and Users settings, which now apply to every run. --fail-on-missing exits with 1 when a privilege is missing, and with 2 when there is nothing to check against; --strict implies it. --no-roles gives the role-free output. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Each --plugin-solution opened a new MSBuild workspace, so a library shared with the analyzed code or another plugin solution was loaded, compiled and extracted again, and logged again. The paths now share one workspace, where opening a project reuses the projects already loaded, and a project is added to the builder only by the first path that has it. Its kind of code is never weaker than a later path's, so the output doesn't change: on a sample with two plugin projects it is byte-identical and the run takes two minutes instead of three. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
… errors The loader logged "Analyzed <project>" after compiling and extracting, so a slow project only showed once it was done. It now logs "Analyzing <project>" before compiling. Counting compile errors with GetDiagnostics bound every method body a second time, about a third of the time spent per project. The extractor now flags code it couldn't bind, and the full diagnostics only run when it did or the cheap syntax and declaration checks find errors. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
The lookup and plugin step loaders each opened and scanned Metadata.xml, which can be hundreds of megabytes. MetadataFileLoader now reads each *Metadata.xml file in one pass, deserializing only EntityMetadata and, from the main file, Plugins, and skipping the rest. The two loaders keep their conversions. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Six critical analysis-correctness issues and one moderate role-override issue remain unresolved.
7 open issues
Prevent overload graph key collisions · New Separate pipeline targets from privilege-check members · New Preserve framework-specific facts during node merges · New Separate operation targets from request members · New Include app identity in function IDs · New Load primary metadata before extra metadata · New Skip principal resolution when --role overrides roles · New
What changed in this PR
Adds xrmmockup-permissions, a Roslyn-based .NET tool that derives Dataverse privilege requirements from source code and checks security-role coverage for CI.
Changes:
- Introduces permission analysis, entry-point discovery, request rules, role checks, CLI configuration, and deterministic reports.
- Extends metadata exports with privilege catalogs and global privileges, and shares console logging between tools.
- Adds regression tests, design documentation, and analyzer versioning and packaging in CI/releases.
The unresolved findings are noted in the relevant file rows below.
| File | Description |
|---|---|
XrmMockup.slnx |
Registers analyzer and shared-tool projects. |
src/ToolsCommon/ToolsCommon.csproj |
Defines the shared logging library. |
src/ToolsCommon/Logging/ShortCategoryConsoleFormatterOptions.cs |
Adds stderr-aware formatter options. |
src/ToolsCommon/Logging/ShortCategoryConsoleFormatter.cs |
Shares formatting and redirect-aware color handling. |
src/ToolsCommon/Logging/ShortCategoryConsoleExtensions.cs |
Centralizes console logger registration. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Workspace/ProjectFilter.cs |
Implements project exclusion patterns. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Workspace/FrameworkReferences.cs |
Locates .NET Framework reference assemblies. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/ToolLogging.cs |
Routes analyzer diagnostics to stderr. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/ToolException.cs |
Represents actionable input errors. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Program.cs |
Connects CLI parsing and execution. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/PermissionAnalyzer.Tool.csproj |
Configures tool dependencies and packaging. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Output/UnresolvedSites.cs |
Groups unresolved operations by location. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Output/RoleChanges.cs |
Aggregates required role changes. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Output/ReportText.cs |
Shares report totals and result wording. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Output/ReportOptions.cs |
Defines report detail and filtering. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Output/PrivilegeNeed.cs |
Unifies table and global privilege reporting. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Output/MarkdownManifestWriter.cs |
Produces escaped Markdown reports. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Output/ManifestWriters.cs |
Selects output-format writers. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Output/IManifestWriter.cs |
Defines the report-writing contract. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Options/PermissionsConfiguration.cs |
Models permission-analysis configuration. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Options/ConfigReader.cs |
Loads layered configuration sources. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Options/AnalysisSettings.cs |
Resolves analysis paths and inputs. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Metadata/WorkflowLoader.cs |
Loads automatic workflow registrations. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Metadata/RoleLoader.cs |
Converts exported security roles. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Metadata/PrivilegeCatalogLoader.cs |
Loads privilege and custom API definitions. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Metadata/PluginStepLoader.cs |
Converts exported plugin steps. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Metadata/MetadataFileLoader.cs |
Streams metadata. Critical, line 42: file ordering and lookup-level deduplication differ from XrmMockup’s main-file-first, whole-entity merge, producing incorrect lookup targets and AppendTo requirements. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Metadata/LookupLoader.cs |
Extracts lookup target definitions. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/ExitCodes.cs |
Defines tool exit statuses. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Commands/RuleSetup.cs |
Validates configured request rules. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/Commands/CoverageSetup.cs |
Resolves roles, identities, and suppressions. Moderate, line 46: --role still resolves replaced principal mappings, so stale or empty mappings can reject a valid override. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/CliOptions.cs |
Defines CLI options and descriptions. |
src/PermissionAnalyzer/PermissionAnalyzer.Tool/CHANGELOG.md |
Documents the initial analyzer release. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/WorkflowTests.cs |
Tests workflow cascade reporting. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/WorkflowLoaderTests.cs |
Tests workflow metadata loading. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/RoleLoaderTests.cs |
Tests role and catalog conversion. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/ReferencedCodeTests.cs |
Tests referenced-library analysis. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/ProjectFilterTests.cs |
Tests exclusions and path resolution. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/PluginStepLoaderTests.cs |
Tests plugin and lookup metadata loading. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/PluginCodeTests.cs |
Tests external plugin cascades. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/PermissionAnalyzer.Tests.csproj |
Configures the analyzer test project. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/OperationTests.cs |
Tests synthetic user-operation analysis. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/ExecutePrivilegeTests.cs |
Tests execute and impersonation privileges. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/DeterminismTests.cs |
Tests output stability and line endings. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/ContextTests.cs |
Tests LINQ and service-context operations. |
src/PermissionAnalyzer/PermissionAnalyzer.Tests/BypassTests.cs |
Tests plugin bypass behavior. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Polyfills/IsExternalInit.cs |
Enables records on netstandard2.0. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/PermissionAnalyzer.Core.csproj |
Defines the Roslyn-only analyzer library. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/WorkflowRegistration.cs |
Models automatic workflow triggers. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/UnresolvedOperation.cs |
Represents unresolved analysis results. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/Trigger.cs |
Models entry-point trigger details. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/SourceLocation.cs |
Provides sortable source positions. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/RunsAs.cs |
Models execution identities. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/RoleDefinition.cs |
Models exported role privileges. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/RequirementSource.cs |
Tracks requirement locations and paths. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/RequirementBasis.cs |
Classifies requirement origins. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/RequirementBases.cs |
Combines requirement bases. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/Requirement.cs |
Models table privilege requirements. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/RequestRule.cs |
Models request checks and composition. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/PrivilegeDepth.cs |
Defines role privilege depths. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/PrivilegeDefinition.cs |
Models catalog privileges and custom APIs. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/Privilege.cs |
Defines table privilege kinds. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/PluginStepRegistration.cs |
Models exported plugin registrations. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/MethodManifest.cs |
Represents unreached-method requirements. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/Messages.cs |
Centralizes SDK message constants. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/Manifest.cs |
Aggregates analysis sections and tables. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/LookupColumn.cs |
Models lookup target tables. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/IManifestSection.cs |
Unifies manifest section contracts. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/GlobalRequirement.cs |
Models non-table privilege requirements. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/EntryPointKind.cs |
Classifies supported entry points. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/EntryPointIds.cs |
Builds entry-point identifiers. Critical, line 31: identical function names across apps collide, merging handlers and checking their operations against one assembly’s principal roles. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/EntryPoint.cs |
Represents entry-point analysis results. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Model/Assumption.cs |
Records analysis assumptions. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Graph/UserOperation.cs |
Builds synthetic operation graph nodes. Critical, line 54: binding the supplied table to the first privilege-check member makes CloseIncident incident check Create on incident instead of incidentresolution. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Graph/CallGraph.cs |
Merges graph summaries and registrations. Critical, line 25: shared-call-site deduplication ignores table and service differences, dropping framework-specific requirements and cascades. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Extraction/SourcePaths.cs |
Normalizes source paths. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Extraction/SdkNames.cs |
Centralizes SDK member names. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Extraction/RuleApplication.cs |
Applies request privilege and cascade rules. Critical, line 110: treating the first checked member as the pipeline target misroutes requests such as WinOpportunity, omitting parent-table plugins and misbinding user operations. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Extraction/Operations.cs |
Shares Roslyn operation helpers. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Extraction/Nodes.cs |
Generates graph identifiers and labels. Critical, line 128: keys omit generic arity and parameter namespaces, merging distinct overload bodies and reporting unrelated privileges. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Extraction/LookupColumns.cs |
Indexes lookup target metadata. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Coverage/RoleSet.cs |
Combines security-role grants. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Coverage/RoleCatalog.cs |
Resolves roles and suggests names. |
src/PermissionAnalyzer/PermissionAnalyzer.Core/Analysis/EntryPointSelector.cs |
Implements scoped entry-point selection. |
src/PermissionAnalyzer/Directory.Build.props |
Sets analyzer framework and version defaults. |
src/MetadataSkeleton/MetadataSkeleton.cs |
Adds privilege contracts and cloning support. |
src/MetadataGen/MetadataGenerator.Tool/README.md |
Documents new metadata outputs. |
src/MetadataGen/MetadataGenerator.Tool/MetadataGenerator.Tool.csproj |
References the shared logging library. |
src/MetadataGen/MetadataGenerator.Tool/Extensions/ServiceCollectionExtensions.cs |
Uses shared logger registration. |
src/MetadataGen/MetadataGenerator.Tool/CHANGELOG.md |
Documents expanded privilege exports. |
src/MetadataGen/MetadataGenerator.Tool.Tests/Services/OnlineMetadataSourceTests.cs |
Tests privilege-reader delegation. |
src/MetadataGen/MetadataGenerator.Tool.Tests/Services/MetadataGeneratorServiceTests.cs |
Tests catalog generation orchestration. |
src/MetadataGen/MetadataGenerator.Tool.Tests/Services/DataContractMetadataSerializerTests.cs |
Tests privilege serialization compatibility. |
src/MetadataGen/MetadataGenerator.Tool.Tests/Readers/PrivilegeReaderTests.cs |
Tests privilege and API extraction. |
src/MetadataGen/MetadataGenerator.Core/Services/OnlineMetadataSource.cs |
Exposes privilege catalog retrieval. |
src/MetadataGen/MetadataGenerator.Core/Services/MetadataGeneratorService.cs |
Fetches and serializes privilege catalogs. |
src/MetadataGen/MetadataGenerator.Core/Services/IMetadataSource.cs |
Extends the metadata source contract. |
src/MetadataGen/MetadataGenerator.Core/Services/IMetadataSerializer.cs |
Extends the metadata serialization contract. |
src/MetadataGen/MetadataGenerator.Core/Services/DataContractMetadataSerializer.cs |
Writes privilege catalog XML. |
src/MetadataGen/MetadataGenerator.Core/Readers/SecurityRoleReader.cs |
Preserves global role privileges. |
src/MetadataGen/MetadataGenerator.Core/Readers/QueryExtensions.cs |
Shares paged query retrieval. |
src/MetadataGen/MetadataGenerator.Core/Readers/PrivilegeReader.cs |
Extracts privilege and API catalogs. |
src/MetadataGen/MetadataGenerator.Core/Readers/IPrivilegeReader.cs |
Defines the catalog-reader contract. |
src/MetadataGen/MetadataGenerator.Core/Extensions/ServiceCollectionExtensions.cs |
Registers the privilege reader. |
docs/design/permission-analyzer-refactors.md |
Records completed and deferred refactors. |
CLAUDE.md |
Updates architecture and build guidance. |
.github/workflows/release.yml |
Versions and packages analyzer releases. |
.github/workflows/ci.yml |
Versions and packages the analyzer in CI. |
Review effort: Balanced
The lookups came from the last file that had an entity, while XrmMockup reads Metadata.xml first and ignores an entity a later file repeats. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
A principal that maps to a role missing from the metadata stopped a --role run, though --role doesn't use the principals. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Merging a method's summaries across compilations keyed accesses on the operation and reason only, so a call that resolves to another table or privilege in another target framework lost one of them. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
WinOpportunity, LoseOpportunity, WinQuote, CloseQuote and CloseIncident fired their own message on the close activity's table. XrmMockup fires them on the opportunity, quote or incident, and runs WinOpportunity and WinQuote as Win, LoseOpportunity and CloseQuote as Lose. Rules get FiresOn and StepMessage for this, also in the configuration. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Function names are only unique within a function app, so two apps with
a function of the same name got the same id and their requirements
merged. Ids are now function:{assembly}/{name}, and --function takes
the name alone or with its assembly.
Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>
Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
Method ids left out type parameters and the parameter types' namespaces, so Run(IOrganizationService) and Run<T>(IOrganizationService), or Save(A.Record) and Save(B.Record), shared an id and their requirements merged. Generic methods now show their type parameters, and parameter types get namespaces when an overload would otherwise clash. --entry with a method name also matches its generic overloads. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com> Claude-Session: https://claude.ai/code/session_018erjSEDF4ZNJ6PDdFkgVNx
…ty-role-analyzer-515
…ty-role-analyzer-515
Expose typed plugin and entity-operation scopes, reusable source analysis, and checks against current mockup roles and metadata. Split shared contracts and workspace loading into internal libraries, and package source loading as an opt-in .NET 10 payload. Document the SDK workflow and its limits.
…ty-role-analyzer-515
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical findings can drop required privileges, invalidate known role grants, ignore valid configuration, and merge entry points from different assemblies.
4 open issues
7 resolved since last review
Load primary metadata before extra metadata Include app identity in function IDs Separate operation targets from request members Preserve framework-specific facts during node merges Separate pipeline targets from privilege-check members Prevent overload graph key collisions Skip principal resolution when --role overrides roles
Review effort: Balanced
| } | ||
| } | ||
| } | ||
| return new RoleSet(names.ToList(), origin, privileges, globalKnown ? globalPrivileges : null); |
Comment on lines
+19
to
+20
| public static string PluginStep(string type, string message, string? table, string stage) => | ||
| $"{PluginPrefix}{type}:{message}:{table ?? "any"}:{stage}"; |
|
|
||
| foreach (var type in other.Types.Values) | ||
| { | ||
| if (!Types.ContainsKey(type.Id)) Types.Add(type.Id, type); |
Comment on lines
+17
to
+18
| var configuration = File.Exists(configPath) ? ConfigReader.Read(configPath) | ||
| : new LoadedConfiguration(directory, new PermissionsConfiguration(), null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Adds the XrmMockup Permission Analyzer (
xrmmockup-permissions), a new .NET tool that staticallyanalyzes a codebase and works out which Dataverse table privileges it needs.
It finds the entry points (plugin steps, custom APIs, code activities and Azure Functions) and follows the
calls from each one without running any code. It lists the privilege each
IOrganizationServicecallneeds on each table, and which identity it runs as. With the security roles from the metadata folder, it
checks those privileges against the roles and fails with a non-zero exit code when one is missing, so it
can run in CI.
What's in it
src/PermissionAnalyzer: Core (Roslyn-only analysis), Tool (CLI and MSBuild loading) and tests.Append/AppendTo on lookups, LINQ queries, custom API execute privileges and global privileges.
PrivilegeCatalog.xml, and lists the global privilegesin security role files. XrmMockup ignores them, and older role files still load.
src/ToolsCommon: the console log formatter, now shared by both CLI tools.CHANGELOG.mdand packed alongside theother tools.
Design:
docs/design/permission-analyzer.md. Usage:src/PermissionAnalyzer/PermissionAnalyzer.Tool/README.md.Testing
dotnet test src/PermissionAnalyzer/PermissionAnalyzer.Tests: 273 tests compile snippets in memoryagainst the real SDK.
🤖 Generated with Claude Code