Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
003a669
Add design doc for permission analyzer tool
mkholt Oct 21, 2026
f6e18bd
Add permission analyzer tool, stage 1
mkholt Oct 21, 2026
3c1b4fa
Add user role lookup idea to permission analyzer design
mkholt Oct 21, 2026
3a78ce0
Add permission analyzer phase 2: entry points and call graph
mkholt Oct 21, 2026
b435122
Add permission analyzer phase 3: role coverage
mkholt Oct 22, 2026
8e24e0c
Add phase 3.5 to permission analyzer design: Execute rules and lookups
mkholt Oct 22, 2026
ec2e6ef
Add permission analyzer phase 3.5: Execute request rules
mkholt Oct 22, 2026
7900abb
Add permission analyzer phase 3.5: Append and AppendTo on lookups
mkholt Oct 22, 2026
9b4e1ce
Add permission analyzer phase 4: plugin cascades and .NET Framework l…
mkholt Oct 22, 2026
fb74a49
Report unknown-table cascades instead of firing every step
mkholt Oct 22, 2026
7fedd2e
Add permission analyzer phase 4: filtered attributes on Update steps
mkholt Oct 22, 2026
134aec9
Add permission analyzer phase 4: --operation scope with --attributes
mkholt Oct 22, 2026
74795a0
Add permission analyzer phase 4: plugin code from other solutions
mkholt Oct 22, 2026
450da14
Plan role verification and output clean-up for the permission analyzer
mkholt Oct 22, 2026
7fd61a4
Add permission analyzer phase 5: LINQ, privilege catalog and global p…
mkholt Oct 23, 2026
144989f
Let --solution take a project and move role verification to later
mkholt Oct 23, 2026
a1c2291
Add permission analyzer phase 5.5: verbosity levels and report filters
mkholt Oct 23, 2026
2bd4af6
Add permission analyzer phase 6: Markdown and SARIF output
mkholt Oct 23, 2026
b288786
Package the permission analyzer as a .NET tool, starting at v1.0.0-rc.1
mkholt Oct 23, 2026
385ccb7
Trim the permission analyzer changelog to the first release
mkholt Oct 23, 2026
7fb90ce
Merge remote-tracking branch 'origin/master' into security-role-analy…
mkholt Oct 23, 2026
5326a83
Tidy the permission analyzer tool after review
mkholt Oct 23, 2026
2170b65
Fix gaps in the permission analyzer core found in review
mkholt Oct 23, 2026
dc66591
Share the Roslyn helpers and rule application in the permission analyzer
mkholt Oct 23, 2026
ad93631
Give entry points and unreached methods a common type in the permissi…
mkholt Oct 23, 2026
8c50b2a
Match request messages by their own name in the permission analyzer
mkholt Oct 23, 2026
4cba2da
Speed up extraction in the permission analyzer
mkholt Oct 26, 2026
9d28e54
Split privilege resolution out of the permission analyzer's manifest …
mkholt Oct 26, 2026
03e9448
Tidy smaller structures in the permission analyzer
mkholt Oct 26, 2026
22a0e38
Merge the permission analyzer's commands into the root command
mkholt Oct 26, 2026
6d29592
Report workflows that operations fire in the permission analyzer
mkholt Oct 26, 2026
9176ee0
Note duplication with XrmMockup and the metadata tool for later conso…
mkholt Oct 27, 2026
035fc5a
Rename --verbosity to --detail and clean up the permission analyzer's…
mkholt Oct 27, 2026
9b01000
Share the metadata tool's log formatter with the permission analyzer
mkholt Oct 27, 2026
538e91d
Count analyses stopped at the call limit as incomplete
mkholt Oct 27, 2026
8cecf96
Keep the permission analyzer's Markdown on one line per cell and coun…
mkholt Oct 27, 2026
acebc0d
Warn about role settings that match nothing and normalize user ids
mkholt Oct 27, 2026
094a42b
Document trust and CI use of the permission analyzer
mkholt Oct 27, 2026
bd8a95f
Load each project once across the permission analyzer's code paths
mkholt Oct 27, 2026
451782f
Log projects as they start and skip re-binding clean code for compile…
mkholt Oct 27, 2026
107d2c3
Read Metadata.xml once for both lookups and plugin steps
mkholt Oct 27, 2026
57cfc91
Name MetadataFileLoader in the refactors design doc
mkholt Oct 27, 2026
fa1b2f7
Let Metadata.xml win over the other metadata files, as in XrmMockup
mkholt Oct 27, 2026
b9f3bae
Don't look up the configured principals' roles when --role replaces them
mkholt Oct 27, 2026
41eaf8d
Keep both accesses when a call resolves differently per target framework
mkholt Oct 27, 2026
6e963cf
Fire close requests' steps on the record, with Win and Lose steps
mkholt Oct 27, 2026
fe8ff67
Qualify function ids with the function app's assembly
mkholt Oct 27, 2026
dd10267
Give overloads that differ only in generics or namespaces their own ids
mkholt Oct 27, 2026
d21f728
Preserve framework-specific helper facts when merging permission anal…
mkholt Nov 18, 2026
f6a0d44
Merge master
mkholt Nov 18, 2026
7000170
Merge remote-tracking branch 'refs/remotes/origin/master' into securi…
mkholt Nov 18, 2026
fd60b0e
Merge remote-tracking branch 'refs/remotes/origin/master' into securi…
mkholt Nov 18, 2026
a129b76
Add opt-in static permission checks to XrmMockup tests
mkholt Nov 18, 2026
6c6fda1
Merge master
mkholt Nov 18, 2026
1b5b54f
Merge remote-tracking branch 'refs/remotes/origin/master' into securi…
mkholt Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
- name: Pack MetadataGenerator.Tool
run: dotnet pack src/MetadataGen/MetadataGenerator.Tool/MetadataGenerator.Tool.csproj --configuration Release --no-build --output ./nupkg

