Conversation
…ustomizePagesIsEnabled
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.
Fixes #1224
Problem
PnP Framework's NoScript site guards currently block all property bag writes and all custom action updates on sites with
DenyAddAndCustomizePages = Enabled. This is too aggressive in two scenarios:Property bag writes — SharePoint supports a tenant-level setting
AllowWebPropertyBagUpdateWhenDenyAddAndCustomizePagesIsEnabledthat re-enables property bag operations on NoScript sites. The framework ignores this flag entirely, causing provisioning to silently skip property bag entries, reindex operations, and theme metadata even when the tenant explicitly allows them.SPFx custom actions — SharePoint permits SPFx extensions (custom actions with a
ClientSideComponentId) on NoScript sites, but the framework blanket-blocks all custom action add/update operations, preventing SPFx provisioning from working.Solution
Property bag: probe-and-delegate
Since the tenant flag isn't exposed via any site-level API, the framework now uses a sentinel write probe: on NoScript sites, it attempts a temporary property bag write to detect whether the tenant override is active. If the write succeeds, the sentinel key is cleaned up and property bag operations proceed normally. If it fails, writes remain blocked (safe-by-default).
To avoid the extra round-trips of the probe, callers who already know the tenant flag value can set
PropertyBagWriteAllowedonProvisioningTemplateApplyingInformation:true— property bag writes proceed, no probefalse— property bag writes are skipped, no probenull(default) — auto-detect via sentinel probeThe same opt-in parameter is also available on the standalone
ReIndexWeb()andSetThemeByUrl()extension methods.Within the provisioning pipeline, the flag is resolved once at the start and shared across all handlers, so the probe cost is paid at most once per provisioning run.
Custom actions: per-action SPFx exemption
Instead of blanket-blocking all custom action operations on NoScript sites, the framework now checks each action individually. Actions with a non-empty
ClientSideComponentIdare recognized as SPFx extensions and exempted from the NoScript guard. Classic (non-SPFx) custom actions remain blocked as before.Backward compatibility
Note
All new parameters are optional with
nulldefaults — existing callers are unaffected. The default auto-detect behavior is safe-by-default: if the sentinel probe fails for any reason (permissions, connectivity, etc.), property bag writes remain blocked, preserving pre-existing behavior.