Skip to content

Add IsSandboxed to ITemplateRenderingEngine#25399

Merged
EngincanV merged 2 commits into
rel-10.4from
add-issandboxed-to-template-rendering-engine
May 12, 2026
Merged

Add IsSandboxed to ITemplateRenderingEngine#25399
EngincanV merged 2 commits into
rel-10.4from
add-issandboxed-to-template-rendering-engine

Conversation

@maliming

@maliming maliming commented May 10, 2026

Copy link
Copy Markdown
Member

ITemplateRenderingEngine exposes a new IsSandboxed property so callers can decide whether editing a template requires elevated trust. TemplateRenderingEngineBase defaults to false (secure-by-default).

RazorTemplateRenderingEngine declares IsSandboxed=false (compiles to a fully-trusted .NET assembly via Roslyn). ScribanTemplateRenderingEngine declares IsSandboxed=true and sets TemplateContext.MemberFilter to expose only public properties on imported objects, blocking method/field access and reflection escape paths.

The companion PR in https://github.com/volosoft/volo/pull/22286 wires this into the Text Template Management module.

ITemplateRenderingEngine exposes a new IsSandboxed property so callers can
decide whether editing a template requires elevated trust.

- TemplateRenderingEngineBase provides a virtual default of false (secure-by-default)
- RazorTemplateRenderingEngine declares IsSandboxed=false (compiles to .NET assembly via Roslyn)
- ScribanTemplateRenderingEngine declares IsSandboxed=true (DSL without .NET interop)
- Razor integration docs and TextTemplateManagement docs document the implications
- Migration guide for ABP 10.4 documents the new abstraction member
Copilot AI review requested due to automatic review settings May 10, 2026 04:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an IsSandboxed capability marker to the text templating rendering engine abstraction so callers (notably template-management UIs) can distinguish sandboxed DSL-based engines from fully-trusted, code-compiling engines.

Changes:

  • Extends ITemplateRenderingEngine with a new required IsSandboxed property, with a TemplateRenderingEngineBase default of false.
  • Explicitly declares IsSandboxed for the built-in engines: Scriban (true) and Razor (false).
  • Adds engine-specific tests plus documentation/migration-guide updates describing the security implications and upgrade steps.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
framework/src/Volo.Abp.TextTemplating.Core/Volo/Abp/TextTemplating/ITemplateRenderingEngine.cs Adds IsSandboxed to the public rendering-engine abstraction and documents intended meaning/usage.
framework/src/Volo.Abp.TextTemplating.Core/Volo/Abp/TextTemplating/TemplateRenderingEngineBase.cs Provides a virtual default for IsSandboxed (false) to minimize breakage for derived engines.
framework/src/Volo.Abp.TextTemplating.Razor/Volo/Abp/TextTemplating/Razor/RazorTemplateRenderingEngine.cs Marks Razor as non-sandboxed (IsSandboxed => false) with explanatory remarks.
framework/src/Volo.Abp.TextTemplating.Scriban/Volo/Abp/TextTemplating/Scriban/ScribanTemplateRenderingEngine.cs Marks Scriban as sandboxed (IsSandboxed => true) with explanatory remarks.
framework/test/Volo.Abp.TextTemplating.Razor.Tests/Volo/Abp/TextTemplating/Razor/RazorTemplateRenderingEngine_IsSandboxed_Tests.cs Adds tests asserting Razor’s IsSandboxed behavior and interface exposure.
framework/test/Volo.Abp.TextTemplating.Scriban.Tests/Volo/Abp/TextTemplating/Scriban/ScribanTemplateRenderingEngine_IsSandboxed_Tests.cs Adds tests asserting Scriban’s IsSandboxed behavior and interface exposure.
docs/en/framework/infrastructure/text-templating/razor.md Adds a security notice explaining the risks of runtime Razor template editing and how it relates to IsSandboxed.
docs/en/modules/text-template-management.md Documents permission/risk model for editing sandboxed vs non-sandboxed templates based on IsSandboxed.
docs/en/release-info/migration-guides/abp-10-4.md Adds migration guidance for the new interface member and related template-management security behavior.

Comment thread docs/en/release-info/migration-guides/abp-10-4.md Outdated
Comment thread docs/en/release-info/migration-guides/abp-10-4.md Outdated
@maliming maliming requested a review from Copilot May 10, 2026 04:13
@maliming maliming added this to the 10.4-final milestone May 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Comment thread docs/en/framework/infrastructure/text-templating/razor.md Outdated
Comment thread docs/en/release-info/migration-guides/abp-10-4.md Outdated
Comment thread docs/en/release-info/migration-guides/abp-10-4.md Outdated
@codecov

codecov Bot commented May 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 49.30%. Comparing base (d6c5fc7) to head (33157ec).
⚠️ Report is 327 commits behind head on rel-10.4.

Files with missing lines Patch % Lines
.../Abp/TextTemplating/TemplateRenderingEngineBase.cs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           rel-10.4   #25399      +/-   ##
============================================
- Coverage     49.30%   49.30%   -0.01%     
============================================
  Files          3667     3667              
  Lines        123171   123186      +15     
  Branches       9407     9409       +2     
============================================
  Hits          60731    60731              
- Misses        60631    60647      +16     
+ Partials       1809     1808       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Soften IsSandboxed XML doc as a best-effort marker
- Replace #XXXXX placeholders with #25399
- Set Scriban MemberFilter to allowlist public properties only,
  blocking method/field access and reflection escape paths
- Update Razor and Scriban safe-runtime docs to match
- Add reflection-escape, method-invocation and nested-property
  tests for Scriban

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.

@maliming maliming requested review from EngincanV and ebicoglu May 11, 2026 02:48
@EngincanV EngincanV merged commit b858efc into rel-10.4 May 12, 2026
7 of 8 checks passed
@EngincanV EngincanV deleted the add-issandboxed-to-template-rendering-engine branch May 12, 2026 06:36
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.

4 participants