- name: Pack PermissionAnalyzer.Tool
run: dotnet pack src/PermissionAnalyzer/PermissionAnalyzer.Tool/PermissionAnalyzer.Tool.csproj --configuration Release --no-build --output ./nupkg

- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- '.github/workflows/**'
- 'Directory.Build.props'
- 'src/MetadataGen/Directory.Build.props'
- 'src/PermissionAnalyzer/Directory.Build.props'
- 'src/PermissionAnalyzer/PermissionAnalyzer.Tool/PermissionAnalyzer.Tool.csproj'
- 'src/MetadataGen/MetadataGenerator.Tool/MetadataGenerator.Tool.csproj'
- 'src/XrmMockup365/XrmMockup365.csproj'
push:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release
on:
push:
tags: ['core-v*', 'metadata-v*']
tags: ['core-v*', 'metadata-v*', 'permissions-v*']
workflow_dispatch:
inputs:
tag:
Expand All @@ -15,7 +15,7 @@ on:
permissions:
contents: read
concurrency:
group: release-product-${{ startsWith(inputs.tag || github.ref_name, 'metadata-v') && 'metadata' || 'core' }}
group: release-product-${{ startsWith(inputs.tag || github.ref_name, 'permissions-v') && 'permissions' || (startsWith(inputs.tag || github.ref_name, 'metadata-v') && 'metadata' || 'core') }}
cancel-in-progress: false
queue: max
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/setup-release-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
$config = Get-Content scripts/release/config.json -Raw | ConvertFrom-Json -AsHashtable
$labels = @('product:core', 'product:metadata', 'product:none') + @($config.categories.Keys)
$labels = @($config.products.Keys | ForEach-Object { "product:$_" }) + @('product:none') + @($config.categories.Keys)
foreach ($label in $labels) {
gh label create $label --color 5319e7 --description 'Release classification' --force --repo $env:GITHUB_REPOSITORY
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Expand Down
48 changes: 46 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ plugins, workflows, custom APIs, and security can be tested without a live envir
- `Workflow/`, including `WorkflowNode/`: workflow parsing and execution.
- `XrmMockupSettings.cs`: authoritative settings types and defaults; inspect it
before changing configuration or writing examples.
- `src/PermissionAnalyzer/`: static Dataverse privilege analysis shared by the SDK and
standalone `xrmmockup-permissions` tool.
- `PermissionAnalyzer.Abstractions/`: SDK-free models, scopes, results, and role coverage
(`netstandard2.0`).
- `PermissionAnalyzer.Core/`: Roslyn operation extraction, call graphs, cascades, and
manifest building (`netstandard2.0`).
- `PermissionAnalyzer.Workspace/`: opt-in .NET 10 source loading, configuration, and
metadata readers using private wire contracts.
- `PermissionAnalyzer.Tool/`: CLI frontend, packaged as `XrmMockup.PermissionAnalyzer`.
- `PermissionAnalyzer.Tests/`: snippets compiled in memory against the real SDK and
analyzer/loader regression tests.
- `src/ToolsCommon/`: shared CLI infrastructure, including console log formatting.
This and the permission libraries are internal/non-packable projects; owning product
packages ship their assemblies, not additional independently released NuGet packages.
- `src/MetadataSkeleton/`: serialized metadata model shared by the engine and generators.
- `src/MetadataGen/`:
- `MetadataGenerator365/`: legacy .NET Framework generator, still bundled in the core package.
Expand Down Expand Up @@ -51,21 +65,30 @@ dotnet test tests/XrmMockup365Test/XrmMockup365Test.csproj --framework net10.0 -

# Metadata generator tests
dotnet test src/MetadataGen/MetadataGenerator.Tool.Tests/MetadataGenerator.Tool.Tests.csproj

# Permission analyzer tests
dotnet test src/PermissionAnalyzer/PermissionAnalyzer.Tests/PermissionAnalyzer.Tests.csproj

# Permission SDK and legacy-plugin compatibility regressions
dotnet test tests/XrmMockup365Test/XrmMockup365Test.csproj --framework net10.0 --filter "FullyQualifiedName~TestPermissionAnalysis|FullyQualifiedName~TestPluginFrameworkCompatibility"
```

A focused `net10.0` run does not replace full Windows/multi-target validation.
For code changes, run the affected tests first and the full suite when available;
report any SDK, platform, restore, or test limitations rather than claiming validation passed.

Local package preview (PowerShell; builds and packs both products without publishing):
Local package preview (PowerShell; builds and packs all three products without publishing):

```powershell
./scripts/Pack-Local.ps1
```

For release automation changes, also run `./scripts/release/Test-Release.ps1` in
PowerShell. See `RELEASE.md` for PR product/category classification and release
procedures. Do not hand-edit generated pending changelog sections or substitute
procedures. Product tags (`core-v*`, `metadata-v*`, `permissions-v*`) select one
package/symbol pair. `scripts/release/Prepare-Release.ps1` supplies its version and
notes through `.release/version.props`; ordinary builds use development versions.
Do not hand-edit generated pending changelog sections or substitute
ad hoc version changes for the product-scoped release process.

## Test conventions
Expand All @@ -83,6 +106,27 @@ ad hoc version changes for the product-scoped release process.
- Add regression coverage in the affected suite. Metadata reader tests normally use
`Fixtures/ReaderTestBase.cs` and `Fixtures/XrmMockupFactory.cs` in the tool test project.

## Static permission analysis

Checks are explicit static privilege analysis, not scenario execution or proof of
record-level access. Do not add automatic checks during CRUD execution, invoke the CLI
from the SDK, or mutate mockup state when checking permissions. Preserve current
user/team role resolution, separate impersonated identities, and strict failures for
missing privileges or incomplete analysis.

The .NET 10 SDK test project enables `XrmMockupEnablePermissionAnalysis` to copy the
shared library payload; it is loaded on demand in an isolated load context. The
lightweight contracts/check APIs remain available on .NET Framework, but source
loading requires .NET 10. Do not bundle either dotnet tool into Core or introduce
independently released permission-library packages.

Analyzer output must remain deterministic: use ordinal comparers, sort collections,
and write `\n` line endings. See `docs/design/permission-analyzer.md` for the engine
design and `docs/permission-analysis-sdk.md` for SDK setup and boundaries. CLI
configuration uses `XrmMockup:Permissions`; consult
`src/PermissionAnalyzer/PermissionAnalyzer.Tool/README.md` rather than duplicating
its options here.

## Metadata and live-environment boundaries

Ordinary tests use checked-in metadata: `tests/XrmMockup365Test/Metadata/` and
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ for plugins compiled against .NET Framework 4.6.2.
## Releasing

Maintainers: see [RELEASE.md](RELEASE.md) for PR labels, repository setup, and independent product releases.

## Static permission analysis

XrmMockup tests can explicitly check plugin or entity-operation privilege coverage using
`PermissionAnalysis` and `crm.CheckPermissions`. Workspace loading is opt-in; checks do not
execute scenarios or prove record-level access. See [the SDK guide](docs/permission-analysis-sdk.md).
12 changes: 7 additions & 5 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Release process

Core and metadata releases are independent. A product tag chooses the package and its version; maintainers do not edit version headings or copy release descriptions manually.
Core, metadata and permission analyzer releases are independent. A product tag chooses the package and its version; maintainers do not edit version headings or copy release descriptions manually.

## Repository setup

1. Run **Set up release labels** from `master` to create the labels below. The initial implementation PR is excluded by the migration cutoff; all subsequent PRs must be classified before merging.
2. Use **PR release labels** and the normal .NET **ci** check for source PRs. If you configure required checks, replace any old **PR product labels**, **PR change category**, or **validate** requirements with **PR release labels**. Continue reviewing source PRs normally. The changelog writer runs the required **ci** check on its generated commit before pushing directly to `master`; do not remove or bypass that check. Other rules (such as requiring all changes through a PR, or additional required checks) can still prohibit this direct-write design; `contents: write` does not bypass them.
3. Ensure repository/organization Actions policy permits `GITHUB_TOKEN` to use `contents: write`, `actions: write`, and `statuses: write`. The changelog workflow uses these to push commits, dispatch CI, and publish the verified CI result as a commit status, plus `pull-requests: read` for metadata. **Allow GitHub Actions to create and approve pull requests is not needed**; leave it disabled. No App or PAT is needed.
4. Keep `NUGET_USER` and the NuGet Trusted Publishing policy configured for `release.yml` and the two packages. Restrict who can create release tags.
4. Keep `NUGET_USER` and the NuGet Trusted Publishing policy configured for `release.yml` and the three packages. Restrict who can create release tags.

The separate **Release automation tests** workflow runs only for automation/workflow or packaging-configuration changes, or a manual dispatch. Do not make this path-filtered check globally required; if an old `release-automation` check was required, remove that requirement so unrelated PRs are not blocked. The single release-label check and .NET CI still run on every PR.

Expand All @@ -25,7 +25,8 @@ Every PR to `master` needs a product classification:
| --- | --- |
| `product:core` | Core package changes |
| `product:metadata` | Metadata tool changes |
| Both | Changes affecting both products |
| `product:permissions` | Permission analyzer tool changes |
| Multiple product labels | Changes affecting multiple products |
| `product:none` | Repository maintenance; no release-note entry |

`product:none` is exclusive: do not combine it with a product label. Use the affected product even if you are not planning an immediate release.
Expand Down Expand Up @@ -64,6 +65,7 @@ The initial notes collection cutoff is the release-automation rollout merge, PR
| --- | --- |
| `core-v<VERSION>` | `XrmMockup365` |
| `metadata-v<VERSION>` | `XrmMockup.MetadataGenerator` |
| `permissions-v<VERSION>` | `XrmMockup.PermissionAnalyzer` |

Use semantic versions such as `1.20.3` or `1.3.0-rc.1`. No combined-version tags are used for new releases.

Expand All @@ -90,9 +92,9 @@ The workflow checks out the exact source, builds/tests the solution, packs only

### Packaged changelogs and release notes

Release preparation replaces the selected product's `Unreleased` heading in the build checkout with the exact tag version and UTC release date in `d MMMM yyyy` format (for example, `4 November 2026`), using English month names. The other product's changelog and published history are left unchanged. This versioned section is saved as `.release/notes.md` and used for the GitHub release body, including prerelease suffixes. NuGet `PackageReleaseNotes` uses a separate `.release/package-notes.md` containing the latest 10 complete release sections (or all releases if fewer than 10 exist), followed by a link to the selected product's full changelog on GitHub.
Release preparation replaces the selected product's `Unreleased` heading in the build checkout with the exact tag version and UTC release date in `d MMMM yyyy` format (for example, `4 November 2026`), using English month names. The other products' changelogs and published history are left unchanged. This versioned section is saved as `.release/notes.md` and used for the GitHub release body, including prerelease suffixes. NuGet `PackageReleaseNotes` uses a separate `.release/package-notes.md` containing the latest 10 complete release sections (or all releases if fewer than 10 exist), followed by a link to the selected product's full changelog on GitHub.

The regular NuGet package includes the complete selected product changelog at its root: `RELEASE_NOTES.md` for `XrmMockup365`, or `CHANGELOG.md` for `XrmMockup.MetadataGenerator`. Before artifact upload and again before publication, validation checks that both package manifests contain the saved package release notes, that these match the latest 10 sections and full-history link from the packaged changelog, and that the changelog starts with the individual GitHub release section. Missing files, stale notes, and mismatched versions fail validation. Development/local preview packages retain their development notes and unreleased changelog; they are not publication artifacts.
The regular NuGet package includes the complete selected product changelog at its root: `RELEASE_NOTES.md` for `XrmMockup365`, or `CHANGELOG.md` for `XrmMockup.MetadataGenerator` and `XrmMockup.PermissionAnalyzer`. Before artifact upload and again before publication, validation checks that both package manifests contain the saved package release notes, that these match the latest 10 sections and full-history link from the packaged changelog, and that the changelog starts with the individual GitHub release section. Missing files, stale notes, and mismatched versions fail validation. Development/local preview packages retain their development notes and unreleased changelog; they are not publication artifacts.

## Failed release

Expand Down
8 changes: 8 additions & 0 deletions XrmMockup.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
<File Path="src/MetadataGen/scripts/Compare-MetadataGenerators.ps1" />
<File Path="src/MetadataGen/scripts/Regenerate-Metadata.ps1" />
</Folder>
<Folder Name="/PermissionAnalyzer/">
<Project Path="src/PermissionAnalyzer/PermissionAnalyzer.Abstractions/PermissionAnalyzer.Abstractions.csproj" />
<Project Path="src/PermissionAnalyzer/PermissionAnalyzer.Workspace/PermissionAnalyzer.Workspace.csproj" />
<Project Path="src/PermissionAnalyzer/PermissionAnalyzer.Core/PermissionAnalyzer.Core.csproj" />
<Project Path="src/PermissionAnalyzer/PermissionAnalyzer.Tests/PermissionAnalyzer.Tests.csproj" />
<Project Path="src/PermissionAnalyzer/PermissionAnalyzer.Tool/PermissionAnalyzer.Tool.csproj" />
</Folder>
<Folder Name="/project/">
<File Path=".github/workflows/ci.yml" />
<File Path=".github/workflows/release.yml" />
Expand Down Expand Up @@ -50,5 +57,6 @@
<File Path="tests/Regenerate-TestMetadata.ps1" />
</Folder>
<Project Path="src/MetadataSkeleton/MetadataSkeleton.shproj" />
<Project Path="src/ToolsCommon/ToolsCommon.csproj" />
<Project Path="src/XrmMockup365/XrmMockup365.csproj" />
</Solution>
Loading
Loading