Skip to content

ASPNet: template compiler csp onetime detection#34478

Draft
vorobey wants to merge 1 commit into
DevExpress:mainfrom
vorobey:feature/aspnet-template-compiler-csp-onetimer
Draft

ASPNet: template compiler csp onetime detection#34478
vorobey wants to merge 1 commit into
DevExpress:mainfrom
vorobey:feature/aspnet-template-compiler-csp-onetimer

Conversation

@vorobey

@vorobey vorobey commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

No description provided.

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 a one-time (cached) capability check for Function constructor usage in the ASP.NET template compiler, to avoid repeatedly triggering CSP violations/exceptions during template compilation.

Changes:

  • Introduced canUseFunctionConstructor() with memoized result to detect whether new Function(...) is permitted under the current CSP.
  • Updated template compilation to use new Function(...) only when allowed; otherwise it immediately falls back to the existing script-based/global-eval path (or returns raw text for non-<script> templates).

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.

2 participants