Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - Security
Suggested answer

Power Pages : How to set dynamic nonce in CSP headers

(1) ShareShare
ReportReport
Posted on by 16
Hi Team,
 
As a part of security we were advised to add CSP headers in our Power Page application
In CSP headers when we add script-src tag , few core functionalities of our application stops working.
This is because script-src will not allow inline scripts to execute.
 
This can be overcome by using nonce tag which need to be enabled using Power Page management app.
But what we noticed is nonce tag is getting added to inline scripts with dynamically generated value.
 
This dynamically generated value is getting changed with every request.
 
Do we have any way to configure dynamic nonce value in Power Page Management security settings ?

Following is the snapshot of dynamically generated nonce value

Categories:
  • VKartik Profile Picture
    16 on at
    Power Pages : How to set dynamic nonce in CSP headers
    Hi 

    Thanks for your response
    I tried adding 'self' to script-src but that also doesn't help and i get the same error.
    Also i synced the settings after adding
    Following is the screenshot

  • Suggested answer
    oliver.rodrigues Profile Picture
    9,248 Most Valuable Professional on at
    Power Pages : How to set dynamic nonce in CSP headers
    My understanding here is that you don't need to worry about the dynamic token that is generated at all. The Portal server-side code should take care of ensuring that the JS code works (basically the nonce should match the token in your inline JS).
     
    Are you missing a "self" there in your script-src?
    for example:
     
    script-src 'self' 'nonce'

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,898 Most Valuable Professional

Leaderboard

Featured topics